public void OnSave() { if (MessageBoxResult.Yes != LMessage.ShowMessage("M.KeToan.HoiTruocKhiLuuDoiTuongSoDu", LMessage.MessageBoxType.Question)) { return; } Cursor = Cursors.Wait; List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>(); ApplicationConstant.ResponseStatus iret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG; try { if (!Validation()) { return; } _obj = new DOI_TUONG_SDU_TKHOAN(); GetFormData(ref _obj); action = DatabaseConstant.Action.LUU; // Yêu cầu lock bản ghi cần sửa UtilitiesProcess process = new UtilitiesProcess(); List <int> listLockId = new List <int>(); listLockId.Add(ID_TKHOAN); bool ret = process.LockData(DatabaseConstant.Module.GDKT, DatabaseConstant.Function.DC_DM_DTUONG_SODU, DatabaseConstant.Table.KT_TKHOAN, DatabaseConstant.Action.LUU, listLockId); iret = new KeToanProcess().DoiTuongSoDuCT(DatabaseConstant.Function.DC_DM_DTUONG_SODU, action, ref _obj, ref listClientResponseDetail); AfterSave(iret, listClientResponseDetail); } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); // Yêu cầu lock bản ghi cần sửa UtilitiesProcess process = new UtilitiesProcess(); List <int> listLockId = new List <int>(); listLockId.Add(ID_TKHOAN); bool ret = process.UnlockData(DatabaseConstant.Module.GDKT, DatabaseConstant.Function.DC_DM_DTUONG_SODU, DatabaseConstant.Table.KT_TKHOAN, DatabaseConstant.Action.LUU, listLockId); } finally { Cursor = Cursors.Arrow; } }
private void GetFormData(ref DOI_TUONG_SDU_TKHOAN obj) { TAIKHOAN objTK = new TAIKHOAN(); try { AutoCompleteEntry au = lstSourceDoiTuongLoai.ElementAt(cmbLoaiDoiTuong.SelectedIndex); objTK.SO_TAI_KHOAN = txtSoTaiKhoan.Text; objTK.ID = ID_TKHOAN; objTK.ID_LOAI_DOI_TUONG = Convert.ToInt32(au.KeywordStrings[1]); objTK.LOAI_DOI_TUONG = au.KeywordStrings[0]; obj.TAI_KHOAN = objTK; obj.DSACH_DTUONG_TKHOAN_CT = lstDTuongCT.ToArray(); } catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } }