Esempio n. 1
0
        /// <summary>
        /// Lưu dữ liệu (hay trình duyệt)
        /// </summary>
        private void onSave()
        {
            raddgrTaiKhoan.CommitEdit();
            if (Validation())
            {
                KeToanProcess process = new KeToanProcess();
                try
                {
                    ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                    List <ClientResponseDetail>        listResponseDetail = new List <ClientResponseDetail>();
                    // Dữ liệu truyền vào và dữ liệu trả về

                    this.Cursor = Cursors.Wait;
                    if (GetDataForm())
                    {
                        ret = process.ChungTuGhiSoKBao(DatabaseConstant.Function.KT_CHUNG_TU_GHI_SO, DatabaseConstant.Action.THEM, ref obj, ref listResponseDetail);
                        afterSave(ret, obj, listResponseDetail);
                    }
                }
                catch (System.Exception ex)
                {
                    this.Cursor = Cursors.Arrow;
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                finally
                {
                    this.Cursor = Cursors.Arrow;
                    process     = null;
                }
            }
        }
        private void Luu()
        {
            //Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                string      maTranPheDuyet = getObject();
                DataRowView dr             = (DataRowView)grDanhSach.SelectedItem;
                string      maChucNang     = dr["MA"].ToString();

                HT_CNANG htCNang = new HT_CNANG();
                htCNang.MA_CNANG          = maChucNang;
                htCNang.MA_TRAN_PHE_DUYET = maTranPheDuyet;

                ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                string responseMessage = "";

                ret = qtht.MaTranPheDuyet(ref htCNang, ref responseMessage);
                if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    LMessage.ShowMessage("Thiết lập ma trận phê duyệt thành công cho chức năng được chọn", LMessage.MessageBoxType.Information);
                }
                else
                {
                    LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Warning);
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            //Mouse.OverrideCursor = Cursors.Arrow;
        }
Esempio n. 3
0
 private void ThoaiDuyet()
 {
     try
     {
         HanMucProcess process = new HanMucProcess();
         int[]         arrayID = new int[0];
         Mouse.OverrideCursor = Cursors.Wait;
         try
         {
             foreach (DataRowView dr in grKhachHangDS.SelectedItems)
             {
                 Array.Resize(ref arrayID, arrayID.Length + 1);
                 arrayID[arrayID.Length - 1] = Convert.ToInt32(dr["ID"]);
             }
             HM_HMUC_TONG obj = new HM_HMUC_TONG();
             obj.lstID = arrayID;
             List <ClientResponseDetail>        lstResponseDetail = new List <ClientResponseDetail>();
             ApplicationConstant.ResponseStatus ret = process.HanMucTong(_function, DatabaseConstant.Action.THOAI_DUYET, ref obj, ref lstResponseDetail);
             CommonFunction.ThongBaoKetQua(lstResponseDetail);
             TimKiem();
         }
         catch (System.Exception ex)
         {
             this.Cursor = Cursors.Arrow;
             CommonFunction.ThongBaoLoi(ex);
             LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
         }
         Mouse.OverrideCursor = Cursors.Arrow;
     }
     catch (System.Exception ex)
     {
         CommonFunction.ThongBaoLoi(ex);
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
     }
 }
Esempio n. 4
0
        public ApplicationConstant.ResponseStatus PhanQuyenPhamVi(DatabaseConstant.Action action,
                                                                  ref THONG_TIN_CHUNG objThongTinChung,
                                                                  ref List <BS_ResponseDetail> lstResponseDetail,
                                                                  ref PHAM_VI objPhamVi,
                                                                  ref ApplicationConstant.QuanTriHeThongResponseMessage responseMessage)
        {
            ApplicationConstant.ResponseStatus responseStatus = new ApplicationConstant.ResponseStatus();
            BS_ResponseDetail responseDetail = new BS_ResponseDetail();

            switch (action)
            {
            case DatabaseConstant.Action.XOA:     //Xóa
                responseStatus = new BS_QuanTriHeThong_Action().PhamVi_Xoa(ref objThongTinChung, ref objPhamVi, ref responseMessage, ref responseDetail);
                break;

            case DatabaseConstant.Action.LUU:    //Thêm
                responseStatus = new BS_QuanTriHeThong_Action().PhamVi_Luu(ref objThongTinChung, ref objPhamVi, ref responseMessage, ref responseDetail);
                break;

            case DatabaseConstant.Action.LAY_LAI:    //Sua
                responseStatus = new BS_QuanTriHeThong_Action().PhamVi_LayDuLieu(ref objThongTinChung, ref objPhamVi, ref responseMessage, ref responseDetail);
                break;

            default:
                responseStatus  = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                responseMessage = ApplicationConstant.QuanTriHeThongResponseMessage.M_ResponseMessage_QuanTriHeThong_KhongThanhCong;
                break;
            }
            lstResponseDetail.Add(responseDetail);
            return(responseStatus);
        }
 private void afterModify(ApplicationConstant.ResponseStatus status)
 {
     if (status == ApplicationConstant.ResponseStatus.THANH_CONG)
     {
         if (formCase.Equals(BusinessConstant.LOAI_CUOI_NGAY.KHOA_SO.layGiaTri()))
         {
             LMessage.ShowMessage("M.KeToan.CuoiNgay.ucCuoiNgayDV.KhoaSoThanhCong", LMessage.MessageBoxType.Information);
         }
         else
         {
             LMessage.ShowMessage("M.KeToan.CuoiNgay.ucCuoiNgayDV.MoSoThanhCong", LMessage.MessageBoxType.Information);
         }
     }
     else
     {
         if (formCase.Equals(BusinessConstant.LOAI_CUOI_NGAY.KHOA_SO.layGiaTri()))
         {
             LMessage.ShowMessage("M.KeToan.CuoiNgay.ucCuoiNgayDV.KhoaSoKhongThanhCong", LMessage.MessageBoxType.Error);
         }
         else
         {
             LMessage.ShowMessage("M.KeToan.CuoiNgay.ucCuoiNgayDV.MoSoKhongThanhCong", LMessage.MessageBoxType.Error);
         }
     }
 }
        /// <summary>
        /// Sau khi sửa
        /// </summary>
        /// <param name="ret"></param>
        private void afterModify(ref string msg, ApplicationConstant.ResponseStatus ret, HT_NHNSD obj, string responseMessage)
        {
            if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
            {
                msg = "S#" + LanguageNode.GetValueMessageLanguage("M.DungChung.CapNhatThanhCong");

                // Bind lại giao diện
            }
            else
            {
                msg = "E#" + LanguageNode.GetValueMessageLanguage(responseMessage);
            }

            // Yêu cầu Unlock bản ghi cần sửa
            UtilitiesProcess process    = new UtilitiesProcess();
            List <int>       listLockId = new List <int>();

            listLockId.Add(obj.ID);

            bool retUnlockData = process.UnlockData(DatabaseConstant.Module.QTHT,
                                                    DatabaseConstant.Function.HT_NHNSD,
                                                    DatabaseConstant.Table.HT_NHNSD,
                                                    DatabaseConstant.Action.SUA,
                                                    listLockId);
        }
Esempio n. 7
0
        private void btnResetPassword_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Validation())
                {
                    string newPassword = LSecurity.MD5Encrypt(txtNewPassword.Password);

                    QuanTriHeThongProcess process          = new QuanTriHeThongProcess();
                    string responseMessage                 = "";
                    ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;

                    ret = process.ThietLapMatKhauNguoiDung(userName, newPassword, ref responseMessage);

                    if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
                    {
                        LMessage.ShowMessage("M.ResponseMessage.QuanTriHeThong.NguoiDung.ResetMatKhauThanhCong", LMessage.MessageBoxType.Information);
                        CustomControl.CommonFunction.CloseUserControl(this);
                    }
                    else
                    {
                        LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Warning);
                    }
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
        public void OnSave(ref string msg, HT_NHNSD obj)
        {
            try
            {
                if (Validate(ref msg, obj))
                {
                    QuanTriHeThongProcess process          = new QuanTriHeThongProcess();
                    List <string>         lstStrIdNSD      = new List <string>(); //(from row in dt.AsEnumerable() select row.Field<string>("ID")).Distinct().ToList();
                    List <int>            lstIdNSD         = lstStrIdNSD.Select(i => i.StringToInt32()).ToList();
                    ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                    var    lstTruyCap      = new List <HT_TRUY_CAP>();
                    string responseMessage = null;

                    // Nếu là thêm mới
                    if (obj.ID == 0)
                    {
                        ret = process.ThemNHNSD(ref obj, lstIdNSD, lstTruyCap, ref responseMessage);
                        afterAddNew(ref msg, ret, obj, responseMessage);
                    }
                    else
                    {
                        ret = process.SuaNHNSD(ref obj, lstIdNSD, lstTruyCap, ref responseMessage);
                        afterModify(ref msg, ret, obj, responseMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                msg = LanguageNode.GetValueMessageLanguage(ex.Message);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
        private void onLoad()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            KeToanProcess process = new KeToanProcess();

            try
            {
                List <ClientResponseDetail>        listClientResponseDetail = new List <ClientResponseDetail>();
                ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                objHeThong             = new HE_THONG_TKTH();
                objHeThong.HTTKTHCT    = new HT_TKTH_CTIET();
                objHeThong.HTTKTHCT.ID = id;
                if (process.HeThongTaiKhoanChiTiet(DatabaseConstant.Action.LOAD_DATA, ref objHeThong, ref listClientResponseDetail) == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    LoadDuLieu();
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
                process = null;
            }
        }
Esempio n. 10
0
        public void onSave()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (Validate())
                {
                    QuanTriHeThongProcess process          = new QuanTriHeThongProcess();
                    List <string>         lstStrIdNSD      = (from row in dt.AsEnumerable() select row.Field <string>("ID")).Distinct().ToList();
                    List <int>            lstIdNSD         = lstStrIdNSD.Select(i => i.StringToInt32()).ToList();
                    ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                    string responseMessage = null;

                    // Nếu là thêm mới
                    if (id == 0)
                    {
                        getObject(DatabaseConstant.Action.THEM);
                        ret = process.ThemNHNSD(ref obj, lstIdNSD, lstTruyCap, ref responseMessage);
                        afterAddNew(ret, obj, responseMessage);
                    }
                    else
                    {
                        getObject(DatabaseConstant.Action.SUA);
                        ret = process.SuaNHNSD(ref obj, lstIdNSD, lstTruyCap, ref responseMessage);
                        afterModify(ret, obj, responseMessage);
                    }
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
        private void ThoaiDuyet()
        {
            if (LMessage.ShowMessage("M.DungChung.HoiThoaiDuyet", LMessage.MessageBoxType.Question) == MessageBoxResult.Yes)
            {
                try
                {
                    KhachHangProcess process = new KhachHangProcess();
                    int[]            arrayID = new int[0];
                    Mouse.OverrideCursor = Cursors.Wait;
                    try
                    {
                        for (int i = 0; i < grKhachHangDS.Items.Count; i++)
                        {
                            DataRowView dr = (DataRowView)grKhachHangDS.Items[i];
                            if (Convert.ToBoolean(dr["CHON"]) == true)
                            {
                                Array.Resize(ref arrayID, arrayID.Length + 1);
                                arrayID[arrayID.Length - 1] = Convert.ToInt32(dr["ID"]);
                            }
                        }

                        if (arrayID.Length > 0)
                        {
                            List <ClientResponseDetail>        listClientResponseDetail = new List <ClientResponseDetail>();
                            ApplicationConstant.ResponseStatus ret = process.ThoaiDuyetGDChuyenDiaBan(arrayID, ref listClientResponseDetail);

                            if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
                            {
                                LMessage.ShowMessage("M.DungChung.ThoaiDuyetThanhCong", LMessage.MessageBoxType.Information);
                            }
                            else
                            {
                                CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                            }
                            TimKiem();
                        }
                        else
                        {
                            LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        this.Cursor = Cursors.Arrow;
                        CommonFunction.ThongBaoLoi(ex);
                        LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                    }
                }
                catch (System.Exception ex)
                {
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                finally
                {
                    Mouse.OverrideCursor = Cursors.Arrow;
                }
            }
        }
Esempio n. 12
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            AutoCompleteEntry ace = (AutoCompleteEntry)cmbPhongGD.SelectedItem;

            if (ace != null)
            {
                string id             = ace.KeywordStrings[2];
                string ma             = ace.KeywordStrings[0];
                string ten            = ace.DisplayName;
                string hachtoan       = ace.KeywordStrings[1];
                string maDonViCha     = ace.KeywordStrings[3];
                string maTinhThanhPho = ace.KeywordStrings[4];
                string soLuongBGhi    = "";

                ClientInformation.TenDonViGiaoDich    = ten;
                ClientInformation.MaDonViGiaoDich     = ma;
                ClientInformation.IdDonViGiaoDich     = Int32.Parse(id);
                ClientInformation.PhuongPhapHachToan  = hachtoan;
                ClientInformation.TinhTPDonViGiaoDich = maTinhThanhPho;

                // Nếu đơn vị vận hành khác đơn vị quản lý
                // 1. Lấy thông tin chi nhánh của phòng giao dịch được chọn
                // 2. Lấy thông tin ngày làm việc phòng giao dịch được chọn
                if (maDonViCha != null && !maDonViCha.Equals(ClientInformation.MaDonVi))
                {
                    DanhMucProcess process = new DanhMucProcess();
                    ApplicationConstant.ResponseStatus ret = new ApplicationConstant.ResponseStatus();
                    Presentation.Process.DanhMucServiceRef.DM_DON_VI     dmDonVi     = new Presentation.Process.DanhMucServiceRef.DM_DON_VI();
                    Presentation.Process.DanhMucServiceRef.HT_NGAY_LVIEC ngayLamViec = new Presentation.Process.DanhMucServiceRef.HT_NGAY_LVIEC();
                    string responseMessage = "";

                    ret = process.GetDonViChaByMaDonVi(ma, ref dmDonVi, ref ngayLamViec, ref responseMessage);
                    if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
                    {
                        ClientInformation.IdDonVi  = dmDonVi.ID;
                        ClientInformation.MaDonVi  = dmDonVi.MA_DVI;
                        ClientInformation.TenDonVi = dmDonVi.TEN_GDICH;

                        ClientInformation.NgayLamViecTruoc   = ngayLamViec.NGAY_TRUOC;
                        ClientInformation.NgayLamViecHienTai = ngayLamViec.NGAY_LVIEC;
                        ClientInformation.NgayLamViecSau     = ngayLamViec.NGAY_TTHEO;
                    }
                    process = null;
                }
                soLuongBGhi = new UtilitiesProcess().LayGiaTriThamSo(BusinessConstant.LoaiThamSo.TW, BusinessConstant.MaThamSo.TW_SOLUONG_BANGHI, ClientInformation.MaDonVi);
                if (soLuongBGhi.IsNullOrEmptyOrSpace())
                {
                    soLuongBGhi = "10";
                }
                ClientInformation.SoLuongBanGhi = soLuongBGhi.StringToInt32();
            }

            MainWindow mainWindow = new MainWindow();

            mainWindow.Show();
            this.Cursor = Cursors.Arrow;
            Close();
        }
        private void Worker_DoWork_KiemTra(object sender, DoWorkEventArgs e)
        {
            try
            {
                // background
                QuanTriHeThongProcess process          = new QuanTriHeThongProcess();
                ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                string  serverVersion        = "";
                string  lastestClientVersion = "";
                HT_PBAN htPban = new HT_PBAN();
                List <HT_PBAN_CTIET> listHtPbanCtiet = new List <HT_PBAN_CTIET>();
                List <HT_PBAN_FILE>  listHtPbanFile  = new List <HT_PBAN_FILE>();
                string responseMessage = "";
                ret       = process.CheckClientVersion(ClientInformation.Version, ref serverVersion, ref lastestClientVersion, ref htPban, ref listHtPbanCtiet, ref listHtPbanFile, ref responseMessage);
                ResStatus = ret;
                if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    ServerVersion        = serverVersion;
                    LastestClientVersion = lastestClientVersion;
                    if (ClientInformation.Version.Equals(LastestClientVersion))
                    {
                        IsLastestVersion = true;
                        ResContent       = LLanguage.SearchResourceByKey("M.ResponseMessage.QuanTriHeThong.PhienBan.SystemUpToDate") + " " + ClientInformation.Version;
                    }
                    else
                    {
                        IsLastestVersion = false;
                        HtPban           = htPban;
                        ListHtPbanCtiet  = listHtPbanCtiet;
                        ListHtPbanFile   = listHtPbanFile;
                        ResContent       = LLanguage.SearchResourceByKey("M.ResponseMessage.QuanTriHeThong.PhienBan.PhienBanHienTai") +
                                           " " + ClientInformation.Version + ". " +
                                           LLanguage.SearchResourceByKey("M.ResponseMessage.QuanTriHeThong.PhienBan.PhienBanMoiNhat") +
                                           " " + LastestClientVersion;
                    }
                }
                else if (ret == ApplicationConstant.ResponseStatus.KHONG_THANH_CONG)
                {
                    ResContent = LLanguage.SearchResourceByKey(responseMessage);
                }
                else
                {
                    ResContent = "";
                }

                Thread.Sleep(3000);
            }
            catch (Exception ex)
            {
                ResStatus  = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                ResContent = LLanguage.SearchResourceByKey("M.ResponseMessage.QuanTriHeThong.PhienBan.KiemTraKhongThanhCong");
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.SYS, ex);
                Worker_KiemTra.CancelAsync();
                // Vẫn xử lý tại client cho logout
                //Application.Current.Shutdown();
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Sau khi thêm mới
 /// </summary>
 /// <param name="ret"></param>
 private void afterSave(ApplicationConstant.ResponseStatus ret, Presentation.Process.KeToanServiceRef.GHI_SO obj, List <ClientResponseDetail> listResponseDetail)
 {
     if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
     {
         LMessage.ShowMessage("M.DungChung.ThemThanhCong", LMessage.MessageBoxType.Information);
     }
     else
     {
         CommonFunction.ThongBaoKetQua(listResponseDetail);
     }
 }
Esempio n. 15
0
 private void afterModify(ApplicationConstant.ResponseStatus status)
 {
     if (status == ApplicationConstant.ResponseStatus.THANH_CONG)
     {
         LMessage.ShowMessage("M.KeToan.CuoiNgay.ucCuoiNgayTW.KhoaSoThanhCong", LMessage.MessageBoxType.Information);
     }
     else
     {
         LMessage.ShowMessage("M.KeToan.CuoiNgay.ucCuoiNgayTW.KhoaSoKhongThanhCong", LMessage.MessageBoxType.Error);
     }
 }
Esempio n. 16
0
 public void AfterSave(ApplicationConstant.ResponseStatus ret, List <ClientResponseDetail> listClientResponseDetail)
 {
     CommonFunction.ThongBaoKetQua(listClientResponseDetail);
     if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
     {
         TTHAI_NVU = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();
         lblLabelTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(TTHAI_NVU);
         CommonFunction.RefreshButton(Toolbar, DatabaseConstant.Action.XEM, TTHAI_NVU, mnuMain, DatabaseConstant.Function.DC_DM_DTUONG_SODU);
         SetEnabledControls(false);
     }
 }
Esempio n. 17
0
        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;
            }
        }
        /// <summary>
        /// Xử lý xóa dữ liệu
        /// </summary>
        private void Xoa()
        {
            try
            {
                KeToanProcess               process     = new KeToanProcess();
                List <KT_TKHOAN>            lstKtTkhoan = new List <KT_TKHOAN>();
                List <ClientResponseDetail> lstResponse = new List <ClientResponseDetail>();

                Mouse.OverrideCursor = Cursors.Wait;
                try
                {
                    foreach (DataRowView dr in raddgrDanhSachTK.SelectedItems)
                    {
                        KT_TKHOAN obj = new KT_TKHOAN();
                        obj.ID           = Convert.ToInt32(dr["ID"]);
                        obj.SO_TAI_KHOAN = dr["SO_TAI_KHOAN"].ToString();
                        lstKtTkhoan.Add(obj);
                    }

                    if (lstKtTkhoan.Count == 0)
                    {
                        LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning);
                        return;
                    }

                    MessageBoxResult messResult = LMessage.ShowMessage("M.DungChung.HoiXoa", LMessage.MessageBoxType.Question);
                    if (messResult == MessageBoxResult.Yes)
                    {
                        ApplicationConstant.ResponseStatus ret = process.TaiKhoanChiTietDS(DatabaseConstant.Action.XOA, lstKtTkhoan, ref lstResponse);
                        CommonFunction.ThongBaoKetQua(lstResponse);
                        TimKiem();
                    }
                }
                catch (System.Exception ex)
                {
                    this.Cursor = Cursors.Arrow;
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                Mouse.OverrideCursor = Cursors.Arrow;
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
Esempio n. 19
0
 private void tlbSave_Click(object sender, RoutedEventArgs e)
 {
     ApplicationConstant.ResponseStatus responseStatus = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
     if (Vadition())
     {
         GetDataForm();
         responseStatus = new BaoCaoProcess().NhapDuLieuDauVaoBCTK(ref lstBCTKDuLieu);
         if (responseStatus.Equals(ApplicationConstant.ResponseStatus.KHONG_THANH_CONG))
         {
             LMessage.ShowMessage("M.DungChung.LuuDuLieuKhongThanhCong", LMessage.MessageBoxType.Error);
         }
         else
         {
             LMessage.ShowMessage("M.DungChung.LuuDuLieuThanhCong", LMessage.MessageBoxType.Information);
         }
     }
 }
        /// <summary>
        /// Xử lý xóa dữ liệu
        /// </summary>
        private void Xoa()
        {
            try
            {
                KeToanProcess process     = new KeToanProcess();
                List <int>    lstKtTkhoan = new List <int>();
                List <ClientResponseDetail> lstResponse = new List <ClientResponseDetail>();
                Mouse.OverrideCursor = Cursors.Wait;
                try
                {
                    foreach (HT_TKTH_CTIET dr in raddgrDanhSachTK.SelectedItems)
                    {
                        lstKtTkhoan.Add(dr.ID);
                    }

                    if (lstKtTkhoan.Count == 0)
                    {
                        LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning);
                        return;
                    }

                    MessageBoxResult messResult = LMessage.ShowMessage("M.DungChung.HoiXoa", LMessage.MessageBoxType.Question);
                    if (messResult == MessageBoxResult.Yes)
                    {
                        HE_THONG_TKTH objHeThong = new HE_THONG_TKTH();
                        objHeThong.DSACHID = lstKtTkhoan.ToArray();
                        ApplicationConstant.ResponseStatus ret = process.HeThongTaiKhoanChiTiet(DatabaseConstant.Action.XOA, ref objHeThong, ref lstResponse);
                        CommonFunction.ThongBaoKetQua(lstResponse);
                        TimKiem();
                    }
                }
                catch (System.Exception ex)
                {
                    this.Cursor = Cursors.Arrow;
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                Mouse.OverrideCursor = Cursors.Arrow;
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
        private void onSave()
        {
            string trangThai = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();

            if (Validation())
            {
                KeToanProcess process = new KeToanProcess();
                try
                {
                    List <ClientResponseDetail>        listClientResponseDetail = new List <ClientResponseDetail>();
                    ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                    // Dữ liệu truyền vào và dữ liệu trả về

                    Mouse.OverrideCursor = Cursors.Wait;
                    if (GetDataForm() == 1)
                    {
                        if (process.HeThongTaiKhoanChiTiet(DatabaseConstant.Action.THEM, ref objHeThong, ref listClientResponseDetail) == ApplicationConstant.ResponseStatus.THANH_CONG)
                        {
                            CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                            LoadDuLieu();
                            SetEnableControl(false);
                            action = DatabaseConstant.Action.XEM;
                            CommonFunction.RefreshButton(Toolbar, action, objHeThong.HTTKTHCT.TTHAI_NVU, mnuMain, DatabaseConstant.Function.KT_HE_THONG_TKTH);
                        }
                        else
                        {
                            CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    this.Cursor = Cursors.Arrow;
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                finally
                {
                    process = null;
                }
            }
        }
Esempio n. 22
0
        public void GiaoDichPhatSinh(ref DoiTuongBaoCao doiTuongBaoCao)
        {
            try
            {
                ApplicationConstant.ResponseStatus retStatus = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                FileBase fileResponse    = new FileBase();
                string   responseMessage = null;

                // Thêm một số thông tin khác về đối tượng báo cáo
                GIAO_DICH_BASE giaoDichBase = doiTuongBaoCao.objGIAO_DICH_BASE != null ? doiTuongBaoCao.objGIAO_DICH_BASE : new GIAO_DICH_BASE();
                giaoDichBase.MaNguoiDung        = ClientInformation.TenDangNhap;
                giaoDichBase.TenNguoiDung       = ClientInformation.HoTen;
                giaoDichBase.NgonNgu            = ClientInformation.NgonNgu;
                giaoDichBase.DinhDang           = ApplicationConstant.LoaiDinhDangBaoCao.PDF.layGiaTri();
                giaoDichBase.NgayThucHienBaoCao = ClientInformation.NgayLamViecHienTai;

                doiTuongBaoCao.objGIAO_DICH_BASE = giaoDichBase;

                retStatus = process.LayDuLieuVanHanhGiaoDich(doiTuongBaoCao, ref fileResponse, ref responseMessage);

                if (retStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    string fileReport = ClientInformation.TempDir + "\\" + fileResponse.FileName + "." + fileResponse.FileFormat;
                    LFile.WriteFileFromByteArray(fileResponse.FileData, fileReport);

                    // show file
                    Stream stream = LFile.ConvertByteArrayToStream(fileResponse.FileData);
                    System.Diagnostics.Process.Start(fileReport);
                }
                else
                {
                    LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Error);
                    return;
                }
            }
            catch (System.Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                GC.Collect();
                CommonFunction.ThongBaoLoi(ex);
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Sau khi thêm mới
        /// </summary>
        /// <param name="ret"></param>
        private void afterAddNew(ref string msg, ApplicationConstant.ResponseStatus ret, HT_NHNSD obj, string responseMessage, bool multiAdd = false)
        {
            if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
            {
                msg = "S#" + LanguageNode.GetValueMessageLanguage("M.DungChung.ThemThanhCong");

                if (multiAdd)
                {
                }
                else if (!DatabaseConstant.CLOSE_DETAIL_FORM)
                {
                }
                else
                {
                }
            }
            else
            {
                msg = "E#" + LanguageNode.GetValueMessageLanguage(responseMessage);
            }
        }
        private void BuildFormDieuKien()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (grDSBaoCao.SelectedItems.Count > 0)
                {
                    // Lấy báo cáo được chọn từ grid
                    DataRowView dr          = (DataRowView)grDSBaoCao.SelectedItem;
                    int         idBaoCao    = int.Parse(dr[0].ToString());
                    int         idBaoCaoCha = int.Parse(dr[4].ToString());
                    string      maBaoCao    = dr[2].ToString();

                    // Lấy thông tin báo cáo và tham số
                    if (idBaoCaoCha != 0)
                    {
                        KhaiThacDuLieuProcess process          = new KhaiThacDuLieuProcess();
                        ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                        List <HT_BAOCAO_TSO>    lstBaoCaoTso   = new List <HT_BAOCAO_TSO>();
                        DatabaseConstant.Action action         = DatabaseConstant.Action.TRUY_VAN;
                        string responseMessage = "";
                        process.DuLieuChiTieu(action, idBaoCao, ref htBaoCao, ref lstBaoCaoTso, ref responseMessage);
                        string uriBaoCaoDieuKien = "/" + htBaoCao.NHOM_DIEUKIEN + ";component/" + htBaoCao.FILE_DIEUKIEN;

                        uc = (UserControl)System.Windows.Application.LoadComponent(new Uri(uriBaoCaoDieuKien, System.UriKind.RelativeOrAbsolute));
                        if (!LObject.IsNullOrEmpty(uc.GetType().GetProperty("MaBaoCao")))
                        {
                            uc.GetType().GetProperty("MaBaoCao").SetValue(uc, maBaoCao, null);
                        }
                        frFormInput.Content = uc;
                    }
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
        private void onDelete()
        {
            string trangThai = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();

            if (Validation())
            {
                KeToanProcess process = new KeToanProcess();
                try
                {
                    List <ClientResponseDetail>        listClientResponseDetail = new List <ClientResponseDetail>();
                    ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                    // Dữ liệu truyền vào và dữ liệu trả về

                    Mouse.OverrideCursor = Cursors.Wait;
                    if (GetDataForm() == 1)
                    {
                        if (process.HeThongTaiKhoanChiTiet(DatabaseConstant.Action.THEM, ref objHeThong, ref listClientResponseDetail) == ApplicationConstant.ResponseStatus.THANH_CONG)
                        {
                            CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                            this.onClose();
                        }
                        else
                        {
                            CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                finally
                {
                    Mouse.OverrideCursor = Cursors.Arrow;
                    process = null;
                }
            }
        }
Esempio n. 26
0
        public ApplicationConstant.ResponseStatus MaTranPheDuyet(DatabaseConstant.Action action,
                                                                 ref THONG_TIN_CHUNG objThongTinChung,
                                                                 ref List <BS_ResponseDetail> lstResponseDetail,
                                                                 ref HT_CNANG obj,
                                                                 ref ApplicationConstant.QuanTriHeThongResponseMessage responseMessage)
        {
            ApplicationConstant.ResponseStatus responseStatus = new ApplicationConstant.ResponseStatus();
            BS_ResponseDetail responseDetail = new BS_ResponseDetail();

            switch (action)
            {
            case DatabaseConstant.Action.LUU:     //Luu
                responseStatus = new BS_QuanTriHeThong_Action().MaTranPheDuyet_Luu(ref objThongTinChung, ref obj, ref responseMessage, ref responseDetail);
                break;

            default:
                responseStatus  = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                responseMessage = ApplicationConstant.QuanTriHeThongResponseMessage.M_ResponseMessage_QuanTriHeThong_KhongThanhCong;
                break;
            }
            lstResponseDetail.Add(responseDetail);
            return(responseStatus);
        }
Esempio n. 27
0
        /// <summary>
        /// Sau khi sửa
        /// </summary>
        /// <param name="ret"></param>
        private void afterModify(ApplicationConstant.ResponseStatus ret, HT_NHNSD obj, string responseMessage)
        {
            if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
            {
                LMessage.ShowMessage("M.DungChung.CapNhatThanhCong", LMessage.MessageBoxType.Information);

                id       = obj.ID;
                TthaiNvu = obj.TTHAI_NVU;

                lblTrangThai.Content = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);
                txtTrangThai.Text    = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);
                raddtNgayNhap.Value  = LDateTime.StringToDate(obj.NGAY_NHAP, "yyyyMMdd");
                txtNguoiLap.Text     = obj.NGUOI_NHAP;
                raddtNgayCNhat.Value = LDateTime.StringToDate(obj.NGAY_CNHAT, "yyyyMMdd");
                txtNguoiCapNhat.Text = obj.NGUOI_CNHAT;
                CommonFunction.RefreshButton(Toolbar, DatabaseConstant.Action.XEM, tthaiNvu, mnuMain, DatabaseConstant.Function.HT_NHNSD);

                formCase = "XEM";
                HideControl();
            }
            else
            {
                LMessage.ShowMessage(responseMessage, 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.QTHT,
                                                    DatabaseConstant.Function.HT_NHNSD,
                                                    DatabaseConstant.Table.HT_NHNSD,
                                                    DatabaseConstant.Action.SUA,
                                                    listLockId);
        }
Esempio n. 28
0
        /// <summary>
        /// Sau khi thêm mới
        /// </summary>
        /// <param name="ret"></param>
        private void afterAddNew(ApplicationConstant.ResponseStatus ret, HT_NHNSD obj, string responseMessage)
        {
            if (ret == ApplicationConstant.ResponseStatus.THANH_CONG)
            {
                LMessage.ShowMessage("M.DungChung.ThemThanhCong", LMessage.MessageBoxType.Information);

                if (cbMultiAdd.IsChecked == true)
                {
                    ResetForm();
                }
                else if (!DatabaseConstant.CLOSE_DETAIL_FORM)
                {
                    id       = obj.ID;
                    TthaiNvu = obj.TTHAI_NVU;

                    lblLabelTrangThai.Content = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);
                    txtTrangThai.Text         = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);
                    raddtNgayNhap.Value       = LDateTime.StringToDate(obj.NGAY_NHAP, "yyyyMMdd");
                    txtNguoiLap.Text          = obj.NGUOI_NHAP;
                    raddtNgayCNhat.Value      = LDateTime.StringToDate(obj.NGAY_CNHAT, "yyyyMMdd");
                    txtNguoiCapNhat.Text      = obj.NGUOI_CNHAT;
                    CommonFunction.RefreshButton(Toolbar, DatabaseConstant.Action.XEM, tthaiNvu, mnuMain, DatabaseConstant.Function.HT_NHNSD);

                    formCase = "XEM";
                    HideControl();
                }
                else
                {
                    onClose();
                }
            }
            else
            {
                LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Error);
            }
        }
Esempio n. 29
0
 private void Window_Closed(object sender, EventArgs e)
 {
     if (isProcess == true || _action == DatabaseConstant.Action.XOA)
     {
         Presentation.Process.KeToanProcess process           = new Presentation.Process.KeToanProcess();
         List <ClientResponseDetail>        lstResponseDetail = new List <ClientResponseDetail>();
         ApplicationConstant.ResponseStatus status            = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
         try
         {
             status = process.KiemSoatGiaoDich(GetFormData(), _action, ref lstResponseDetail);
             GetData(_action, status, lstResponseDetail);
         }
         catch (Exception ex)
         {
             LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
             LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
         }
         finally
         {
             ProcessUnlockData(_action);
             process = null;
         }
     }
 }
Esempio n. 30
0
        /// <summary>
        /// Chung cho thực hiện các thông tin, báo cáo in ngay
        /// </summary>
        /// <param name="maBaoCao"></param>
        /// <param name="listThamSoBaoCao"></param>
        public void LayDuLieu(string maBaoCao, List <ThamSoBaoCao> listThamSoBaoCao)
        {
            try
            {
                DatabaseConstant.Action action = DatabaseConstant.Action.IN;

                // Lấy thông tin báo cáo và tham số
                BaoCaoProcess        process        = new BaoCaoProcess();
                int                  idBaoCao       = 0;
                HT_BAOCAO            htBaoCao       = null;
                List <HT_BAOCAO_TSO> lstHtBaoCaoTso = null;
                process.LayThongTinBaoCao(idBaoCao, maBaoCao, ref htBaoCao, ref lstHtBaoCaoTso);

                List <HT_BAOCAO_TSO> listHtBaoCaoTso = lstHtBaoCaoTso;
                DataSet ds = new DataSet();

                // Chuẩn bị điều kiện cho báo cáo
                if (listThamSoBaoCao != null && listThamSoBaoCao.Count > 0)
                {
                    if (listHtBaoCaoTso.Where(t => t.LOAI_TSO == ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri() && t.MA_TSO.Equals("@DT_THAMSO")).Count() > 0)
                    {
                        listHtBaoCaoTso = new List <HT_BAOCAO_TSO>();
                        foreach (ThamSoBaoCao thamSoBaoCao in listThamSoBaoCao)
                        {
                            HT_BAOCAO_TSO tso = new HT_BAOCAO_TSO();
                            tso.MA_TSO   = thamSoBaoCao.MaThamSo;
                            tso.LOAI_TSO = thamSoBaoCao.LoaiThamSo;
                            tso.GTRI_TSO = thamSoBaoCao.GiaTriThamSo;
                            listHtBaoCaoTso.Add(tso);
                        }
                    }
                    else
                    {
                        foreach (HT_BAOCAO_TSO htBaoCaoTso in listHtBaoCaoTso)
                        {
                            foreach (ThamSoBaoCao thamSoBaoCao in listThamSoBaoCao)
                            {
                                if (htBaoCaoTso.MA_TSO.Equals(thamSoBaoCao.MaThamSo) &&
                                    htBaoCaoTso.LOAI_TSO.Equals(thamSoBaoCao.LoaiThamSo))
                                {
                                    htBaoCaoTso.GTRI_TSO = thamSoBaoCao.GiaTriThamSo;
                                    break;
                                }
                                if (!LObject.IsNullOrEmpty(thamSoBaoCao.DsThamSo))
                                {
                                    ds = thamSoBaoCao.DsThamSo;
                                }
                            }
                        }
                    }
                }
                else
                {
                    return;
                }

                ApplicationConstant.ResponseStatus retStatus = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                FileBase        fileResponse    = new FileBase();
                List <FileBase> lstFileResponse = new List <FileBase>();
                string          responseMessage = null;

                retStatus = process.LayDuLieu(htBaoCao, listHtBaoCaoTso, ref fileResponse, ref responseMessage, ds, action);

                if (retStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    string fileReport = ClientInformation.TempDir + "\\" + fileResponse.FileName + "." + fileResponse.FileFormat;;
                    LFile.WriteFileFromByteArray(fileResponse.FileData, fileReport);

                    // show file
                    Stream stream = LFile.ConvertByteArrayToStream(fileResponse.FileData);
                    System.Diagnostics.Process.Start(fileReport);
                }
                else
                {
                    LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Error);
                    return;
                }
            }
            catch (System.Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                GC.Collect();
                CommonFunction.ThongBaoLoi(ex);
            }
        }