public void OnSave() { try { if (!Validation()) { return; } obj = new BC_LOAITK(); GetFormData(ref obj); if (action == DatabaseConstant.Action.THEM) { OnAddNew(obj); } else if (action == DatabaseConstant.Action.SUA) { OnModify(obj); } } catch (Exception ex) { CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
public bool LoaiTK(DatabaseConstant.Action action, ref BC_LOAITK objLoaiTK, ref List <ClientResponseDetail> listClientResponseDetail) { KhaiThacDuLieuServiceClient client = null; KhaiThacDuLieuRequest request = null; KhaiThacDuLieuResponse response = null; try { // Kiểm tra kết nối, server, service trước khi request Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.KhaiThacDuLieuService.layGiaTri()); client = KhaiThacDuLieuServiceClient(ApplicationConstant.SystemService.KhaiThacDuLieuService); request = Common.Utilities.PrepareRequest(new KhaiThacDuLieuServiceRef.KhaiThacDuLieuRequest()); response = new KhaiThacDuLieuServiceRef.KhaiThacDuLieuResponse(); //Khởi tạo request request.Function = DatabaseConstant.Function.KTDL_MAPPING_LOAITK_CT; request.Action = action; request.objLoaiTK = objLoaiTK; // make a call to service client here response = client.KhaiThacDuLieu(request); //Kiểm tra kết quả trả về Common.Utilities.ValidResponse(request, response); if (response != null && response.ResponseStatus == ApplicationConstant.ResponseStatus.THANH_CONG) { objLoaiTK = response.objLoaiTK; return(true); } else { listClientResponseDetail = Common.Utilities.convertToClientResponseDetail(response); return(false); } } catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } finally { if (client.State == CommunicationState.Faulted) { client.Abort(); } else { client.Close(); } client = null; request = null; response = null; } }
public void AfterModify(bool ret, BC_LOAITK obj, List <ClientResponseDetail> listClientResponseDetail) { try { if (ret) { LMessage.ShowMessage("M.DungChung.CapNhatThanhCong", LMessage.MessageBoxType.Information); trangThaiNVu = obj.TTHAI_NVU; TTHAI_NVU = obj.TTHAI_NVU; TTHAI_BGHI = obj.TTHAI_BGHI; MA_DVI_QLY = obj.MA_DVI_QLY; MA_DVI_TAO = obj.MA_DVI_TAO; NGAY_NHAP = obj.NGAY_NHAP; NGUOI_NHAP = obj.NGUOI_NHAP; MA_LOAITK = obj.MA_LOAITK; ID = obj.ID; lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(trangThaiNVu); txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI); raddtNgayCapNhat.Value = LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd"); txtNguoiCapNhat.Text = ClientInformation.TenDangNhap; BeforeViewFromDetail(); } else { CommonFunction.ThongBaoKetQua(listClientResponseDetail); } // Yêu cầu Unlock bản ghi cần sửa UtilitiesProcess process = new UtilitiesProcess(); List <int> listLockId = new List <int>(); listLockId.Add(id); bool retUnlockData = process.UnlockData(DatabaseConstant.Module.DMDC, DatabaseConstant.Function.KTDL_MAPPING_LOAITK_CT, DatabaseConstant.Table.BC_LOAITK, DatabaseConstant.Action.SUA, listLockId); } catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } }
private void GetFormData(ref BC_LOAITK obj) { try { obj.ID = ID; obj.LOAI_BCTK = lstSourceLoaiBCTK.ElementAt(cmbLoaiBCTK.SelectedIndex).KeywordStrings.ElementAt(1).ToString().Trim(); obj.MA_LOAITK = txtMaLoaiTK.Text; obj.NGUON_MAPPING = txtNguonMapping.Text; obj.TEN_LOAITK = txtTenLoaiTK.Text; obj.MA_LOAITK = txtMaLoaiTK.Text; #region Thông tin kiểm soát if (action != DatabaseConstant.Action.THEM) { obj.TTHAI_BGHI = TTHAI_BGHI; obj.TTHAI_NVU = TTHAI_NVU; obj.MA_DVI_QLY = MA_DVI_QLY; obj.MA_DVI_TAO = MA_DVI_TAO; obj.NGAY_NHAP = NGAY_NHAP; obj.NGUOI_NHAP = NGUOI_NHAP; obj.NGAY_CNHAT = ClientInformation.NgayLamViecHienTai; obj.NGUOI_CNHAT = ClientInformation.TenDangNhap; } else { obj.TTHAI_BGHI = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri(); obj.TTHAI_NVU = trangThaiNVu; obj.MA_DVI_QLY = ClientInformation.MaDonVi; obj.MA_DVI_TAO = ClientInformation.MaDonViGiaoDich; obj.NGAY_NHAP = Convert.ToDateTime(raddtNgayLap.Value).ToString("yyyyMMdd"); obj.NGUOI_NHAP = txtNguoiLap.Text; } #endregion } catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } }
public void AfterAddNew(bool ret, BC_LOAITK obj, List <ClientResponseDetail> listClientResponseDetail) { try { if (ret) { LMessage.ShowMessage("M.DungChung.ThemThanhCong", LMessage.MessageBoxType.Information); if (chkThemNhieuLan.IsChecked == true) { BeforeAddNew(); } else { id = obj.ID; txtMaLoaiTK.Text = obj.MA_LOAITK; TTHAI_NVU = obj.TTHAI_NVU; TTHAI_BGHI = obj.TTHAI_BGHI; lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(trangThaiNVu); txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI); MA_DVI_QLY = obj.MA_DVI_QLY; MA_DVI_TAO = obj.MA_DVI_TAO; NGAY_NHAP = obj.NGAY_NHAP; NGUOI_NHAP = obj.NGUOI_NHAP; MA_LOAITK = obj.MA_LOAITK; ID = obj.ID; BeforeViewFromDetail(); } } else { CommonFunction.ThongBaoKetQua(listClientResponseDetail); } } catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } }
private void ResetForm() { //Biến obj = null; id = 0; //Thông tin chung //txtLoaiDoiTuong.Text = ""; txtMaLoaiTK.Text = ""; //txtMaDonVi.Text = ""; txtNguonMapping.Text = ""; txtTenLoaiTK.Text = ""; //Thông tin kiểm soát txtTrangThaiBanGhi.Text = ""; raddtNgayLap.Value = LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd"); txtNguoiLap.Text = ClientInformation.TenDangNhap; raddtNgayCapNhat.Value = null; txtNguoiCapNhat.Text = ""; }
public void OnModify(BC_LOAITK obj) { Mouse.OverrideCursor = Cursors.Wait; try { KhaiThacDuLieuProcess processKTDL = new KhaiThacDuLieuProcess(); List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>(); bool ret = false; ret = processKTDL.LoaiTK(DatabaseConstant.Action.SUA, ref obj, ref listClientResponseDetail); AfterModify(ret, obj, listClientResponseDetail); } catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } finally { Mouse.OverrideCursor = Cursors.Arrow; } }
private void SetFormData() { Mouse.OverrideCursor = Cursors.Wait; try { KhaiThacDuLieuProcess processKTDL = new KhaiThacDuLieuProcess(); List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>(); bool ret = false; obj = new BC_LOAITK(); obj.ID = ID; ret = processKTDL.LoaiTK(DatabaseConstant.Action.LOAD, ref obj, ref listClientResponseDetail); if (ret == true) { ID = obj.ID; #region Thông tin chung lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(obj.TTHAI_NVU); cmbLoaiBCTK.SelectedIndex = lstSourceLoaiBCTK.IndexOf(lstSourceLoaiBCTK.FirstOrDefault(i => i.KeywordStrings[1].ToString().Equals(obj.LOAI_BCTK.ToString()))); txtMaLoaiTK.Text = obj.MA_LOAITK; cmbMaDonVi.SelectedIndex = lstSourceDonVi.IndexOf(lstSourceDonVi.FirstOrDefault(i => i.KeywordStrings[0].ToString().Equals(obj.MA_DVI_TAO.ToString()))); txtNguonMapping.Text = obj.NGUON_MAPPING; txtTenLoaiTK.Text = obj.TEN_LOAITK; #endregion #region Thông tin kiểm soát txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI); raddtNgayLap.Value = LDateTime.StringToDate(obj.NGAY_NHAP, "yyyyMMdd"); txtNguoiLap.Text = obj.NGUOI_NHAP; if (LDateTime.IsDate(obj.NGAY_CNHAT, "yyyyMMdd") == true) { raddtNgayCapNhat.Value = LDateTime.StringToDate(obj.NGAY_CNHAT, "yyyyMMdd"); } else { raddtNgayCapNhat.Value = null; } txtNguoiCapNhat.Text = obj.NGUOI_CNHAT; #endregion #region Lưu thông tin chung TTHAI_BGHI = obj.TTHAI_BGHI; TTHAI_NVU = obj.TTHAI_NVU; MA_DVI_QLY = obj.MA_DVI_QLY; MA_DVI_TAO = obj.MA_DVI_TAO; NGAY_NHAP = obj.NGAY_NHAP; NGUOI_NHAP = obj.NGUOI_NHAP; #endregion } else { CommonFunction.ThongBaoKetQua(listClientResponseDetail); } } catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } finally { Mouse.OverrideCursor = Cursors.Arrow; } }