private void cboGroup_EditValueChanged(object sender, EventArgs e) { int groupID = TextUtils.ToInt(cboGroup.EditValue); if (groupID == 0) { return; } if (CoCau.ID > 0) { if (groupID != CoCau.CoCauGroupID) { CoCauGroupModel model = (CoCauGroupModel)CoCauGroupBO.Instance.FindByPK(groupID); txtDescription.Text = model.Description; } else { txtDescription.Text = CoCau.Description; } } else { CoCauGroupModel model = (CoCauGroupModel)CoCauGroupBO.Instance.FindByPK(groupID); txtDescription.Text = model.Description; } }
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 CoCauGroupModel(); } 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.CreatedDate = TextUtils.GetSystemDate(); Model.CreatedBy = Global.AppUserName; Model.UpdatedDate = Model.CreatedDate; Model.UpdatedBy = Global.AppUserName; Model.ID = (int)pt.Insert(Model); } else { Model.UpdatedDate = TextUtils.GetSystemDate(); Model.UpdatedBy = Global.AppUserName; 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; } CoCauGroupModel model = (CoCauGroupModel)CoCauGroupBO.Instance.FindByPK(id); frmCoCauGroup frm = new frmCoCauGroup(); frm.Model = model; if (frm.ShowDialog() == DialogResult.OK) { _curentNode = frm.CurentNode; loadTree(); } } catch (Exception) { } }
protected CoCauGroupFacade(CoCauGroupModel model) : base(model) { }