/// <summary> /// Handles the LinkClicked event of the MasterNameLinkLabel control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.Windows.Forms.LinkLabelLinkClickedEventArgs"/> instance containing the event data.</param> private void MasterNameLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { ///Changes to open the form Name\Address Management Form for the CO:10531 ////Master Name Address Form - FormID - 91000 FormInfo formInfo = TerraScanCommon.GetFormInfo(91000); formInfo.optionalParameters = new object[] { null }; this.ShowForm(this, new DataEventArgs <FormInfo>(formInfo)); this.Close(); //Form form9100 = new Form(); //form9100 = this.form9101Control.WorkItem.Services.Get<TerraScan.Infrastructure.Interface.Services.IFormEngineService>().GetForm(91000, null, this.F9101Controll.WorkItem); //if (form9100 != null) //{ // form9100.ShowDialog(); //} } catch (Exception) { ErrorEngine.ShowForm((int)TerraScanCommon.ErrorEngineType.Six); } finally { this.MasterNameDataGridView.Focus(); } }
/// <summary> /// Gets the smart part. /// </summary> /// <param name="formId">The form id.</param> /// <param name="optionalParameter">The optional parameter.</param> /// <param name="parentWorkItem">The parent work item.</param> /// <returns>The generated smartpart.</returns> public UserControl GetSmartPart(int formId, object[] optionalParameter, WorkItem parentWorkItem) { string currentWorkItemName = string.Empty; UserControl currentSmartPart = new UserControl(); WorkItem currentWorkItem = new WorkItem(); //// get the form information like formFile,permissions etc.. FormInfo formInfo = TerraScanCommon.GetFormInfo(formId); if (!string.IsNullOrEmpty(formInfo.formFile)) { currentWorkItemName = formInfo.formFile.Trim() + "WorkItem"; //// check for the parent workitem contains the current workitem if (!parentWorkItem.Items.Contains(currentWorkItemName)) { ////create the instance of current smartpart. currentSmartPart = CreateSmartPartInstance(formInfo.formFile, optionalParameter, currentWorkItemName, parentWorkItem); } else { currentWorkItem = (WorkItem)parentWorkItem.Items.Get(currentWorkItemName); currentSmartPart = (UserControl)currentWorkItem.Items.Get(formInfo.formFile); currentWorkItem.Terminate(); currentSmartPart.Dispose(); currentSmartPart = CreateSmartPartInstance(formInfo.formFile, optionalParameter, currentWorkItemName, parentWorkItem); } return(currentSmartPart); } else { ErrorEngine.ShowForm((int)TerraScanCommon.ErrorEngineType.Six); return(null); } }
/// <summary> /// Gets the form. /// </summary> /// <param name="formId">The form id.</param> /// <param name="optionalParameter">The optional parameter.</param> /// <param name="parentWorkItem">The parent work item.</param> /// <returns>The generated form</returns> public Form GetForm(int formId, object[] optionalParameter, WorkItem parentWorkItem) { string currentWorkItemName = string.Empty; FormInfo formInfo; Form currentForm = new Form(); WorkItem currentWorkItem = new WorkItem(); //// get the form information like formFile,permissions etc.. formInfo = TerraScanCommon.GetFormInfo(formId); if (!string.IsNullOrEmpty(formInfo.formFile)) { try { currentWorkItemName = formInfo.formFile.Trim() + "WorkItem"; //// check for the parent workitem contains the current workitem if (!parentWorkItem.Items.Contains(currentWorkItemName)) { ////create the instance of current form. currentForm = this.CreateFormInstance(formInfo.formFile, optionalParameter, currentWorkItemName, parentWorkItem); } else { currentWorkItem = (WorkItem)parentWorkItem.Items.Get(currentWorkItemName); currentForm = (Form)currentWorkItem.Items.Get(formInfo.formFile); currentWorkItem.Terminate(); currentForm.Dispose(); currentForm = this.CreateFormInstance(formInfo.formFile, optionalParameter, currentWorkItemName, parentWorkItem); } return(currentForm); } catch (Exception ex) { if (!ex.Message.Equals("Cannot access a disposed object.\r\nObject name: 'Infragistics.Win.UltraWinGrid.UltraGridColumn'.")) { ErrorEngine.ShowForm((int)TerraScanCommon.ErrorEngineType.Six, formId); } return(null); } } else { ErrorEngine.ShowForm((int)TerraScanCommon.ErrorEngineType.Six, formId); return(null); } }
/// <summary> /// Handles the MADImportTemplateFormLinkLabel_LinkClicked Event for the Form /// </summary> /// <param name="sender">sender</param> /// <param name="e">event args</param> private void MADImportTemplateFormLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { FormInfo formInfo = TerraScanCommon.GetFormInfo(23300); formInfo.optionalParameters = new object[] { null }; this.ShowForm(this, new DataEventArgs <FormInfo>(formInfo)); this.Close(); } catch (Exception) { ErrorEngine.ShowForm((int)TerraScanCommon.ErrorEngineType.Six); } finally { this.MADImportTemplateSelectionGridView.Focus(); } }
/// <summary> /// Handles the Click event of the NewDatasetButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void NewDatasetButton_Click(object sender, EventArgs e) { try { if (this.TemplateNameCombo.SelectedIndex > 0) { RegistryKey regClasses = Registry.ClassesRoot; //// Check whether Microsoft Excel is installed on this computer, //// by searching the HKEY_CLASSES_ROOT\Excel.Application key. RegistryKey regExcel = regClasses.OpenSubKey("Excel.Application"); if (regExcel != null) { this.myapplication = new Excel.Application(); //// Checking for the Excel version this.excelversion = this.myapplication.Version; decimal installedExcelVersion = 0; if (!string.IsNullOrEmpty(this.excelversion)) { decimal.TryParse(this.excelversion, out installedExcelVersion); } //if (this.excelversion.Trim().Equals("12.0")) //{ if (installedExcelVersion >= 12) { //// Getting the folder path and the template file CommentsData excelDataSet = new CommentsData(); excelDataSet = this.form9042Control.WorkItem.GetConfigDetails("TS_ATemplateRoot"); if (excelDataSet.Tables.Count > 0 && excelDataSet.Tables[excelDataSet.GetCommentsConfigDetails.TableName].Rows.Count > 0) { this.templatePath = excelDataSet.GetCommentsConfigDetails.Rows[0][excelDataSet.GetCommentsConfigDetails.ConfigurationValueColumn].ToString() + "\\" + this.templateFile + ".xltm"; if (!string.IsNullOrEmpty(this.templatePath) && System.IO.File.Exists(this.templatePath)) { this.myapplication.Visible = true; //// Opening a workbook with template assigned from a specific location this.wb = (Excel.Workbook)(this.myapplication.Workbooks.Add(this.templatePath)); //// Getting the value from the DB for Connection String excelDataSet = this.form9042Control.WorkItem.GetConfigDetails("TS_AConnStr"); if (excelDataSet.Tables.Count > 0 && excelDataSet.Tables[excelDataSet.GetCommentsConfigDetails.TableName].Rows.Count > 0) { this.connectionString = excelDataSet.GetCommentsConfigDetails.Rows[0][excelDataSet.GetCommentsConfigDetails.ConfigurationValueColumn].ToString(); } this.templateName = this.TemplateNameCombo.Text.ToString(); this.templateDefinition = this.DefinitionTextBox.Text; this.templatePurpose = this.PurposeTextBox.Text; this.username = TerraScanCommon.UserName; this.title = this.TitleTextBox.Text; this.description = this.DescriptionTextBox.Text; //// Back Ground thread invoke process backGroundWork = new BackgroundWorker(); backGroundWork.DoWork += new DoWorkEventHandler(this.BackGroundWorkDoWork); backGroundWork.ProgressChanged += new ProgressChangedEventHandler(this.BackGroundWorkProgressChanged); backGroundWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.BackGroundWorkRunWorkerCompleted); backGroundWork.RunWorkerAsync(); this.job = new ThreadStart(this.ThreadJob); this.thread = new Thread(this.job); this.thread.IsBackground = false; this.thread.Start(); this.Close(); } else { ////Template file not found ErrorEngine.ShowForm(13, this.templatePath); } } else { ////Path not found ErrorEngine.ShowForm(14); //// if TS_ATemplateRoot doesnot exit } } else { ////Excel version not found ErrorEngine.ShowForm(12); } //else //{ // ////Excel version not found // ErrorEngine.ShowForm(12); //} } else { MessageBox.Show(SharedFunctions.GetResourceString("ExcelNotFound"), ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show(SharedFunctions.GetResourceString("SelectTemplateName"), ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } }