private void btnSave_Click(object sender, EventArgs e) { try { if (checkValid()) { C_ProductGroupModel dModel; if (_isAdd) { dModel = new C_ProductGroupModel(); } else { int ID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); dModel = (C_ProductGroupModel)C_ProductGroupBO.Instance.FindByPK(ID); } dModel.Code = txtCode.Text; dModel.Name = txtName.Text; dModel.VAT = TextUtils.ToDecimal(txtVat.EditValue); dModel.CustomerPercent = TextUtils.ToDecimal(txtCustomerPercent.EditValue); dModel.ProfitPercent = TextUtils.ToDecimal(txtPercentProfit.EditValue); dModel.IsAfterTax = chkIsAfterTax.Checked; if (_isAdd) { C_ProductGroupBO.Instance.Insert(dModel); } else { C_ProductGroupBO.Instance.Update(dModel); } LoadData(); SetInterface(false); ClearInterface(); } } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected C_ProductGroupFacade(C_ProductGroupModel model) : base(model) { }