private void btnAdd_Click(object sender, EventArgs e) { BadReactionDetail openDialog = new BadReactionDetail(null); //Butcher_EnterregisterDetail openDialog = new Butcher_EnterregisterDetail(0, 0, ""); openDialog.ShowDialog(); if (openDialog.DialogResult == DialogResult.OK) { LoadBadActionList(); } }
private void ugBadAction_w_ClickCellButton(object sender, CellEventArgs e) { if (e.Cell.Text == "删除") { DialogResult dr = MessageBox.Show(this, "确定要删除此行?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); if (dr == DialogResult.Yes) { if (ugBadAction_w.ActiveRow.Cells["ID"].Text != "") { Maticsoft.BLL.BadReaction bll = new Maticsoft.BLL.BadReaction(); bll.Delete(int.Parse(ugBadAction_w.ActiveRow.Cells["ID"].Text)); } ugBadAction_w.ActiveRow.Delete(false);//删除所选行 } } if (e.Cell.Text == "编辑") { BadReaction bd = new BadReaction(); // bd.ID = int.Parse(ugBadReaction.ActiveRow.Cells["ID"].Text); bd.ReactionName = ugBadAction_w.ActiveRow.Cells["ReactionName"].Text; bd.OccurDate = DateTime.Parse(ugBadAction_w.ActiveRow.Cells["OccurDate"].Text); bd.Severity = ugBadAction_w.ActiveRow.Cells["Severity"].Text; bd.TreatMethod = ugBadAction_w.ActiveRow.Cells["TreatMethod"].Text; bd.TreatResult = ugBadAction_w.ActiveRow.Cells["TreatResult"].Text; BadReactionDetail openDialog = new BadReactionDetail(bd); //Butcher_EnterregisterDetail openDialog = new Butcher_EnterregisterDetail(0, 0, ""); openDialog.ShowDialog(); if (openDialog.DialogResult == DialogResult.OK) { if (openDialog.returnValue != null) { BadReaction returnAction = openDialog.returnValue; ugBadAction_w.ActiveRow.Cells["ReactionName"].Value = returnAction.ReactionName; ugBadAction_w.ActiveRow.Cells["OccurDate"].Value = returnAction.OccurDate.Value.ToString("yyyy-MM-dd"); ugBadAction_w.ActiveRow.Cells["Severity"].Value = returnAction.Severity; ugBadAction_w.ActiveRow.Cells["TreatMethod"].Value = returnAction.TreatMethod; ugBadAction_w.ActiveRow.Cells["TreatResult"].Value = returnAction.TreatResult; } } } }
private void button12_Click(object sender, EventArgs e) { BadReactionDetail openDialog = new BadReactionDetail(null); openDialog.ShowDialog(); if (openDialog.DialogResult == DialogResult.OK) { if (openDialog.returnValue != null) { BadReaction bd = openDialog.returnValue; ugBadAction_w.DisplayLayout.Rows.Band.AddNew(); ugBadAction_w.Rows[ugBadAction_w.Rows.Count - 1].Cells["PID"].Value = this.pid; ugBadAction_w.Rows[ugBadAction_w.Rows.Count - 1].Cells["Peroid"].Value = bd.Peroid; ugBadAction_w.Rows[ugBadAction_w.Rows.Count - 1].Cells["ReactionName"].Value = bd.ReactionName; ugBadAction_w.Rows[ugBadAction_w.Rows.Count - 1].Cells["OccurDate"].Value = bd.OccurDate.Value.ToString("yyyy-MM-dd"); ugBadAction_w.Rows[ugBadAction_w.Rows.Count - 1].Cells["Severity"].Value = bd.Severity; ugBadAction_w.Rows[ugBadAction_w.Rows.Count - 1].Cells["TreatMethod"].Value = bd.TreatMethod; ugBadAction_w.Rows[ugBadAction_w.Rows.Count - 1].Cells["TreatResult"].Value = bd.TreatResult; } } }