private void Properties() { FIA_Biosum_Manager.RxItem_Collection oRxColl = new RxItem_Collection(); frmMain.g_sbpInfo.Text = "Creating Rx Package Properties Report...Stand By"; for (int x = 0; x <= ReferenceRxItemCollection.Count - 1; x++) { if (ReferenceRxItemCollection.Item(x).Delete == false) { if (this.m_oRxPackageItem.SimulationYear1Rx.Trim() == ReferenceRxItemCollection.Item(x).RxId.Trim() || this.m_oRxPackageItem.SimulationYear2Rx.Trim() == ReferenceRxItemCollection.Item(x).RxId.Trim() || this.m_oRxPackageItem.SimulationYear3Rx.Trim() == ReferenceRxItemCollection.Item(x).RxId.Trim() || this.m_oRxPackageItem.SimulationYear4Rx.Trim() == ReferenceRxItemCollection.Item(x).RxId.Trim()) { RxItem oItem = new RxItem(); oItem.CopyProperties(ReferenceRxItemCollection.Item(x), oItem); if (oItem.m_oFvsCommandItem_Collection1 != null) { for (int y = 0; y <= oItem.m_oFvsCommandItem_Collection1.Count - 1; y++) { if (oItem.m_oFvsCommandItem_Collection1.Item(y).Delete == true) { oItem.m_oFvsCommandItem_Collection1.Remove(y); } } } oRxColl.Add(oItem); } } } FIA_Biosum_Manager.RxPackageItem_Collection oRxPackageCollection = new RxPackageItem_Collection(); oRxPackageCollection.Add(this.m_oRxPackageItem); FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog(); frmTemp.Text = "FIA Biosum"; frmTemp.AutoScroll = false; uc_textbox uc_textbox1 = new uc_textbox(); frmTemp.Controls.Add(uc_textbox1); uc_textbox1.Dock = DockStyle.Fill; uc_textbox1.lblTitle.Text = "Package Properties"; RxTools oRxTools = new RxTools(); uc_textbox1.TextValue = oRxTools.PackageProperties(oRxPackageCollection, oRxColl); frmTemp.Show(); frmMain.g_sbpInfo.Text = "Ready"; }
private void btnFVSCycleSelectRx_Click(object sender, System.EventArgs e) { if (ReferenceFormRxPackageItem.ReferenceRxItemCollection != null) { FIA_Biosum_Manager.frmDialog frmtemp = new frmDialog(); frmtemp.uc_previous_expressions1.LoadRxItemCollection(ReferenceFormRxPackageItem.ReferenceRxItemCollection); frmtemp.ShowDialog(); if (frmtemp.DialogResult == DialogResult.OK) { this.cmbRx.Text = frmtemp.uc_previous_expressions1.listView1.SelectedItems[0].SubItems[1].Text.Trim(); } } }
private void Properties() { if (this.m_oRxItem.RxId.Trim().Length == 0) { return; } frmMain.g_sbpInfo.Text = "Creating Rx Properties Report...Stand By"; FIA_Biosum_Manager.RxItem_Collection oRxCollection = new RxItem_Collection(); FIA_Biosum_Manager.RxItem oRxItem = new RxItem(); oRxItem.CopyProperties(m_oRxItem, oRxItem); if (oRxItem.m_oFvsCommandItem_Collection1 != null) { for (int y = 0; y <= oRxItem.m_oFvsCommandItem_Collection1.Count - 1; y++) { if (oRxItem.m_oFvsCommandItem_Collection1.Item(y).Delete == true) { oRxItem.m_oFvsCommandItem_Collection1.Remove(y); } } } oRxCollection.Add(oRxItem); FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog(); frmTemp.Text = "FIA Biosum"; frmTemp.AutoScroll = false; uc_textbox uc_textbox1 = new uc_textbox(); frmTemp.Controls.Add(uc_textbox1); uc_textbox1.Dock = DockStyle.Fill; uc_textbox1.lblTitle.Text = "Treatment Properties"; RxTools oRxTools = new RxTools(); uc_textbox1.TextValue = oRxTools.TreatmentProperties(oRxCollection); frmTemp.Show(); frmMain.g_sbpInfo.Text = "Ready"; }
private void btnAdd_Click(object sender, System.EventArgs e) { frmDialog frmTemp = new frmDialog(((frmDialog)this.ParentForm).m_frmMain); frmTemp.Visible = false; //FIA_Biosum_Manager.uc_plot_input uc_plot_input1 = new uc_plot_input(); //frmTemp.Controls.Add(uc_plot_input1); frmTemp.Initialize_Plot_Input_User_Control(); frmTemp.MaximizeBox = false; frmTemp.MinimizeBox = false; frmTemp.Width = frmTemp.uc_plot_input1.m_DialogWd; frmTemp.Height = frmTemp.uc_plot_input1.m_DialogHt; frmTemp.Text = "Database: Add Plot Data"; frmTemp.uc_plot_input1.Dock = System.Windows.Forms.DockStyle.Fill; frmTemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; frmTemp.uc_plot_input1.Visible = true; frmTemp.DisposeOfFormWhenClosing = true; frmTemp.MinimizeMainForm = true; frmTemp.ParentControl = frmMain.g_oFrmMain; frmTemp.ParentControl.Enabled = false; frmTemp.Show(); }
private void tlbPlotAddEdit_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { switch (e.Button.Text.Trim().ToUpper()) { case "ADD PLOT DATA": frmDialog frmTemp = new frmDialog(((frmDialog)this.ParentForm).m_frmMain); frmTemp.Visible = false; //FIA_Biosum_Manager.uc_plot_input uc_plot_input1 = new uc_plot_input(); //frmTemp.Controls.Add(uc_plot_input1); frmTemp.Initialize_Plot_Input_User_Control(); frmTemp.MaximizeBox = false; frmTemp.MinimizeBox = true; frmTemp.Width = frmTemp.uc_plot_input1.m_DialogWd; frmTemp.Height = frmTemp.uc_plot_input1.m_DialogHt; frmTemp.Text = "Database: Add Plot Data"; frmTemp.uc_plot_input1.Dock = System.Windows.Forms.DockStyle.Fill; frmTemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; frmTemp.uc_plot_input1.Visible = true; frmTemp.DisposeOfFormWhenClosing = true; frmTemp.uc_plot_input1.ReferenceFormDialog = frmTemp; frmTemp.MinimizeMainForm = true; frmTemp.ParentControl = frmMain.g_oFrmMain; frmTemp.ParentControl.Enabled = false; frmTemp.Show(); break; case "DELETE CONDITIONS": frmDialog frmTemp2 = new frmDialog(((frmDialog)this.ParentForm).m_frmMain); frmTemp2.Visible = false; frmTemp2.Initialize_Delete_Conditions_User_Control(); frmTemp2.MaximizeBox = false; frmTemp2.MinimizeBox = true; frmTemp2.Width = frmTemp2.uc_delete_conditions.m_DialogWd; frmTemp2.Height = frmTemp2.uc_delete_conditions.m_DialogHt; frmTemp2.Text = "Database: Delete Conditions"; frmTemp2.uc_delete_conditions.Dock = System.Windows.Forms.DockStyle.Fill; frmTemp2.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; frmTemp2.uc_delete_conditions.Visible = true; frmTemp2.DisposeOfFormWhenClosing = true; frmTemp2.uc_delete_conditions.ReferenceFormDialog = frmTemp2; frmTemp2.MinimizeMainForm = true; frmTemp2.ParentControl = frmMain.g_oFrmMain; frmTemp2.ParentControl.Enabled = false; frmTemp2.Show(); break; case "BROWSE AND DELETE SELECTED PLOT RECORDS": //instantiate the datasource class FIA_Biosum_Manager.Datasource p_datasource = new Datasource(((frmDialog)this.ParentForm).m_frmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim()); int intPlot = p_datasource.getTableNameRow("PLOT"); //see if datasource found the PLOT table type if (intPlot >= 0) { //see if the MDB file is found and the plot table is found if (p_datasource.m_strDataSource[intPlot, FILESTATUS].Trim() == "F" && p_datasource.m_strDataSource[intPlot, TABLESTATUS].Trim() == "F") { //see if there are records in the plot table if (p_datasource.m_strDataSource[intPlot, RECORDCOUNT].Trim() != "0") { string strConn = ""; string strFile = p_datasource.m_strDataSource[intPlot, MDBFILE].Trim(); if (strFile.Substring(strFile.Trim().Length - 6, 6).ToUpper() == ".ACCDB") { strConn = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" + strFile + ";User Id=admin;Password=;"; } else { strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFile + ";User Id=admin;Password=;"; } //string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + // p_datasource.m_strDataSource[intPlot,MDBFILE].Trim() + // ";User Id=admin;Password=;"; FIA_Biosum_Manager.frmGridView frmGV = new frmGridView(); frmGV.Text = "Database: Browse And Delete Plot Records"; frmGV.LoadDataSetToDeleteOnly(strConn, "select * from " + p_datasource.m_strDataSource[intPlot, TABLE].Trim() + ";", p_datasource.m_strDataSource[intPlot, TABLE].Trim()); frmGV.Show(); frmGV.Focus(); } else { MessageBox.Show("!!No Records In The PLOT table!!", "BROWSE AND DELETE PLOT RECORDS", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } } else { MessageBox.Show("!!Could not find either the MDB File named \n" + p_datasource.m_strDataSource[intPlot, MDBFILE] + "\n" + " or the plot table named \n" + p_datasource.m_strDataSource[intPlot, TABLE].Trim() + "!!", "BROWSE AND DELETE PLOT RECORDS", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } } else { MessageBox.Show("!!Could not find the table type PLOT in the datasource table!!", "BROWSE AND DELETE PLOT RECORDS", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } break; case "EDIT PLOT DATA": break; case "DELETE ALL PLOT RECORDS": this.DeleteAllPlotRecords(); break; case "HELP": if (m_oHelp == null) { m_oHelp = new Help(m_xpsFile, m_oEnv); } m_oHelp.ShowHelp(new string[] { "DATABASE", "PLOT_DATA_MENU" }); break; } }
private void btnEdit_Click(object sender, System.EventArgs e) { string strMax = ""; string strMin = ""; string strId = ""; if (this.lstTreeDiam.SelectedItems.Count == 0) { return; } strId = this.lstTreeDiam.SelectedItems[0].Text; strMin = this.lstTreeDiam.SelectedItems[0].SubItems[1].Text; strMax = this.lstTreeDiam.SelectedItems[0].SubItems[2].Text; if (strMin.IndexOf(".") < 0) { strMin += ".0"; } if (strMax.IndexOf(".") < 0) { strMax += ".0"; } FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog(); frmTemp.MaximizeBox = false; frmTemp.BackColor = System.Drawing.SystemColors.Control; frmTemp.Text = "Database: Tree Diameter Groups (Edit)"; frmTemp.Initialize_Plot_Tree_Diam_Edit_User_Control(); frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtGroupId = strId; frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMaximumDiameter = strMax; frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMinimumDiameter = strMin; frmTemp.Height = 0; frmTemp.Width = 0; if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Top + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Height > frmTemp.ClientSize.Height + 2) { for (int x = 1;; x++) { frmTemp.Height = x; if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Top + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Height < frmTemp.ClientSize.Height) { break; } } } if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Left + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Width > frmTemp.ClientSize.Width + 2) { for (int x = 1;; x++) { frmTemp.Width = x; if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Left + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Width < frmTemp.ClientSize.Width) { break; } } } frmTemp.Left = 0; frmTemp.Top = 0; frmTemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; frmTemp.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; System.Windows.Forms.DialogResult result = frmTemp.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { strMax = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMaximumDiameter.Trim(); //remove the period if it is the last character if (strMax.IndexOf(".") == strMax.Length - 1) { strMax = strMax.Replace(".", ""); } strMin = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMinimumDiameter.Trim(); //remove the period if it is the last character if (strMin.IndexOf(".") == strMin.Length - 1) { strMin = strMin.Replace(".", ""); } this.lstTreeDiam.BeginUpdate(); this.lstTreeDiam.SelectedItems[0].SubItems[1].Text = strMin; this.lstTreeDiam.SelectedItems[0].SubItems[2].Text = strMax; this.lstTreeDiam.SelectedItems[0].SubItems[3].Text = strMin + " - " + strMax; this.lstTreeDiam.EndUpdate(); if (this.btnSave.Enabled == false) { this.btnSave.Enabled = true; } } frmTemp.Close(); frmTemp.Dispose(); frmTemp = null; }
private void btnNew_Click(object sender, System.EventArgs e) { string strMax = ""; string strMin = ""; string strId = ""; double dblMin = 0; //get the last id if there is one if (this.lstTreeDiam.Items.Count > 0) { strId = Convert.ToString(Convert.ToInt16(this.lstTreeDiam.Items[this.lstTreeDiam.Items.Count - 1].Text) + 1); strMin = this.lstTreeDiam.Items[this.lstTreeDiam.Items.Count - 1].SubItems[2].Text; if (strMin.IndexOf(".") < 0) { strMin += ".0"; } dblMin = Convert.ToDouble(strMin) + 0.1; strMin = Convert.ToString(dblMin); strMax = strMin; //if (strMin.IndexOf(".") < 0) strMin += ".0"; } else { strMax = "0.0"; strMin = "0.0"; strId = "1"; } FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog(); frmTemp.MaximizeBox = false; frmTemp.BackColor = System.Drawing.SystemColors.Control; frmTemp.Text = "Database: Tree Diameter Groups (New)"; frmTemp.Initialize_Plot_Tree_Diam_Edit_User_Control(); frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtGroupId = strId; frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMaximumDiameter = strMax; frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMinimumDiameter = strMin; //frmTemp.MdiParent = this; //frmTemp.Initialize_Plot_Tree_Diam_User_Control(); frmTemp.Height = 0; frmTemp.Width = 0; if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Top + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Height > frmTemp.ClientSize.Height + 2) { for (int x = 1;; x++) { frmTemp.Height = x; if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Top + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Height < frmTemp.ClientSize.Height) { break; } } } if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Left + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Width > frmTemp.ClientSize.Width + 2) { for (int x = 1;; x++) { frmTemp.Width = x; if (frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Left + frmTemp.uc_processor_scenario_tree_diam_groups_edit1.Width < frmTemp.ClientSize.Width) { break; } } } frmTemp.Left = 0; frmTemp.Top = 0; frmTemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; frmTemp.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; System.Windows.Forms.DialogResult result = frmTemp.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { strMax = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMaximumDiameter.Trim(); //remove the period if it is the last character if (strMax.IndexOf(".") == strMax.Length - 1) { strMax = strMax.Replace(".", ""); } strMin = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtMinimumDiameter.Trim(); //remove the period if it is the last character if (strMin.IndexOf(".") == strMin.Length - 1) { strMin = strMin.Replace(".", ""); } this.lstTreeDiam.BeginUpdate(); System.Windows.Forms.ListViewItem listItem = new ListViewItem(); listItem.Text = frmTemp.uc_processor_scenario_tree_diam_groups_edit1.txtGroupId; listItem.SubItems.Add(strMin); listItem.SubItems.Add(strMax); listItem.SubItems.Add(strMin + " - " + strMax); this.lstTreeDiam.Items.Add(listItem); this.lstTreeDiam.EndUpdate(); if (this.btnSave.Enabled == false) { this.btnSave.Enabled = true; } } frmTemp.Close(); frmTemp.Dispose(); frmTemp = null; }
private void btnColumnNameEdit_Click(object sender, EventArgs e) { int y; FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog(); frmTemp.MaximizeBox = false; frmTemp.MinimizeBox = false; frmTemp.BackColor = System.Drawing.SystemColors.Control; frmTemp.Initialize_Scenario_Harvest_Costs_Column_Edit_Control(); frmTemp.Height = 0; frmTemp.Width = 0; if (frmTemp.Top + frmTemp.uc_scenario_harvest_cost_column_edit1.Height > frmTemp.ClientSize.Height + 2) { for (y = 1; ; y++) { frmTemp.Height = y; if (frmTemp.uc_scenario_harvest_cost_column_edit1.Top + frmTemp.uc_scenario_harvest_cost_column_edit1.Height < frmTemp.ClientSize.Height) { break; } } } if (frmTemp.uc_scenario_harvest_cost_column_edit1.Left + frmTemp.uc_scenario_harvest_cost_column_edit1.Width > frmTemp.ClientSize.Width + 2) { for (y = 1; ; y++) { frmTemp.Width = y; if (frmTemp.uc_scenario_harvest_cost_column_edit1.Left + frmTemp.uc_scenario_harvest_cost_column_edit1.Width < frmTemp.ClientSize.Width) { break; } } } frmTemp.Left = 0; frmTemp.Top = 0; frmTemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; frmTemp.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; frmTemp.uc_scenario_harvest_cost_column_edit1.Dock = System.Windows.Forms.DockStyle.Fill; frmTemp.uc_scenario_harvest_cost_column_edit1.EditType = "Edit"; frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnText = this.txtColumnName.Text.Trim(); frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnDescription = this.txtDesc.Text.Trim(); frmTemp.uc_scenario_harvest_cost_column_edit1.cmbCol.Enabled = false; frmTemp.uc_scenario_harvest_cost_column_edit1.lblEdit.Hide(); frmTemp.Text = "Edit Harvest Cost Column"; System.Windows.Forms.DialogResult result = frmTemp.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { if (txtDesc.Text.Trim().ToUpper() != frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnDescription.Trim().ToUpper()) { ReferenceProcessorScenarioForm.m_bSave = true; } this.txtDesc.Text = frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnDescription; } frmTemp.Dispose(); }
private void btnAnalyze_Click(object sender, EventArgs e) { List <string> oProjectRootFolders = new List <string>(); for (int x = 0; x <= lvDatasources.Items.Count - 1; x++) { string strSyncd = lvDatasources.Items[x].SubItems[COLUMN_SYNCD].Text.Trim(); if (strSyncd == "No") { int intIndex = -1; string strProjectRootFolder = ""; string strDatasource = lvDatasources.Items[x].SubItems[COLUMN_DATASOURCE].Text.Trim(); string strPath = lvDatasources.Items[x].SubItems[COLUMN_PATH].Text.Trim().ToUpper(); if (strDatasource == "Project") { intIndex = strPath.IndexOf(@"\DB", 0); if (intIndex > 0) { strProjectRootFolder = strPath.Substring(0, intIndex + 1); } } else if (strDatasource == "TreatmentOptimizer") { // THIS CONDITION WILL BE MET BY THE 'NA' ROWS THAT ARE LISTED FOR EACH SCENARIO GENERATED FROM THE CORE scenario_core_rule_definitions.mdb\scenario table intIndex = strPath.IndexOf(@"\OPTIMIZER\", 0); if (intIndex > 0) { strProjectRootFolder = strPath.Substring(0, intIndex + 1); } } else if (strDatasource == "Processor") { // THIS CONDITION WILL BE MET BY THE 'NA' ROWS THAT ARE LISTED FOR EACH SCENARIO GENERATED FROM THE PROCESSOR scenario_core_rule_definitions.mdb\scenario table intIndex = strPath.IndexOf(@"\PROCESSOR\", 0); if (intIndex > 0) { strProjectRootFolder = strPath.Substring(0, intIndex + 1); } } if (strProjectRootFolder.Trim().Length > 0) { if ((int)oProjectRootFolders.Where(p => p == strProjectRootFolder).Count() == 0) { oProjectRootFolders.Add(strProjectRootFolder); } } } } if (oProjectRootFolders != null && oProjectRootFolders[0] != null) { FIA_Biosum_Manager.frmDialog oDlg = new frmDialog(); oDlg.Text = "FIA Biosum: Scan and Analyze"; oDlg.uc_select_list_item1.lblTitle.Text = "Suggested Out-of-Sync Project Root Folder(s)"; oDlg.uc_select_list_item1.listBox1.Sorted = false; oDlg.uc_select_list_item1.lblMsg.Hide(); oDlg.uc_select_list_item1.loadvalues(oProjectRootFolders); oDlg.uc_select_list_item1.Show(); DialogResult result = oDlg.ShowDialog(); if (result == DialogResult.OK) { if (oDlg.uc_select_list_item1.listBox1.SelectedItems.Count > 0) { this.txtReplace.Text = oDlg.uc_select_list_item1.listBox1.SelectedItems[0].ToString().Trim(); } } oDlg.Dispose(); oDlg = null; } }
private void Edit(string strType) { int y, intIndex, intCount; FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog(); frmTemp.MaximizeBox = false; frmTemp.BackColor = System.Drawing.SystemColors.Control; frmTemp.Initialize_Scenario_Harvest_Costs_Column_Edit_Control(); string strColumnList = ""; if (this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection != null) { for (y = 0; y <= this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Count - 1; y++) { if (this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).Delete == false) { if (this.ReferenceFormRxItem.m_oRxItem.RxId == this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).RxId) { strColumnList = strColumnList + ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).HarvestCostColumn + ","; } } } if (strColumnList.Trim().Length > 0) { strColumnList = strColumnList.Substring(0, strColumnList.Length - 1); } } frmTemp.Height = 0; frmTemp.Width = 0; if (frmTemp.Top + frmTemp.uc_scenario_harvest_cost_column_edit1.Height > frmTemp.ClientSize.Height + 2) { for (y = 1;; y++) { frmTemp.Height = y; if (frmTemp.uc_scenario_harvest_cost_column_edit1.Top + frmTemp.uc_scenario_harvest_cost_column_edit1.Height < frmTemp.ClientSize.Height) { break; } } } if (frmTemp.uc_scenario_harvest_cost_column_edit1.Left + frmTemp.uc_scenario_harvest_cost_column_edit1.Width > frmTemp.ClientSize.Width + 2) { for (y = 1;; y++) { frmTemp.Width = y; if (frmTemp.uc_scenario_harvest_cost_column_edit1.Left + frmTemp.uc_scenario_harvest_cost_column_edit1.Width < frmTemp.ClientSize.Width) { break; } } } frmTemp.Left = 0; frmTemp.Top = 0; frmTemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; frmTemp.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; frmTemp.uc_scenario_harvest_cost_column_edit1.Dock = System.Windows.Forms.DockStyle.Fill; frmTemp.uc_scenario_harvest_cost_column_edit1.EditType = strType; if (strType.Trim().ToUpper() == "NEW") { frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnList = strColumnList; strColumnList = ""; for (y = 0; y <= this.lvRxHarvestCostColumns.Items.Count - 1; y++) { strColumnList = strColumnList + this.lvRxHarvestCostColumns.Items[y].SubItems[COLUMN_FIELD].Text.Trim() + ","; } if (strColumnList.Trim().Length > 0) { strColumnList = strColumnList.Substring(0, strColumnList.Length - 1); } frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnText = ""; frmTemp.uc_scenario_harvest_cost_column_edit1.CurrentSelectedColumnList = strColumnList; frmTemp.uc_scenario_harvest_cost_column_edit1.HarvestCostTableColumnList = this.m_strHarvestTableColumnNameList; frmTemp.uc_scenario_harvest_cost_column_edit1.loadvalues(); frmTemp.uc_scenario_harvest_cost_column_edit1.lblEdit.Show(); } else { frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnText = this.lvRxHarvestCostColumns.SelectedItems[0].SubItems[COLUMN_FIELD].Text; frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnDescription = this.lvRxHarvestCostColumns.SelectedItems[0].SubItems[COLUMN_DESC].Text; frmTemp.uc_scenario_harvest_cost_column_edit1.cmbCol.Enabled = false; frmTemp.uc_scenario_harvest_cost_column_edit1.lblEdit.Hide(); } frmTemp.Text = strType + " Harvest Cost Component"; System.Windows.Forms.DialogResult result = frmTemp.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { if (strType.Trim().ToUpper() == "NEW") { if (ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection == null) { this.ReferenceFormRxItem.m_oRxItem.m_oHarvestCostColumnItem_Collection1 = new RxItemHarvestCostColumnItem_Collection(); this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection = this.ReferenceFormRxItem.m_oRxItem.m_oHarvestCostColumnItem_Collection1; } //make sure this item was not previously deleted for (y = 0; y <= this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Count - 1; y++) { if (this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).Delete == true) { if (this.ReferenceFormRxItem.m_oRxItem.RxId == this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).RxId&& this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).HarvestCostColumn.Trim().ToUpper() == frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnText.Trim().ToUpper()) { ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).Delete = false; ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).Description = frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnDescription; break; } } } //new column if (y > this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Count - 1) { FIA_Biosum_Manager.RxItemHarvestCostColumnItem oItem = new RxItemHarvestCostColumnItem(); oItem.Description = frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnDescription.Trim(); oItem.HarvestCostColumn = frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnText.Trim(); oItem.RxId = this.ReferenceFormRxItem.m_oRxItem.RxId; oItem.Add = true; ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Add(oItem); this.AddItemToList(oItem); } } else { this.lvRxHarvestCostColumns.SelectedItems[0].SubItems[COLUMN_DESC].Text = frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnDescription; for (y = 0; y <= this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Count - 1; y++) { if (this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).Delete == false) { if (this.ReferenceFormRxItem.m_oRxItem.RxId == this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).RxId&& this.ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).HarvestCostColumn.Trim().ToUpper() == lvRxHarvestCostColumns.SelectedItems[0].SubItems[COLUMN_FIELD].Text.Trim().ToUpper()) { ReferenceFormRxItem.m_oRxItem.ReferenceHarvestCostColumnCollection.Item(y).Description = frmTemp.uc_scenario_harvest_cost_column_edit1.ColumnDescription; break; } } } } } frmTemp.Dispose(); }
private void ReadOnlyListStruc() { string strLargestString = ""; string str = ""; int x = 0; FIA_Biosum_Manager.frmDialog frmTemp = new frmDialog(); frmTemp.uc_select_list_item1.listBox1.Font = new System.Drawing.Font("Courier New", 8); frmTemp.Text = "Table Structure"; frmTemp.uc_select_list_item1.lblMsg.Text = "Table structure of " + this.m_table.TableName; frmTemp.uc_select_list_item1.lblMsg.Visible = true; frmTemp.uc_select_list_item1.Dock = System.Windows.Forms.DockStyle.Fill; frmTemp.uc_project1.Visible = false; frmTemp.uc_select_list_item1.listBox1.Items.Clear(); //list the header information utils p_utils = new utils(); //print header information //dataset name p_utils.LoadStringToCharArray("Structure For DataSet:", ref this.m_printheader.chrLabel, true, 0); p_utils.LoadStringToCharArray(" ", ref this.m_printheader.chrFiller, true, 0); p_utils.LoadStringToCharArray(this.m_table.TableName, ref this.m_printheader.chrDesc, true, 0); p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrLabel, false); p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrFiller, false); p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrDesc, false); frmTemp.uc_select_list_item1.listBox1.Items.Add(str); strLargestString = str.Trim(); //number of records str = ""; p_utils.LoadStringToCharArray("Number Of Records:", ref this.m_printheader.chrLabel, true, 0); p_utils.LoadStringToCharArray(" ", ref this.m_printheader.chrFiller, true, 0); p_utils.LoadStringToCharArray(this.m_table.Rows.Count.ToString(), ref this.m_printheader.chrDesc, true, 0); p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrLabel, true); p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrFiller, false); p_utils.LoadCharArrayToString(ref str, this.m_printheader.chrDesc, false); frmTemp.uc_select_list_item1.listBox1.Items.Add(str); if (str.Trim().Length > strLargestString.Trim().Length) { strLargestString = str.Trim(); } //field information column headers p_utils.LoadStringToCharArray("Field", ref this.m_printfield.chrFieldNumber, true, 0); p_utils.LoadStringToCharArray(" ", ref this.m_printfield.chrFiller, true, 0); p_utils.LoadStringToCharArray("Field Name", ref this.m_printfield.chrFieldName, true, 0); p_utils.LoadStringToCharArray(" ", ref this.m_printfield.chrFiller2, true, 0); p_utils.LoadStringToCharArray("Type", ref this.m_printfield.chrFieldType, true, 0); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldNumber, true); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFiller, false); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldName, false); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFiller2, false); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldType, false); frmTemp.uc_select_list_item1.listBox1.Items.Add(str); if (str.Trim().Length > strLargestString.Trim().Length) { strLargestString = str; } //detail for (x = 0; x <= this.m_table.Columns.Count - 1; x++) { p_utils.LoadStringToCharArray(Convert.ToString(x + 1), ref this.m_printfield.chrFieldNumber, true, 0); p_utils.LoadStringToCharArray(" ", ref this.m_printfield.chrFiller, true, 0); p_utils.LoadStringToCharArray(this.m_table.Columns[x].ColumnName.ToString(), ref this.m_printfield.chrFieldName, true, 0); p_utils.LoadStringToCharArray(" ", ref this.m_printfield.chrFiller2, true, 0); p_utils.LoadStringToCharArray(this.m_table.Columns[x].DataType.ToString(), ref this.m_printfield.chrFieldType, true, 0); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldNumber, true); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFiller, false); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldName, false); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFiller2, false); p_utils.LoadCharArrayToString(ref str, this.m_printfield.chrFieldType, false); frmTemp.uc_select_list_item1.listBox1.Items.Add(str); if (str.Trim().Length > strLargestString.Trim().Length) { strLargestString = str; } } frmTemp.uc_select_list_item1.Initialize_Width(strLargestString + "***********"); frmTemp.uc_select_list_item1.Visible = true; frmTemp.uc_select_list_item1.btnOK.Text = "Print"; DialogResult result = frmTemp.ShowDialog(); if (result == DialogResult.OK) { printing p_oPrint = new printing(); p_oPrint.PrintListBoxContents("FIA Biosum Data Set Structure", frmTemp.uc_select_list_item1.listBox1); p_oPrint = null; } frmTemp.Close(); frmTemp = null; }