private void btnSave_Click(object sender, EventArgs e) { ProcessTransaction pt = new ProcessTransaction(); pt.OpenConnection(); pt.BeginTransaction(); try { if (!ValidateForm()) { return; } if (Model.ID == 0) { Model = new T_DM_KMP_GROUPModel(); } Model.C_Name = txtName.Text.Trim().ToUpper(); Model.C_Code = txtCode.Text.Trim().ToUpper(); Model.C_MOTA = 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(); 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; } _curentNode = treeData.GetNodeIndex(treeData.FocusedNode); T_DM_KMP_GROUPModel model = (T_DM_KMP_GROUPModel)T_DM_KMP_GROUPBO.Instance.FindByPK(id); frmKMP_GROUP frm = new frmKMP_GROUP(); frm.Model = model; if (frm.ShowDialog() == DialogResult.OK) { loadTree(); } } catch (Exception) { } }
protected T_DM_KMP_GROUPFacade(T_DM_KMP_GROUPModel model) : base(model) { }