Exemplo n.º 1
0
        private List <string> XuLy(string listitem, DatabaseConstant.Action action, string alert)
        {
            List <string> listResult = new List <string>();
            List <ClientResponseDetail> lstResponse = new List <ClientResponseDetail>();

            if (listitem != "")
            {
                List <KT_PLOAI> lstKtPloai = new List <KT_PLOAI>();
                string[]        str        = listitem.Split(';');
                if (str != null && str.Length > 0)
                {
                    for (int k = 0; k < str.Length; k++)
                    {
                        KT_PLOAI obj = new KT_PLOAI();
                        obj.ID = Convert.ToInt32(str[k]);
                        lstKtPloai.Add(obj);
                    }
                }

                bool bResult = new KeToanProcess().XuLyPhanLoaiTaiKhoanDS(lstKtPloai.ToArray(), ref lstResponse, action);
                if (bResult)
                {
                    foreach (ClientResponseDetail cl in lstResponse)
                    {
                        listResult.Add(LanguageEngine.Instance().GetContent(LanguageType.TypeMessage, cl.Result) + "#" + LanguageEngine.Instance().GetContent(LanguageType.TypeMessage, cl.Detail.Split('#')[0]));
                    }
                }
                else
                {
                    listResult.Add(alert + "#" + LanguageEngine.Instance().GetContent(LanguageType.TypeMessage, "M.DungChung.DuyetKhongThanhCong"));
                }
            }
            return(listResult);
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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;
            }
        }