/// <summary> /// 新增 /// </summary> /// <param name="isClear"></param> protected override void SetInsertInit(bool isClear) { base.SetInsertInit(isClear); try { frmEditP_Produce_Duty frm = new frmEditP_Produce_Duty(); frm.ScanMode = Common.DataModifyMode.add; if (frm.ShowDialog() == DialogResult.OK) { this.ScanMode = Common.DataModifyMode.dsp; txtpName.Text = ""; GetDspDataList(); } } catch (Exception ex) { log.Error(ex); XtraMsgBox.Show("新增数据失败!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, ex, this.GetType()); } }
/// <summary> /// 修改 /// </summary> public override void SetModifyInit() { base.SetModifyInit(); try { if (this.GetSelectList().Length <= 0) { XtraMsgBox.Show("未勾选任何数据!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (this.GetSelectList().Length > 1) { XtraMsgBox.Show("修改时,只能勾选一条数据!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } frmEditP_Produce_Duty frm = new frmEditP_Produce_Duty(); frm.ScanMode = Common.DataModifyMode.upd; //选择所有选择的数据 frm.dr = this.GetSelectList()[0]; if (frm.ShowDialog() == DialogResult.OK) { this.ScanMode = Common.DataModifyMode.dsp; GetDspDataList(); } } catch (Exception ex) { log.Error(ex); XtraMsgBox.Show("修改数据失败!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, ex, this.GetType()); } }