private void btnAdd_Click(object sender, EventArgs e) { if (addOrEditCalcItem == null) { addOrEditCalcItem = new AddOrEditCalcItem(); addOrEditCalcItem.StartPosition = FormStartPosition.CenterScreen; } else { addOrEditCalcItem.ClearCalcProjectParameter(); } addOrEditCalcItem.Text = "添加计算项目"; addOrEditCalcItem.AddOrEditCalcItem_Load(null, null); addOrEditCalcItem.ShowDialog(); }
private void btnEdit_Click(object sender, EventArgs e) { if (this.gridView1.SelectedRowsCount > 0) { if (addOrEditCalcItem == null) { addOrEditCalcItem = new AddOrEditCalcItem(); addOrEditCalcItem.StartPosition = FormStartPosition.CenterScreen; } else { addOrEditCalcItem.ClearCalcProjectParameter(); } CalcProjectInfo calcProInfo = new CalcProjectInfo(); calcProInfo.CalcProjectName = this.gridView1.GetRowCellValue(this.gridView1.GetSelectedRows()[0], "项目名称").ToString(); calcProInfo.CalcProjectFullName = this.gridView1.GetRowCellValue(this.gridView1.GetSelectedRows()[0], "报告名称").ToString(); calcProInfo.Unit = this.gridView1.GetRowCellValue(this.gridView1.GetSelectedRows()[0], "单位").ToString(); calcProInfo.SampleType = this.gridView1.GetRowCellValue(this.gridView1.GetSelectedRows()[0], "样本类型").ToString(); calcProInfo.CalcFormula = this.gridView1.GetRowCellValue(this.gridView1.GetSelectedRows()[0], "计算公式").ToString(); string range = this.gridView1.GetRowCellValue(this.gridView1.GetSelectedRows()[0], "参考范围").ToString(); if (range != string.Empty) { calcProInfo.ReferenceRangeLow = (float)System.Convert.ToDouble(range.Substring(0, range.IndexOf("-") - 1)); calcProInfo.ReferenceRangeHigh = (float)System.Convert.ToDouble(range.Substring(range.IndexOf("-") + 2)); } addOrEditCalcItem.Text = "编辑计算项目"; addOrEditCalcItem.AddOrEditCalcItem_Load(null, null); addOrEditCalcItem.CalcProInfoForEdit = calcProInfo; addOrEditCalcItem.ShowDialog(); } else { MessageBox.Show("请选择需编辑的项目!"); return; } }