Creating templates for raddropdownbutton element in bibbonbar

2 posts, 0 answers
  1. Divya
    Divya avatar
    47 posts
    Member since:
    Mar 2011

    Posted 17 May 2011 Link to this post

    Hi,

    I have a rad dropdownbutton element in ribbonbar for that dropdown i want to create templates .

    This i had done using janus same functionality shld be done using telerik i am posting the janus code can anyone see it and please explain me how to do in telerik what r the proerties used.

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.WordReportTemplates);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.SerialDocumentTemplates);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.ObjectDocumentTemplates);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.NewDocumentTemplates);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.ProtocolTemplates);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.InvitationTemplates);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.ProjectOverviewTemplates);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.TaskOverviewTemplates);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.TaskListTemplate);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.QueryFolderTemplate);

     

     

    PopulateWordReportFiles(

     

    Enums.WordTemplateFileTypes.LinkFolderTemplate);

     

     

    #region

     

     

    "menus for templates"

     

     

     

     

     

    private void PopulateWordReportFiles(Enums.WordTemplateFileTypes e)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    foreach (Janus.Windows.Ribbon.ButtonCommand cmd in rbgddReports_WordReports.Commands)

     

     

    {

     

     

     

     

    if (e == Enums.WordTemplateFileTypes.WordReportTemplates)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowWordReport);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.SerialDocumentTemplates)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowMailMerge);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.ObjectDocumentTemplates)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowObjectTemplate);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.NewDocumentTemplates)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowNewDocument);

     

     

    }

     

    }

     

     

     

     

    string sReportsPath = "";

     

     

     

     

     

    if (e == Enums.WordTemplateFileTypes.WordReportTemplates)

     

     

    {

     

    rbgddReports_WordReports.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.WordReportsTemplatesFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.SerialDocumentTemplates)

     

     

    {

     

    rbgddReports_SerialDocuments.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.SeriallettersFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.ObjectDocumentTemplates)

     

     

    {

     

    rbgddReports_ObjectDocuments.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.ObjectTemplateFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.NewDocumentTemplates)

     

     

    {

     

    rbgddReports_NewDocument.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.NewDocumentTemplateFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.ProtocolTemplates)

     

     

    {

     

     

     

     

    foreach (Janus.Windows.Ribbon.ButtonCommand cmd in rbDDReports_Doc_CreateProtocol.Commands)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowProtocolTemplate);

     

     

    }

     

    rbDDReports_Doc_CreateProtocol.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.ProtocolTemplatesFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.TaskListTemplate)

     

     

    {

     

     

     

     

    foreach (Janus.Windows.Ribbon.ButtonCommand cmd in rbDDReports_Doc_CreateTaskList.Commands)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowTaskListTemplate);

     

     

    }

     

    rbDDReports_Doc_CreateTaskList.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.TaskListTemplateFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.InvitationTemplates)

     

     

    {

     

     

     

     

    foreach (Janus.Windows.Ribbon.ButtonCommand cmd in rbDDReports_Doc_CreateInvitation.Commands)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowInvitationTemplate);

     

     

    }

     

    rbDDReports_Doc_CreateInvitation.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.InvitationTemplatesFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.ProjectOverviewTemplates)

     

     

    {

     

     

     

     

    foreach (Janus.Windows.Ribbon.ButtonCommand cmd in rbDDReports_Doc_ProjectOverview.Commands)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowProjectOverviewTemplate);

     

     

    }

     

    rbDDReports_Doc_ProjectOverview.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.ProjectOverviewTemplateFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.TaskOverviewTemplates)

     

     

    {

     

     

     

     

    foreach (Janus.Windows.Ribbon.ButtonCommand cmd in rbDDReports_Doc_TaskOverview.Commands)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowProjectOverviewTemplate);

     

     

    }

     

    rbDDReports_Doc_TaskOverview.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.TaskOverviewTemplateFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.QueryFolderTemplate)

     

     

    {

     

     

     

     

    foreach (Janus.Windows.Ribbon.ButtonCommand cmd in rbDDReports_Doc_QueryFolder.Commands)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowQueryFolderTemplate);

     

     

    }

     

    rbDDReports_Doc_QueryFolder.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.QueryFolderTemplateFolderPath;

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.LinkFolderTemplate)

     

     

    {

     

     

     

     

    foreach (Janus.Windows.Ribbon.ButtonCommand cmd in rbDDReports_Doc_LinkFolder.Commands)

     

     

    {

     

    cmd.Click -=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowQueryFolderTemplate);

     

     

    }

     

    rbDDReports_Doc_LinkFolder.Commands.Clear();

     

    sReportsPath =

     

     

    MosaiqueSettings.LinkFolderTemplateFolderPath;

     

     

    }

     

     

     

     

    if (sReportsPath == "")

     

     

    {

     

     

     

     

    //word reports template path is not configured.

     

     

     

     

     

     

     

     

     

     

     

    return;

     

     

    }

     

     

     

     

    if (System.IO.Directory.Exists(sReportsPath) == false)

     

     

    {

     

     

     

     

    //word reports template path is not accessible.

     

     

     

     

     

     

     

     

     

     

     

    return;

     

     

    }

     

     

     

     

    string sLanguageCode = clsObj.fnGetLangaugeCode(Common.iLanguageId);

     

     

     

     

     

    if (sLanguageCode != "")

     

     

    {

     

     

     

     

    if (sReportsPath.Substring(sReportsPath.Length - 2, 1) != @"\")

     

     

    sReportsPath +=

     

     

    @"\";

     

     

    sReportsPath += sLanguageCode;

     

     

     

     

    if (System.IO.Directory.Exists(sReportsPath))

     

     

    {

     

     

     

     

    //directory exists.

     

     

     

     

     

     

     

     

     

     

     

    DirectoryInfo di = new DirectoryInfo(sReportsPath);

     

     

     

     

     

    if (e == Enums.WordTemplateFileTypes.WordReportTemplates)

     

     

    {

     

    GetWordFiles(di, rbgddReports_WordReports,

     

     

    Enums.WordTemplateFileTypes.WordReportTemplates);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.SerialDocumentTemplates)

     

     

    {

     

    GetWordFiles(di, rbgddReports_SerialDocuments,

     

     

    Enums.WordTemplateFileTypes.SerialDocumentTemplates);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.ObjectDocumentTemplates)

     

     

    {

     

    GetWordFiles(di, rbgddReports_ObjectDocuments,

     

     

    Enums.WordTemplateFileTypes.ObjectDocumentTemplates);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.NewDocumentTemplates)

     

     

    {

     

    GetWordFiles(di, rbgddReports_NewDocument,

     

     

    Enums.WordTemplateFileTypes.NewDocumentTemplates);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.ProtocolTemplates)

     

     

    {

     

    GetWordFiles(di, rbDDReports_Doc_CreateProtocol,

     

     

    Enums.WordTemplateFileTypes.ProtocolTemplates);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.InvitationTemplates)

     

     

    {

     

    GetWordFiles(di, rbDDReports_Doc_CreateInvitation,

     

     

    Enums.WordTemplateFileTypes.InvitationTemplates);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.ProjectOverviewTemplates)

     

     

    {

     

    GetWordFiles(di, rbDDReports_Doc_ProjectOverview,

     

     

    Enums.WordTemplateFileTypes.ProjectOverviewTemplates);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.TaskOverviewTemplates)

     

     

    {

     

    GetWordFiles(di, rbDDReports_Doc_TaskOverview,

     

     

    Enums.WordTemplateFileTypes.TaskOverviewTemplates);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.TaskListTemplate)

     

     

    {

     

    GetWordFiles(di, rbDDReports_Doc_CreateTaskList,

     

     

    Enums.WordTemplateFileTypes.TaskListTemplate);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.QueryFolderTemplate)

     

     

    {

     

    GetWordFiles(di, rbDDReports_Doc_QueryFolder,

     

     

    Enums.WordTemplateFileTypes.QueryFolderTemplate);

     

     

    }

     

     

     

     

    else if (e == Enums.WordTemplateFileTypes.LinkFolderTemplate)

     

     

    {

     

    GetWordFiles(di, rbDDReports_Doc_LinkFolder,

     

     

    Enums.WordTemplateFileTypes.LinkFolderTemplate);

     

     

    }

     

    }

     

    }

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private void GetWordFiles(DirectoryInfo di, Janus.Windows.Ribbon.DropDownCommand rbgdd, Enums.WordTemplateFileTypes enm)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    foreach (DirectoryInfo diChild in di.GetDirectories())

     

     

    {

     

     

     

     

    // add menu item to represent directory which can have children.

     

     

     

     

     

     

     

     

    Janus.Windows.Ribbon.

     

     

    DropDownCommand cmdDir = new Janus.Windows.Ribbon.DropDownCommand();

     

     

    cmdDir.Text = diChild.Name;

     

    cmdDir.ImageKey = ((

     

     

    int)Enums.Icons.Objects_DataFolder_Documents).ToString();

     

     

    rbgdd.Commands.Add(cmdDir);

     

    GetWordFiles(diChild, cmdDir, enm);

     

     

     

     

    if (cmdDir.Commands.Count == 0)

     

     

    cmdDir.Enabled =

     

     

    false;

     

     

    }

     

     

     

     

    foreach (FileInfo fi in di.GetFiles())

     

     

    {

     

     

     

     

    if ((File.GetAttributes(fi.FullName) & FileAttributes.Hidden) != FileAttributes.Hidden)

     

     

    {

     

     

     

     

    string sExtension = fi.Extension;

     

     

     

     

     

    if (fi.Extension == ".dot" || fi.Extension == ".dotx" || fi.Extension == ".dotm")

     

     

    {

     

     

     

     

    if (sExtension == ".dot")

     

     

    {

     

    sExtension =

     

     

    ".doc";

     

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

    sExtension =

     

     

    ".docx";

     

     

    }

     

    Janus.Windows.Ribbon.

     

     

    ButtonCommand cmd = null;

     

     

     

     

     

    string sCommandTitle = fi.Name;

     

     

    sCommandTitle = sCommandTitle.Substring(0, fi.Name.Length - (fi.Extension.Length));

     

    cmd =

     

     

    new Janus.Windows.Ribbon.ButtonCommand("", sCommandTitle);

     

     

    cmd.Key = fi.FullName;

     

     

     

     

    //cmd.ImageKey = ((int)Enums.Icons.ribbon_Start_IDFix_NewWordFile).ToString();

     

     

     

     

     

     

     

     

     

     

     

    Bitmap bm = Common.GetFileImageFromExtension(sExtension);

     

     

     

     

     

    if (bm != null)

     

     

    { cmd.Image = bm; }

     

     

     

     

     

     

    if (enm == Enums.WordTemplateFileTypes.WordReportTemplates)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowWordReport);

     

     

    }

     

     

     

     

    else if (enm == Enums.WordTemplateFileTypes.ObjectDocumentTemplates)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowObjectTemplate);

     

     

    }

     

     

     

     

    else if (enm == Enums.WordTemplateFileTypes.SerialDocumentTemplates)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowMailMerge);

     

     

    }

     

     

     

     

    else if (enm == Enums.WordTemplateFileTypes.NewDocumentTemplates)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowNewDocument);

     

     

    }

     

     

     

     

    else if (enm == Enums.WordTemplateFileTypes.ProtocolTemplates)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowProtocolTemplate);

     

     

    }

     

     

     

     

    else if (enm == Enums.WordTemplateFileTypes.InvitationTemplates)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowInvitationTemplate);

     

     

    }

     

     

     

     

    else if (enm == Enums.WordTemplateFileTypes.ProjectOverviewTemplates)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowProjectOverviewTemplate);

     

     

    }

     

     

     

     

    else if (enm == Enums.WordTemplateFileTypes.TaskOverviewTemplates)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowProjectOverviewTemplate);

     

     

    }

     

     

     

     

    else if (enm == Enums.WordTemplateFileTypes.TaskListTemplate)

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowTaskListTemplate);

     

     

    }

     

     

     

     

    else if ((enm == Enums.WordTemplateFileTypes.QueryFolderTemplate) ||

     

     

    (enm ==

     

     

    Enums.WordTemplateFileTypes.LinkFolderTemplate))

     

     

    {

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowQueryFolderTemplate);

     

     

    }

     

    rbgdd.Commands.Add(cmd);

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

     

     

     

    if (enm == Enums.WordTemplateFileTypes.NewDocumentTemplates)

     

     

    {

     

    Janus.Windows.Ribbon.

     

     

    ButtonCommand cmd = null;

     

     

     

     

     

    string sCommandTitle = fi.Name;

     

     

    sCommandTitle = sCommandTitle.Substring(0, fi.Name.Length - (fi.Extension.Length));

     

    cmd =

     

     

    new Janus.Windows.Ribbon.ButtonCommand("", sCommandTitle);

     

     

    cmd.Key = fi.FullName;

     

     

     

     

    if (sExtension.ToLower() == ".xlt")

     

     

    {

     

    sExtension =

     

     

    ".xls";

     

     

    }

     

     

     

     

    else if (sExtension == ".xltx" || sExtension == ".xltm")

     

     

    {

     

    sExtension =

     

     

    ".xlsx";

     

     

    }

     

     

     

     

    Bitmap bm = Common.GetFileImageFromExtension(sExtension);

     

     

     

     

     

    if (bm != null)

     

     

    { cmd.Image = bm; }

     

    cmd.Click +=

     

     

    new Janus.Windows.Ribbon.CommandEventHandler(this.ShowNewDocument);

     

     

    rbgdd.Commands.Add(cmd);

     

    }

     

    }

     

    }

     

    }

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private void ShowWordReport(object sender, Janus.Windows.Ribbon.CommandEventArgs e)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    Common.ShowWordReport(e.Command.Key, false, "", 0, 0, Common.iUserID);

     

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

     

     

    private void CallNewWordTemplate(string strPath)

     

     

    {

     

     

     

     

    this.Cursor = Cursors.WaitCursor;

     

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    int iObjectId = int.Parse(grdTreeObjects.CurrentRow.Cells["ID"].Value.ToString());

     

     

     

     

     

    Enums.MosaiqueObjects objType = Enums.MosaiqueObjects.Meeting;

     

     

     

     

     

    Control ctl = uiPanRightContainer.Controls[0];

     

     

     

     

     

    if (ctl.GetType() == typeof(ctlAgendaItems))

     

     

    {

     

    objType =

     

     

    Enums.MosaiqueObjects.AgendaItem;

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlTasks))

     

     

    {

     

     

     

     

    if ((Common.grdCurrentRow != null) && (Common.grdCurrentRow.GridEX == grdTreeObjects) &&

     

     

    (grdTreeObjects.CurrentRow.Cells[

     

     

    "ViewRight"].Value.ToString() == "1") &&

     

     

    (grdTreeObjects.CurrentRow.Cells[

     

     

    "Tag"].Value.ToString() == ((int)Enums.ObjectNodes.DataFolder_Projects_Project).ToString()))

     

     

    {

     

    objType =

     

     

    Enums.MosaiqueObjects.Project;

     

     

    }

     

     

     

     

    else if ((Common.grdCurrentRow != null) && (Common.grdCurrentRow.GridEX == grdTreeObjects) &&

     

     

    (grdTreeObjects.CurrentRow.Cells[

     

     

    "ViewRight"].Value.ToString() == "1") &&

     

     

    (grdTreeObjects.CurrentRow.Cells[

     

     

    "Tag"].Value.ToString() == ((int)Enums.ObjectNodes.DataFolder_Tasks_Task).ToString()))

     

     

    {

     

    objType =

     

     

    Enums.MosaiqueObjects.Task;

     

     

    }

     

    }

     

     

     

     

    FileInfo fi = new FileInfo(strPath);

     

     

     

     

     

    string sSaveTempPath = "";

     

     

     

     

     

    string sDefaultName = "";

     

     

    sDefaultName = fi.Name.Split(

     

     

    '.')[0];

     

     

    sDefaultName +=

     

     

    " [" + DateTime.Today.ToShortDateString().Replace('/', '.') + "]";

     

     

     

     

     

     

     

    string strExt = ".docx";

     

     

     

     

     

    if (fi.Extension.ToLower() == ".dot")

     

     

    strExt =

     

     

    ".doc";

     

     

     

     

     

    else if (fi.Extension.ToLower() == ".dotm" || fi.Extension.ToLower() == ".dotx")

     

     

    strExt =

     

     

    ".docx";

     

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

    strExt = fi.Extension;

     

    }

     

    sDefaultName += strExt;

     

     

     

     

    if (MosaiqueSettings.ManualDocumentNames)

     

     

    {

     

     

     

     

    frmRenameFile frmRName = new frmRenameFile(sDefaultName, false, strExt);

     

     

    frmRName.ShowDialog();

     

     

     

     

    if (!frmRName.bReNameCancelled)

     

     

    {

     

    frmRName.Close();

     

    sDefaultName = frmRName.strNewFileName;

     

     

     

     

    Application.DoEvents();

     

     

    }

     

    }

     

     

     

     

     

     

    if (!sDefaultName.EndsWith(strExt))

     

     

    {

     

    sDefaultName += strExt;

     

    }

     

    sSaveTempPath =

     

     

    Common.GetMosaiqueTempPath() + sDefaultName;// +strExt;

     

     

     

     

     

     

     

     

     

     

     

     

     

    if (Common.ShowWordReport(strPath, true, sSaveTempPath, objType, iObjectId, Common.iUserID))

     

     

    {

     

     

     

     

    //file is created based on the template.

     

     

     

     

     

     

     

     

     

     

     

    CFileInfo cfi = new CFileInfo(sSaveTempPath);

     

     

     

     

     

    clsDocuments clsObj = new clsDocuments();

     

     

     

     

     

    string sNewFileId = "";

     

     

    clsObj.fnSaveNewWordReport(objType, iObjectId, sSaveTempPath,

     

     

    Common.sUserName, ref sNewFileId,

     

     

    cfi.FileType, cfi.GetFileSize(cfi.FileSize), cfi.FileSize.ToString(), cfi.FileTitle,

     

    cfi.FileSubject, cfi.FileAuthor, cfi.FileCategory,

     

     

    "", cfi.FileComment);

     

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    if (File.Exists(sSaveTempPath))

     

     

    {

     

     

     

     

    File.Delete(sSaveTempPath);

     

     

    }

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    ex =

     

     

    null;

     

     

    }

     

     

     

     

     

     

     

     

    if (ctl.GetType() == typeof(ctlMeetings))

     

     

    {

     

    ((

     

     

    ctlMeetings)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlAgendaItems))

     

     

    {

     

    ((

     

     

    ctlAgendaItems)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlTasks))

     

     

    {

     

    ((

     

     

    ctlTasks)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    DialogResult dlgRes = DialogResult.No;

     

     

     

     

     

    if (Common.HiddenMessages[(int)Enums.MessagesDialogs.Reporting_Open_Report_] == true)

     

     

    {

     

     

     

     

    if (Common.HiddenMessagesDefaultValue[(int)Enums.MessagesDialogs.Reporting_Open_Report_] == 1)

     

     

    {

     

    dlgRes =

     

     

    DialogResult.Yes;

     

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

    dlgRes =

     

     

    DialogResult.No;

     

     

    }

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

    dlgRes =

     

     

    OfficeBox.Show(Common.TranslateText(Enums.InterFaces.Common, "Report generated successfully. Would you like to open?", Enums.TextType.Messages), "EPM", MessageBoxButtons.YesNo, OfficeBoxIcon.Question);

     

     

    }

     

     

     

     

    if (dlgRes == DialogResult.Yes)

     

     

    {

     

     

     

     

    if (ctl.GetType() == typeof(ctlMeetings))

     

     

    {

     

    ((

     

     

    ctlMeetings)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlAgendaItems))

     

     

    {

     

    ((

     

     

    ctlAgendaItems)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlTasks))

     

     

    {

     

    ((

     

     

    ctlTasks)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

    }

     

    }

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

     

     

     

    finally

     

     

     

     

     

     

     

     

    {

     

     

     

     

    this.Cursor = Cursors.Default;

     

     

    }

     

    }

     

     

     

     

    private void ShowQueryFolderTemplate(object sender, Janus.Windows.Ribbon.CommandEventArgs e)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    int iObjectId = int.Parse(grdTreeObjects.CurrentRow.Cells["ID"].Value.ToString());

     

     

     

     

     

    Enums.MosaiqueObjects objType = Enums.MosaiqueObjects.QueryFolder;

     

     

     

     

     

    Common.ShowWordReport(e.Command.Key, false, "", objType, iObjectId, Common.iUserID);

     

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private void ShowProjectOverviewTemplate(object sender, Janus.Windows.Ribbon.CommandEventArgs e)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    bool bIsSaveinDoc = MosaiqueSettings.IsSavePrjOverviewTemplateinDoc;

     

     

     

     

     

    int iObjectId = int.Parse(grdTreeObjects.CurrentRow.Cells["ID"].Value.ToString());

     

     

     

     

     

    Enums.MosaiqueObjects objType = Enums.MosaiqueObjects.Project;

     

     

     

     

     

    if ((Common.grdCurrentRow != null) && (Common.grdCurrentRow.GridEX == grdTreeObjects) &&

     

     

    (grdTreeObjects.CurrentRow.Cells[

     

     

    "ViewRight"].Value.ToString() == "1") &&

     

     

    (grdTreeObjects.CurrentRow.Cells[

     

     

    "Tag"].Value.ToString() == ((int)Enums.ObjectNodes.DataFolder_Tasks_Task).ToString()))

     

     

    {

     

    objType =

     

     

    Enums.MosaiqueObjects.Task;

     

     

    bIsSaveinDoc =

     

     

    MosaiqueSettings.IsSaveTaskOverviewTemplateinDoc;

     

     

    }

     

     

     

     

    if (bIsSaveinDoc)

     

     

    CallNewWordTemplate(e.Command.Key);

     

     

     

     

    else

     

     

     

     

     

     

     

     

     

     

     

    Common.ShowWordReport(e.Command.Key, false, "", objType, iObjectId, Common.iUserID);

     

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private void ShowInvitationTemplate(object sender, Janus.Windows.Ribbon.CommandEventArgs e)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    int iObjectId = int.Parse(grdTreeObjects.CurrentRow.Cells["ID"].Value.ToString());

     

     

     

     

     

    if (MosaiqueSettings.IsSaveInvitationTemplateinDoc)

     

     

    CallNewWordTemplate(e.Command.Key);

     

     

     

     

    else

     

     

     

     

     

     

     

     

     

     

     

    Common.ShowWordReport(e.Command.Key, false, "", Enums.MosaiqueObjects.Meeting, iObjectId, Common.iUserID);

     

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private void ShowTaskListTemplate(object sender, Janus.Windows.Ribbon.CommandEventArgs e)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    int iObjectId = int.Parse(grdTreeObjects.CurrentRow.Cells["ID"].Value.ToString());

     

     

     

     

     

    if (MosaiqueSettings.IsSaveTaskListTemplateinDoc)

     

     

    CallNewWordTemplate(e.Command.Key);

     

     

     

     

    else

     

     

     

     

     

     

     

     

     

     

     

    Common.ShowWordReport(e.Command.Key, false, "", Enums.MosaiqueObjects.Meeting, iObjectId, Common.iUserID);

     

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private void ShowProtocolTemplate(object sender, Janus.Windows.Ribbon.CommandEventArgs e)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    int iObjectId = int.Parse(grdTreeObjects.CurrentRow.Cells["ID"].Value.ToString());

     

     

     

     

     

    if (MosaiqueSettings.IsSaveProtocolTemplateinDoc)

     

     

    CallNewWordTemplate(e.Command.Key);

     

     

     

     

    else

     

     

     

     

     

     

     

     

     

     

     

    Common.ShowWordReport(e.Command.Key, false, "", Enums.MosaiqueObjects.Meeting, iObjectId, Common.iUserID);

     

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private void ShowNewDocument(object sender, Janus.Windows.Ribbon.CommandEventArgs e)

     

     

    {

     

     

     

     

    if (uiPanRightContainer.Controls.Count > 0)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    this.Cursor = Cursors.WaitCursor;

     

     

     

     

     

    Control ctl = uiPanRightContainer.Controls[0];

     

     

     

     

     

    if (ctl.GetType() == typeof(ctlOrganisation) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlPersons) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlContacts) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlTasks) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlDecission) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlAgendaItems) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlMeetings))

     

     

    {

     

     

     

     

    if (IsCurrentObjectNew())

     

     

    {

     

     

     

     

    string sMessage = "Please save changes to current object before launching report generation.";

     

     

    sMessage =

     

     

    Common.TranslateText(Enums.InterFaces.Common, sMessage, Enums.TextType.Messages);

     

     

     

     

     

    OfficeBox.Show(sMessage, "EPM", MessageBoxButtons.OK, OfficeBoxIcon.Information);

     

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

     

     

     

    int iObjectTypeId = int.Parse(grdTreeObjects.CurrentRow.Cells["ObjectTypeId"].Value.ToString());

     

     

     

     

     

    int iObjectId = int.Parse(grdTreeObjects.CurrentRow.Cells["ID"].Value.ToString());

     

     

     

     

     

    FileInfo fi = new FileInfo(e.Command.Key);

     

     

     

     

     

    string sSaveTempPath = "";

     

     

     

     

     

    string sDefaultName = "";

     

     

    sDefaultName = fi.Name.Split(

     

     

    '.')[0];

     

     

    sDefaultName +=

     

     

    " [" + DateTime.Today.ToShortDateString().Replace('/', '.') + "]";

     

     

     

     

     

    bool bOtherType = false;

     

     

     

     

     

     

     

    string strExt = ".docx";

     

     

     

     

     

    if (fi.Extension.ToLower() == ".dot")

     

     

    strExt =

     

     

    ".doc";

     

     

     

     

     

    else if (fi.Extension.ToLower() == ".dotm" || fi.Extension.ToLower() == ".dotx")

     

     

    strExt =

     

     

    ".docx";

     

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

    strExt = fi.Extension;

     

    bOtherType =

     

     

    true;

     

     

    }

     

    sDefaultName += strExt;

     

     

     

     

    if (MosaiqueSettings.ManualDocumentNames)

     

     

    {

     

     

     

     

    frmRenameFile frmRName = new frmRenameFile(sDefaultName, false, strExt);

     

     

    frmRName.ShowDialog();

     

     

     

     

    if (!frmRName.bReNameCancelled)

     

     

    {

     

    frmRName.Close();

     

    sDefaultName = frmRName.strNewFileName;

     

     

     

     

    Application.DoEvents();

     

     

    }

     

    }

     

     

     

     

     

     

    if (!sDefaultName.EndsWith(strExt))

     

     

    {

     

    sDefaultName += strExt;

     

    }

     

    sSaveTempPath =

     

     

    Common.GetMosaiqueTempPath() + sDefaultName;// +strExt;

     

     

     

     

     

     

     

     

     

     

     

    CFileInfo cfi = null;

     

     

     

     

     

    clsDocuments clsObj = new clsDocuments();

     

     

     

     

     

    string sNewFileId = "";

     

     

     

     

     

    if (bOtherType == false)

     

     

    {

     

     

     

     

    if (Common.ShowWordReport(e.Command.Key, true, sSaveTempPath, (Enums.MosaiqueObjects)iObjectTypeId, iObjectId, Common.iUserID, true))

     

     

    {

     

    cfi =

     

     

    new CFileInfo(sSaveTempPath);

     

     

    clsObj.fnSaveNewWordReport((

     

     

    Enums.MosaiqueObjects)iObjectTypeId, iObjectId, sSaveTempPath,

     

     

     

     

     

    Common.sUserName, ref sNewFileId, cfi.FileType,

     

     

    cfi.GetFileSize(cfi.FileSize), cfi.FileSize.ToString(), cfi.FileTitle,

     

    cfi.FileSubject, cfi.FileAuthor, cfi.FileCategory,

     

     

    "", cfi.FileComment);

     

     

     

     

     

    //new file is saved to database.

     

     

     

     

     

     

     

     

    AddAndOpenFileToObject(ctl, sNewFileId);

     

    }

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

     

     

     

    File.Copy(fi.FullName, sSaveTempPath, true);

     

     

    cfi =

     

     

    new CFileInfo(sSaveTempPath);

     

     

    clsObj.fnSaveNewWordReport((

     

     

    Enums.MosaiqueObjects)iObjectTypeId, iObjectId, sSaveTempPath,

     

     

     

     

     

    Common.sUserName, ref sNewFileId, cfi.FileType,

     

     

    cfi.GetFileSize(cfi.FileSize), cfi.FileSize.ToString(), cfi.FileTitle,

     

    cfi.FileSubject, cfi.FileAuthor, cfi.FileCategory,

     

     

    "", cfi.FileComment);

     

     

     

     

     

    //new file is saved to database.

     

     

     

     

     

     

     

     

    AddAndOpenFileToObject(ctl, sNewFileId);

     

    }

     

    clsObj =

     

     

    null;

     

     

    }

     

    }

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

     

     

     

    finally

     

     

     

     

     

     

     

     

    {

     

     

     

     

    this.Cursor = Cursors.Default;

     

     

    }

     

    }

     

    }

     

     

     

     

    private void ShowObjectTemplate(object sender, Janus.Windows.Ribbon.CommandEventArgs e)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    if (uiPanRightContainer.Controls.Count > 0)

     

     

    {

     

     

     

     

    Control ctl = uiPanRightContainer.Controls[0];

     

     

     

     

     

    if (ctl.GetType() == typeof(ctlOrganisation) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlPersons) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlContacts) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlTasks) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlDecission) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlAgendaItems) ||

     

     

    ctl.GetType() ==

     

     

    typeof(ctlMeetings))

     

     

    {

     

     

     

     

    if (IsCurrentObjectSaved())

     

     

    {

     

     

     

     

    frmSearch frm = null;

     

     

    frm =

     

     

    new frmSearch(Enums.SearchType.Addresses_All, "A.IsActive=1", true, Enums.SearchingForField.ObjectDocuments, false);

     

     

    frm.ShowDialog();

     

     

     

     

    if (frm.bSearchCancelled == false)

     

     

    {

     

     

     

     

    if (frm.selectedRows != null && frm.selectedRows.Length > 0)

     

     

    {

     

     

     

     

    string sAddresseId = frm.selectedRows[0].Cells["AddresseId"].Value.ToString();

     

     

    frm.Close();

     

     

     

     

    Application.DoEvents();

     

     

     

     

     

    int iObjectTypeId = int.Parse(grdTreeObjects.CurrentRow.Cells["ObjectTypeId"].Value.ToString());

     

     

     

     

     

    int iObjectId = int.Parse(grdTreeObjects.CurrentRow.Cells["ID"].Value.ToString());

     

     

     

     

     

    Common.sObjDocs_SelectedAddresseId = sAddresseId;

     

     

     

     

     

    FileInfo fi = new FileInfo(e.Command.Key);

     

     

     

     

     

    string sSaveTempPath = "";

     

     

     

     

     

    string sDefaultName = "";

     

     

    sDefaultName = fi.Name.Split(

     

     

    '.')[0];

     

     

    sDefaultName +=

     

     

    " [" + DateTime.Today.ToShortDateString().Replace('/', '.') + "]";

     

     

     

     

     

    string strExt = ".docx";

     

     

     

     

     

    if (fi.Extension.ToLower() == ".dot")

     

     

    strExt =

     

     

    ".doc";

     

     

    sDefaultName += strExt;

     

     

     

     

    if (MosaiqueSettings.ManualDocumentNames)

     

     

    {

     

     

     

     

    frmRenameFile frmRName = new frmRenameFile(sDefaultName, false, strExt);

     

     

    frmRName.ShowDialog();

     

     

     

     

    if (!frmRName.bReNameCancelled)

     

     

    {

     

    frmRName.Close();

     

    sDefaultName = frmRName.strNewFileName;

     

     

     

     

    Application.DoEvents();

     

     

    }

     

    }

     

     

     

     

    //if (fi.Extension.ToLower() == ".dot")

     

     

     

     

     

     

     

     

     

     

     

    // sSaveTempPath = Common.GetMosaiqueTempPath() + sDefaultName + ".doc";

     

     

     

     

     

     

     

     

     

     

     

    //else

     

     

     

     

     

     

     

     

     

     

     

    if (!sDefaultName.EndsWith(strExt))

     

     

    {

     

    sDefaultName += strExt;

     

    }

     

    sSaveTempPath =

     

     

    Common.GetMosaiqueTempPath() + sDefaultName;// +strExt;

     

     

     

     

     

     

     

     

     

     

     

    if (Common.ShowWordReport(e.Command.Key, true, sSaveTempPath, (Enums.MosaiqueObjects)iObjectTypeId, iObjectId, Common.iUserID))

     

     

    {

     

     

     

     

    CFileInfo cfi = new CFileInfo(sSaveTempPath);

     

     

     

     

     

    clsDocuments clsObj = new clsDocuments();

     

     

     

     

     

    string sNewFileId = "";

     

     

    clsObj.fnSaveNewWordReport((

     

     

    Enums.MosaiqueObjects)iObjectTypeId, iObjectId, sSaveTempPath,

     

     

     

     

     

    Common.sUserName, ref sNewFileId, cfi.FileType,

     

     

    cfi.GetFileSize(cfi.FileSize), cfi.FileSize.ToString(), cfi.FileTitle,

     

    cfi.FileSubject, cfi.FileAuthor, cfi.FileCategory,

     

     

    "", cfi.FileComment);

     

     

    clsObj =

     

     

    null;

     

     

     

     

     

    //new file is saved to database.

     

     

     

     

     

     

     

     

    AddAndOpenFileToObject(ctl, sNewFileId);

     

    }

     

    }

     

    }

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

     

     

     

    string sMessage = "Please save changes to current object before launching report generation.";

     

     

    sMessage =

     

     

    Common.TranslateText(Enums.InterFaces.Common, sMessage, Enums.TextType.Messages);

     

     

     

     

     

    OfficeBox.Show(sMessage, "EPM", MessageBoxButtons.OK, OfficeBoxIcon.Information);

     

     

    }

     

    }

     

    }

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private void AddAndOpenFileToObject(Control ctl, string sNewFileId)

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    if (sNewFileId != "")

     

     

    {

     

     

     

     

    if (ctl.GetType() == typeof(ctlPersons))

     

     

    {

     

    ((

     

     

    ctlPersons)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlOrganisation))

     

     

    {

     

    ((

     

     

    ctlOrganisation)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlContacts))

     

     

    {

     

    ((

     

     

    ctlContacts)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlTasks))

     

     

    {

     

    ((

     

     

    ctlTasks)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlDecission))

     

     

    {

     

    ((

     

     

    ctlDecission)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlAgendaItems))

     

     

    {

     

    ((

     

     

    ctlAgendaItems)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlMeetings))

     

     

    {

     

    ((

     

     

    ctlMeetings)ctl).AddReportFile(sNewFileId);

     

     

    }

     

     

     

     

    DialogResult dlgRes = DialogResult.No;

     

     

     

     

     

    if (Common.HiddenMessages[(int)Enums.MessagesDialogs.Reporting_Open_Report_] == true)

     

     

    {

     

     

     

     

    if (Common.HiddenMessagesDefaultValue[(int)Enums.MessagesDialogs.Reporting_Open_Report_] == 1)

     

     

    {

     

    dlgRes =

     

     

    DialogResult.Yes;

     

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

    dlgRes =

     

     

    DialogResult.No;

     

     

    }

     

    }

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

    dlgRes =

     

     

    OfficeBox.Show(Common.TranslateText(Enums.InterFaces.Common, "Report generated successfully. Would you like to open?", Enums.TextType.Messages), "EPM", MessageBoxButtons.YesNo, OfficeBoxIcon.Question);

     

     

    }

     

     

     

     

    if (dlgRes == DialogResult.Yes)

     

     

    {

     

     

     

     

    if (ctl.GetType() == typeof(ctlPersons))

     

     

    {

     

    ((

     

     

    ctlPersons)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlOrganisation))

     

     

    {

     

    ((

     

     

    ctlOrganisation)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlContacts))

     

     

    {

     

    ((

     

     

    ctlContacts)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlTasks))

     

     

    {

     

    ((

     

     

    ctlTasks)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlDecission))

     

     

    {

     

    ((

     

     

    ctlDecission)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlAgendaItems))

     

     

    {

     

    ((

     

     

    ctlAgendaItems)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

     

     

     

    else if (ctl.GetType() == typeof(ctlMeetings))

     

     

    {

     

    ((

     

     

    ctlMeetings)ctl).ViewReportFile(sNewFileId);

     

     

    }

     

    }

     

    }

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

    OfficeDialog.

     

     

    OfficeBox.Show(ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, OfficeBoxIcon.Error);

     

     

     

     

     

    Common.LogMessage(ex);

     

     

    }

     

    }

     

     

     

     

    private bool IsCurrentObjectSaved()

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    if (grdTreeObjects.CurrentRow != null)

     

     

    {

     

     

     

     

    if (grdTreeObjects.CurrentRow.Cells["ID"].Value != null &&

     

     

    grdTreeObjects.CurrentRow.Cells[

     

     

    "ID"].Value.ToString() != "" &&

     

     

    grdTreeObjects.CurrentRow.Cells[

     

     

    "ID"].Value.ToString() != "-100" &&

     

     

    grdTreeObjects.CurrentRow.Cells[

     

     

    "ID"].Value.ToString() != "0")

     

     

    {

     

     

     

     

    if (grdTreeObjects.CurrentRow.Cells["ObjectTypeId"].Value != null &&

     

     

    grdTreeObjects.CurrentRow.Cells[

     

     

    "ObjectTypeId"].Value.ToString() != "")

     

     

    {

     

     

     

     

    if (IsDetailControlModified())

     

     

    {

     

     

    return false; }

     

     

     

     

     

    else

     

     

     

     

     

     

     

     

    {

     

     

    return true; }

     

     

    }

     

    }

     

    }

     

     

     

     

    return false;

     

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

     

     

     

    throw ex;

     

     

    }

     

    }

     

     

     

     

    private bool IsCurrentObjectNew()

     

     

    {

     

     

     

     

    try

     

     

     

     

     

     

     

     

    {

     

     

     

     

    if (grdTreeObjects.CurrentRow != null)

     

     

    {

     

     

     

     

    if (grdTreeObjects.CurrentRow.Cells["ID"].Value != null &&

     

     

    grdTreeObjects.CurrentRow.Cells[

     

     

    "ID"].Value.ToString() != "" &&

     

     

    grdTreeObjects.CurrentRow.Cells[

     

     

    "ID"].Value.ToString() != "-100" &&

     

     

    grdTreeObjects.CurrentRow.Cells[

     

     

    "ID"].Value.ToString() != "0")

     

     

    {

     

     

     

     

    if (grdTreeObjects.CurrentRow.Cells["ObjectTypeId"].Value != null &&

     

     

    grdTreeObjects.CurrentRow.Cells[

     

     

    "ObjectTypeId"].Value.ToString() != "")

     

     

    {

     

     

     

     

    return false;

     

     

    }

     

    }

     

    }

     

     

     

     

    return true;

     

     

    }

     

     

     

     

    catch (Exception ex)

     

     

    {

     

     

     

     

    throw ex;

     

     

    }

     

    }

     

     

     

     

     

     

    #endregion

     

     

     

    "menus for templates"

     

     

     

     

     

     

     

    the same i need to do using telerik raddropdownbutton element

     

  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 19 May 2011 Link to this post

    Hello Divya,

    You can create an instance of RadDropDownButtonElement in RadRibbonBar in similar way as our competitors. The following help article describes how to work with RadDropDownButton items. Please consider also the following example:

    foreach(ReportItem item in Reports)
    {   
        RadMenuItem myRadMenuItem = new RadMenuItem();
        myRadMenuItem.Text = item.Tex;
        myRadMenuItem.Click+=new EventHandle(Clicked)
        radDropDownButtonElement1.Items.Add(myRadMenuItem);
    }

    I hope this help. Don't hesitate to contact us if you have other questions.

    Regards,
    Peter
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top