Telerik Forums
UI for WinForms Forum
1 answer
109 views
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

 

Peter
Telerik team
 answered on 19 May 2011
1 answer
148 views
Hello,


   I am trying to use the RadMessageBox. What ddl's do i need to have for that and can you provide me some examples?

Thanks
Stefan
Telerik team
 answered on 19 May 2011
1 answer
57 views
hi,
I have a column in my SELECT statement for the grid that I want to use as a checkbox.  For example, it reads:  0 as selected. This is automatically set to read only, so I ticked it off in property builder. But when i tick it on in the grid and move off it says that the column is read only. Any way to fix this?

thanks.
Julian Benkov
Telerik team
 answered on 19 May 2011
2 answers
149 views
should this work? I cant' seem to get BrinigIntoView() to scroll my Treeviews.

Regards
Erwin
Stefan
Telerik team
 answered on 19 May 2011
1 answer
180 views
The LoadLayout method of the RadGridView will sometimes throw an error "Collection was modified; enumeration operation may not execute." We have found that this happens after the following sequence of events:

1. Define one or more filters in the grid.
2. Use SaveLayout to save the layout definition, which includes the filters.
3. Use LoadLayout to load the layout that includes filters.
2. Use LoadLayout to load a different layout that includes no filters.

Apparently some internal code is iterating through the filter descriptors and attempting to delete them within the iteration. The workaround that we found is to first execute a .Columns.Clear() to remove all of the existing columns. Since they are all going to be replaced by the new layout this produces the same end result, minus the error.

We believe that this problem was introduced sometime between 2010Q1 and 2011Q1. Upgrading from 2010Q1 to 2011Q1 has been one of the most frustrating and time consuming version changes that I have ever experienced. There are a lot of new features and a lot of fixes, but it seems that little thought was given to backward compatibility.
Jack
Telerik team
 answered on 19 May 2011
8 answers
269 views

Hi,
     Do you have a control similar to Winform Property Grid control with property grid features like Number/DateTime masking, list box, categories sorting etc.  Winform Property Grid control is neither enough nor flexible enough for customizations.

 

Thanks,

Rangarajan.S

Stefan
Telerik team
 answered on 19 May 2011
5 answers
183 views
Hello,

Is it possible to create a header and footer for dropdownlist control,
and to insert controls to it?
exactly like in the asp.net ajax combobox control.

Thanks,
Oren
Boryana
Telerik team
 answered on 19 May 2011
2 answers
109 views
I have been browsing the forums searching for a solution to a DropDownList problem.  Our users want to be able to type into the drop down list editor and have the drop down list suggest matches in the list or accept whatever text is typed into the editor portion of the control.  We are using a DropDownList with DropDownStyle = DropDown and AutoComplete = Suggest

Currently, when users type in a series of characters in the editor portion of the control which does not match any item in the list, the control refuses to give up focus so users cannot press the "Save" button. 

For example, if the list consists of the following items:

ABC123
ABCXYZ
ABQRSTU
A12345

when the user types "A", the control suggests all four choices.  When the users types "AB", the control suggests the first three choices.  If the user continues typing "ABCD" the control has no suggestions.  At this point, the control will refuse to give up focus so the user can press the "Save" button to save the text entered, namely "ABCD".

in short, we want the drop down list to be both a drop down list and a text box.

Any suggestions would be appreciated!  Thank you "in advance" for your expertise.
Peter
Telerik team
 answered on 18 May 2011
37 answers
349 views
We put the latest build (Q3) on a few weeks ago. Now all of our comboboxes in the grids stopped working. I did not put on the Q2 version back on to confirm, but I (and my other team members) thought they worked in Q2.

Here is what happens:

1) User drops down a combobox in the grid.
2) User selects an entry from the combobox.
3) THE COMBO BOX DOES NOT CLOSE

Can anyone confirm this? Will there be a fix to this soon? Or do I have to write code in every one of our forms to manually close the combobox? If I have to write code, anyone know what that code would look like?

Thanks for any tips!
Stefan
Telerik team
 answered on 18 May 2011
7 answers
142 views

Hi

 

I have column GridViewTextBoxColumn.
For some rows I use
RadDropDownListEditor in this column. I have random issue that sometimes drop down list cannot be collapsed by mouse click I have to press enter to collapse drop down list. It works fine in Q2 SP2.

Very bad surprise...

Is there any workaround for this issue in Q3?

 

Regards

Stefan
Telerik team
 answered on 18 May 2011
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
NavigationView
VirtualKeyboard
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?