Ejemplo n.º 1
0
 private void SetThongTin(DM_KHU_VUC obj)
 {
     try
     {
         idKhuVuc             = obj.ID;
         tthaiNVu             = obj.TTHAI_NVU;
         lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(tthaiNVu);
         txtMaKhuVuc.Text     = obj.MA_KVUC;
         txtNguoiDuyet.Text   = obj.NGUOI_CNHAT;
         if (!obj.NGAY_CNHAT.IsNullOrEmptyOrSpace())
         {
             txtNgayDuyet.Value = LDateTime.StringToDate(obj.NGAY_CNHAT, ApplicationConstant.defaultDateTimeFormat);
         }
         txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);
         action = DatabaseConstant.Action.XEM;
         CommonFunction.RefreshButton(Toolbar, action, tthaiNVu, mnuMain, DatabaseConstant.Function.DC_DM_KHU_VUC);
         SetEnabledAllControls(false);
     }
     catch (System.Exception ex)
     {
         LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
     finally
     {
     }
 }
Ejemplo n.º 2
0
        public void AfterAddNew(bool ret, DM_KHU_VUC obj, List <ClientResponseDetail> listClientResponseDetail)
        {
            try
            {
                if (ret)
                {
                    LMessage.ShowMessage("M.DungChung.ThemThanhCong", LMessage.MessageBoxType.Information);

                    if (chkThemNhieuLan.IsChecked == true)
                    {
                        BeforeAddNew();
                    }
                    else
                    {
                        id = obj.ID;
                        txtMaKhuVuc.Text = obj.MA_KVUC;

                        sTrangThaiNVu           = obj.TTHAI_NVU;
                        lblTrangThai.Content    = BusinessConstant.layNgonNguNghiepVu(sTrangThaiNVu);
                        txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);

                        BeforeViewFromDetail();
                    }
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Ejemplo n.º 3
0
 private void BeforSave(DM_KHU_VUC obj, List <ClientResponseDetail> listClientResponseDetail)
 {
     try
     {
         if (obj.ID > 0)
         {
             CommonFunction.ThongBaoKetQua(listClientResponseDetail);
             SetThongTin(obj);
             if (cbMultiAdd.IsChecked.GetValueOrDefault())
             {
                 ResetForm();
             }
         }
         else
         {
             LMessage.ShowMessage("M.DungChung.LoiLuuDuLieu", LMessage.MessageBoxType.Error);
         }
     }
     catch (System.Exception ex)
     {
         LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
     finally
     {
     }
 }
Ejemplo n.º 4
0
        public void OnSave()
        {
            try
            {
                if (!Validation())
                {
                    return;
                }

                string trangThai = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();

                obj = new DM_KHU_VUC();

                GetFormData(ref obj, trangThai);

                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);
            }
        }
Ejemplo n.º 5
0
        private void GetFormData(ref DM_KHU_VUC obj, string sTrangThaiNVu)
        {
            try
            {
                obj = new DM_KHU_VUC();

                obj.ID         = id;
                obj.ID_DVI     = Convert.ToInt32(lstSourcePhongGiaoDich.ElementAt(cmbPhongGiaoDich.SelectedIndex).KeywordStrings.ElementAt(1));
                obj.MA_KVUC    = txtMaKhuVuc.Text;
                obj.MA_DVI     = lstSourcePhongGiaoDich.ElementAt(cmbPhongGiaoDich.SelectedIndex).KeywordStrings.First();
                obj.TEN_KVUC   = txtTenKhuVuc.Text;
                obj.TEN_TAT    = txtTenTat.Text;
                obj.ID_CBO_QLY = Convert.ToInt32(lstSourceCBQL.ElementAt(cmbCBQL.SelectedIndex).KeywordStrings.ElementAt(1));
                obj.MA_CBO_QLY = lstSourceCBQL.ElementAt(cmbCBQL.SelectedIndex).KeywordStrings.First();

                //Thông tin kiểm soát
                obj.TTHAI_BGHI = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri();
                obj.TTHAI_NVU  = sTrangThaiNVu;
                obj.MA_DVI_QLY = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.First();
                obj.MA_DVI_TAO = obj.MA_DVI;
                obj.NGAY_NHAP  = Convert.ToDateTime(raddtNgayLap.Value).ToString("yyyyMMdd");
                obj.NGUOI_NHAP = txtNguoiLap.Text;
                if (action != DatabaseConstant.Action.THEM)
                {
                    obj.NGAY_CNHAT  = ClientInformation.NgayLamViecHienTai;
                    obj.NGUOI_CNHAT = ClientInformation.TenDangNhap;
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Ejemplo n.º 6
0
        private void SetFormData()
        {
            DanhMucProcess processDanhMuc = new DanhMucProcess();

            List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();

            obj = new DM_KHU_VUC();
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                bool ret = false;
                obj.ID = id;
                ret    = processDanhMuc.KhuVuc02(DatabaseConstant.Action.LOAD, ref obj, ref listClientResponseDetail);
                if (ret == true)
                {
                    sTrangThaiNVu        = obj.TTHAI_NVU;
                    lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(sTrangThaiNVu);

                    #region Thông tin chung
                    cmbChiNhanh.SelectedIndex      = lstSourceChiNhanh.IndexOf(lstSourceChiNhanh.FirstOrDefault(e => e.KeywordStrings.First().Equals(obj.MA_DVI_QLY)));
                    cmbPhongGiaoDich.SelectedIndex = lstSourcePhongGiaoDich.IndexOf(lstSourcePhongGiaoDich.FirstOrDefault(e => e.KeywordStrings.First().Equals(obj.MA_DVI)));
                    txtMaKhuVuc.Text      = obj.MA_KVUC;
                    txtTenKhuVuc.Text     = obj.TEN_KVUC;
                    txtTenTat.Text        = obj.TEN_TAT;
                    cmbCBQL.SelectedIndex = lstSourceCBQL.IndexOf(lstSourceCBQL.FirstOrDefault(e => e.KeywordStrings.First().Equals(obj.MA_CBO_QLY)));
                    #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");
                    }
                    txtNguoiCapNhat.Text = obj.NGUOI_CNHAT;
                    #endregion
                }
                else
                {
                    LMessage.ShowMessage("M_ResponseMessage_HanhDong_LayDuLieuKhongThanhCong", LMessage.MessageBoxType.Warning);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                LMessage.ShowMessage("M_ResponseMessage_HanhDong_LayDuLieuKhongThanhCong", LMessage.MessageBoxType.Warning);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Ejemplo n.º 7
0
        private void AfterSave(BusinessConstant.TrangThaiNghiepVu nghiepvu, BusinessConstant.TrangThaiSuDung sudung)
        {
            try
            {
                Cursor = Cursors.Wait;
                if (!Validation() && nghiepvu.Equals(BusinessConstant.TrangThaiNghiepVu.CHO_DUYET))
                {
                    return;
                }
                DM_KHU_VUC obj = GetDataForm(nghiepvu, sudung);

                // Lock dữ liệu nếu người dùng chấp nhận cảnh báo
                UtilitiesProcess process    = new UtilitiesProcess();
                List <int>       listLockId = new List <int>();
                listLockId.Add(idKhuVuc);
                bool retLockData = true;
                if (idKhuVuc > 0)
                {
                    retLockData = process.LockData(DatabaseConstant.Module.DMDC,
                                                   DatabaseConstant.Function.DC_DM_KHU_VUC,
                                                   DatabaseConstant.Table.DM_KHU_VUC,
                                                   DatabaseConstant.Action.SUA,
                                                   listLockId);
                }
                if (retLockData)
                {
                    OnSave(obj);
                }
            }
            catch (System.Exception ex)
            {
                LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            finally
            {
                Cursor = Cursors.Arrow;
                // Unlock dữ liệu nếu người dùng chấp nhận cảnh báo
                UtilitiesProcess process    = new UtilitiesProcess();
                List <int>       listLockId = new List <int>();
                listLockId.Add(idKhuVuc);
                bool retLockData = true;
                if (idKhuVuc > 0)
                {
                    retLockData = process.UnlockData(DatabaseConstant.Module.DMDC,
                                                     DatabaseConstant.Function.DC_DM_KHU_VUC,
                                                     DatabaseConstant.Table.DM_KHU_VUC,
                                                     DatabaseConstant.Action.SUA,
                                                     listLockId);
                }
            }
        }
Ejemplo n.º 8
0
 private void OnSave(DM_KHU_VUC obj)
 {
     try
     {
         List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
         if (idKhuVuc == 0)
         {
             obj = new DanhMucProcess().ThemKhuVuc(obj, ref listClientResponseDetail);
         }
         else
         {
             obj = new DanhMucProcess().SuaKhuVuc(obj, ref listClientResponseDetail);
         }
         BeforSave(obj, listClientResponseDetail);
     }
     catch (System.Exception ex)
     {
         LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
     }
 }
Ejemplo n.º 9
0
        private DM_KHU_VUC GetDataForm(BusinessConstant.TrangThaiNghiepVu nghiepvu, BusinessConstant.TrangThaiSuDung sudung)
        {
            DM_KHU_VUC obj   = new DM_KHU_VUC();
            DataSet    dsDVi = new DanhMucProcess().getDonViTheoMa(lstSourcePGD.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings[0]);

            obj.ID          = idKhuVuc;
            obj.ID_DVI      = Convert.ToInt32(dsDVi.Tables[0].Rows[0]["ID"]);
            obj.MA_DVI      = lstSourcePGD.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings.FirstOrDefault();
            obj.MA_DVI_QLY  = ClientInformation.MaDonVi;
            obj.MA_DVI_TAO  = lstSourcePGD.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings.FirstOrDefault();
            obj.MA_KVUC     = txtMaKhuVuc.Text;
            obj.TEN_KVUC    = txtTenKhuVuc.Text;
            obj.TEN_TAT     = txtTenTat.Text;
            obj.TTHAI_NVU   = nghiepvu.layGiaTri();
            obj.TTHAI_BGHI  = sudung.layGiaTri();
            obj.NGAY_CNHAT  = idKhuVuc > 0 ? ClientInformation.NgayLamViecHienTai : "";
            obj.NGUOI_CNHAT = idKhuVuc > 0 ? ClientInformation.TenDangNhap : "";
            obj.NGAY_NHAP   = idKhuVuc == 0 ? ClientInformation.NgayLamViecHienTai : LDateTime.DateToString(txtNgayLap.Value.GetValueOrDefault(), ApplicationConstant.defaultDateTimeFormat);
            obj.NGUOI_NHAP  = idKhuVuc == 0 ? ClientInformation.TenDangNhap : txtNguoiLap.Text;
            return(obj);
        }
Ejemplo n.º 10
0
        public void AfterModify(bool ret, DM_KHU_VUC obj, List <ClientResponseDetail> listClientResponseDetail)
        {
            try
            {
                if (ret)
                {
                    LMessage.ShowMessage("M.DungChung.CapNhatThanhCong", LMessage.MessageBoxType.Information);

                    sTrangThaiNVu           = obj.TTHAI_NVU;
                    lblTrangThai.Content    = BusinessConstant.layNgonNguNghiepVu(sTrangThaiNVu);
                    txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);
                    raddtNgayCapNhat.Value  = LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd");
                    txtNguoiCapNhat.Text    = ClientInformation.TenDangNhap;

                    BeforeViewFromDetail();
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                    //LMessage.ShowMessage("M.DungChung.CapNhatKoThanhCong", LMessage.MessageBoxType.Error);
                }

                // 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.DC_DM_CUM,
                                                        DatabaseConstant.Table.DM_CUM,
                                                        DatabaseConstant.Action.SUA,
                                                        listLockId);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Ejemplo n.º 11
0
        public void OnModify(DM_KHU_VUC obj)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                DanhMucProcess processDanhMuc = new DanhMucProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                ret = processDanhMuc.KhuVuc02(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;
            }
        }
Ejemplo n.º 12
0
        private void ResetForm()
        {
            sTrangThaiNVu        = "";
            lblTrangThai.Content = "";
            id  = 0;
            obj = null;

            #region Thông tin chung
            txtMaKhuVuc.Text  = "";
            txtTenKhuVuc.Text = "";
            txtTenTat.Text    = "";

            #endregion

            #region 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    = "";
            #endregion
        }