//点击确定 private void btnOk_Click(object sender, EventArgs e) { if (name.Text == "") { name.Focus(); GeneralClass.printErrorMsg("请输入项目名称"); return; } m_WaiterItem.name = name.Text; m_WaiterItem.note = note.Text; if (newWaiterItem) { if (db.WaiterItem.FirstOrDefault(x => x.name == name.Text) != null) { name.SelectAll(); name.Focus(); GeneralClass.printErrorMsg("已存在" + name.Text + "服务项目,不能重复添加"); return; } db.WaiterItem.InsertOnSubmit(m_WaiterItem); db.SubmitChanges(); m_rmForm.dgv_show(); m_WaiterItem = new WaiterItem(); name.Text = ""; note.Text = ""; name.Focus(); } else { db.SubmitChanges(); this.DialogResult = DialogResult.OK; } }
//构造函数 public WaitForm(BathDBDataContext dc, WaiterItem room, WaitManagementForm rm) { db = dc; m_rmForm = rm; if (room != null) { newWaiterItem = false; m_WaiterItem = room; } InitializeComponent(); }
partial void UpdateWaiterItem(WaiterItem instance);
partial void DeleteWaiterItem(WaiterItem instance);
partial void InsertWaiterItem(WaiterItem instance);