protected ModuleTemHistoryFacade(ModuleTemHistoryModel model) : base(model) { }
private void btnSave_Click(object sender, EventArgs e) { ProcessTransaction pt = new ProcessTransaction(); pt.OpenConnection(); pt.BeginTransaction(); try { if (checkValid()) { ModuleTemModel dModel; if (_isAdd) { dModel = new ModuleTemModel(); } else { int ID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); dModel = (ModuleTemModel)ModuleTemBO.Instance.FindByPK(ID); } dModel.Code = txtCode.Text.ToUpper().Trim(); dModel.LastDateChange = TextUtils.ToDate(deUpdatedDate.EditValue.ToString()); dModel.LastTimeChange = TextUtils.ToInt(txtTime.Text.Trim()); dModel.ModuleID = ModuleID; if (_isAdd) { pt.Insert(dModel); } else { pt.Update(dModel); if (txtReason.Enabled) { ModuleTemHistoryModel hModel = new ModuleTemHistoryModel(); hModel.ModuleTemID = dModel.ID; hModel.LastTimeChange = dModel.LastTimeChange; hModel.LastDateChange = dModel.LastDateChange; hModel.Reason = txtReason.Text.Trim(); hModel.UpdatedDate = TextUtils.GetSystemDate(); hModel.UpdatedBy = Global.AppUserName; hModel.Code = dModel.Code; pt.Insert(hModel); } } pt.CommitTransaction(); LoadData(); setInterface(false); clearInterface(); } } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { pt.CloseConnection(); } }