private void btnSave_Click(object sender, EventArgs e) { ProcessTransaction pt = new ProcessTransaction(); pt.OpenConnection(); pt.BeginTransaction(); try { if (!ValidateForm()) { return; } if (Model == null) { Model = new BaiThucHanhGroupModel(); } Model.Name = txtName.Text.Trim().ToUpper(); Model.Code = txtCode.Text.Trim().ToUpper(); Model.Description = txtDescription.Text.Trim(); Model.ParentID = TextUtils.ToInt(leParentCat.EditValue); if (Model.ID == 0) { Model.ID = (int)pt.Insert(Model); } else { pt.Update(Model); } pt.CommitTransaction(); CurentNode = Model.ID; this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { pt.CloseConnection(); } }
private void btnEditGroup_Click(object sender, EventArgs e) { try { int id = TextUtils.ToInt(treeData.FocusedNode.GetValue(colIDTree)); if (id == 0) { return; } BaiThucHanhGroupModel model = (BaiThucHanhGroupModel)BaiThucHanhGroupBO.Instance.FindByPK(id); frmBaiTHGroup frm = new frmBaiTHGroup(); frm.Model = model; if (frm.ShowDialog() == DialogResult.OK) { _curentNode = frm.CurentNode; loadTree(); } } catch (Exception) { } }
protected BaiThucHanhGroupFacade(BaiThucHanhGroupModel model) : base(model) { }