/// <summary> /// 新增 /// </summary> /// <param name="isClear"></param> protected override void SetInsertInit(bool isClear) { base.SetInsertInit(isClear); try { frmEditP_Produce_Guanwei frm = new frmEditP_Produce_Guanwei(); 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_Guanwei frm = new frmEditP_Produce_Guanwei(); 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()); } }