/// <summary> /// 保存 /// </summary> private void saveInfo() { Register register = getPrintInfo(); try { if (this.isUpdate) { RegisterDao.Update(register); } else { object id = RegisterDao.Add(register); MessageBox.Show("当前流水号为 " + id); } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } }
/// <summary> /// 保存按钮点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void saveBtn_Click(object sender, EventArgs e) { this.ValidateChildren(ValidationConstraints.Enabled & ValidationConstraints.TabStop & ValidationConstraints.Selectable); if (Utilities.IsNullOrEmpty(apply.Text) && apply.Enabled) { applyErrorProvider.SetError(apply, "不能为空!"); } else { applyErrorProvider.Clear(); } if (!VTMS.ControlLib.ValidatorManager.ValidateControls(this)) { MessageBox.Show("控件内容不合法"); return; } Register register = getRegisterInfo(); try { if (this.isUpdate) { RegisterDao.Update(register); } else { object id = RegisterDao.Add(register); MessageBox.Show("当前流水号为 " + id); } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } this.isUpdate = true; }