예제 #1
0
        /// <summary>
        /// Xử lý xóa dữ liệu
        /// </summary>
        private void Xoa()
        {
            try
            {
                KeToanProcess               process     = new KeToanProcess();
                List <KT_PLOAI>             lstKtPloai  = new List <KT_PLOAI>();
                List <ClientResponseDetail> lstResponse = new List <ClientResponseDetail>();

                Mouse.OverrideCursor = Cursors.Wait;
                try
                {
                    for (int i = 0; i < raddgrPhanLoaiTK.Items.Count; i++)
                    {
                        DataRowView dr = (DataRowView)raddgrPhanLoaiTK.Items[i];
                        if (Convert.ToBoolean(dr["CHON"]) == true)
                        {
                            KT_PLOAI obj = new KT_PLOAI();
                            obj.ID       = Convert.ToInt32(dr["ID"]);
                            obj.MA_PLOAI = dr["MA_PLOAI"].ToString();
                            lstKtPloai.Add(obj);
                        }
                    }

                    if (lstKtPloai.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)
                    {
                        bool ret = process.XuLyPhanLoaiTaiKhoanDS(lstKtPloai.ToArray(), ref lstResponse, DatabaseConstant.Action.XOA);
                        if (!ret)
                        {
                            LMessage.ShowMessage("M.DungChung.XoaKhongThanhCong", LMessage.MessageBoxType.Warning);
                        }
                        else
                        {
                            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);
            }
        }
예제 #2
0
        private void ThoaiDuyet()
        {
            try
            {
                KeToanProcess               process     = new KeToanProcess();
                List <KT_PLOAI>             lstKtPloai  = new List <KT_PLOAI>();
                List <ClientResponseDetail> lstResponse = new List <ClientResponseDetail>();
                lstLyDo = new List <TTHAI_LY_DO>();
                Mouse.OverrideCursor = Cursors.Wait;
                try
                {
                    for (int i = 0; i < raddgrPhanLoaiTK.Items.Count; i++)
                    {
                        DataRowView dr = (DataRowView)raddgrPhanLoaiTK.Items[i];
                        if (Convert.ToBoolean(dr["CHON"]) == true)
                        {
                            KT_PLOAI obj = new KT_PLOAI();
                            obj.ID       = Convert.ToInt32(dr["ID"]);
                            obj.MA_PLOAI = dr["MA_PLOAI"].ToString();
                            lstKtPloai.Add(obj);
                            TTHAI_LY_DO objTThai = new TTHAI_LY_DO();
                            objTThai.ID  = Convert.ToInt32(dr["ID"]);
                            objTThai.MA  = dr["MA_PLOAI"].ToString();
                            objTThai.TEN = dr["TEN_PLOAI"].ToString();
                            lstLyDo.Add(objTThai);
                        }
                    }
                    if (lstKtPloai.Count == 0)
                    {
                        LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning);
                        return;
                    }

                    MessageBoxResult messResult = LMessage.ShowMessage("M.DungChung.HoiThoaiDuyet", LMessage.MessageBoxType.Question);
                    if (messResult == MessageBoxResult.Yes)
                    {
                        ucLyDo lydo = new ucLyDo(lstLyDo);
                        lydo.DuLieuTraVe = new ucLyDo.LayDuLieu(LayDuLieuLyDo);
                        Window win = new Window();
                        //win.Title = "Danh sách mã phân loại tài khoản";
                        win.Content = lydo;
                        win.Title   = LLanguage.SearchResourceByKey("U.KeToan.KiemSoat.frmLyDo.LyDo") + "-" + LLanguage.SearchResourceByKey("U.DungChung.Button.ThoaiDuyet");
                        win.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                        win.ShowDialog();
                        lstKtPloai.ForEach(f => f.TTHAI_LY_DO = lstLyDo.FirstOrDefault(g => g.ID == f.ID).LY_DO);
                        bool ret = process.XuLyPhanLoaiTaiKhoanDS(lstKtPloai.ToArray(), ref lstResponse, DatabaseConstant.Action.THOAI_DUYET);
                        if (!ret)
                        {
                            LMessage.ShowMessage("M.DungChung.ThoaiDuyetKhongThanhCong", LMessage.MessageBoxType.Warning);
                        }
                        else
                        {
                            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);
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }