Пример #1
0
        /// <summary>
        /// Thêm
        /// </summary>
        private void OnAddNew(List <DataRowView> lstDataRowView)
        {
            List <BC_MATK_MAPPING> lstObj = new List <BC_MATK_MAPPING>();

            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                KhaiThacDuLieuProcess       processKTDL = new KhaiThacDuLieuProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                string maTK      = getSeletedRowCTieu()["MATK"].ToString();
                string maLoaiTK  = getSeletedRowLoaiTK()["MA_LOAITK"].ToString();
                string loaiBCTK  = getSeletedRowLoaiTK()["LOAI_BCTK"].ToString();
                string maDviQly  = ClientInformation.MaDonVi;
                string maDviTao  = ClientInformation.MaDonViGiaoDich;
                string ngayNhap  = Convert.ToDateTime(DateTime.Today).ToString("yyyyMMdd");
                string nguoiNhap = ClientInformation.TenDangNhap;
                string ttBGhi    = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri();
                string ttNVu     = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();

                if (lstDataRowView.Count > 0)
                {
                    foreach (DataRowView drv in lstDataRowView)
                    {
                        BC_MATK_MAPPING obj = new BC_MATK_MAPPING();
                        obj.MA_MAPPING = drv["MA_DKIEN"].ToString();
                        obj.MATK       = maTK;
                        obj.MA_LOAITK  = maLoaiTK;
                        obj.LOAI_BCTK  = loaiBCTK;
                        obj.MA_DVI_QLY = maDviQly;
                        obj.MA_DVI_TAO = maDviTao;
                        obj.NGAY_NHAP  = ngayNhap;
                        obj.NGUOI_NHAP = nguoiNhap;
                        obj.TTHAI_BGHI = ttBGhi;
                        obj.TTHAI_NVU  = ttNVu;
                        lstObj.Add(obj);
                    }
                }
                else
                {
                    BC_MATK_MAPPING obj = new BC_MATK_MAPPING();
                    obj.MATK        = maTK;
                    obj.MA_LOAITK   = maLoaiTK;
                    obj.TTHAI_LY_DO = "UncheckAll";
                    lstObj.Add(obj);
                }

                ret = processKTDL.Mapping(DatabaseConstant.Action.THEM, ref lstObj, ref listClientResponseDetail);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
 private void ShowData()
 {
     try
     {
         // Lấy dữ liệu từ form điều kiện
         List <HT_BAOCAO_TSO>    listHtBaoCaoTso = new List <HT_BAOCAO_TSO>();
         DatabaseConstant.Action action          = DatabaseConstant.Action.TRUY_VAN;
         DataSet ds = null;
         // 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();
         string      responseMessage = "";
         if (idBaoCao > 0)
         {
             MethodInfo mi             = uc.GetType().GetMethod("GetParameters");
             Delegate   dieuKienBaoCao = Delegate.CreateDelegate(typeof(DieuKienBaoCao), uc, mi);
             if (!LObject.IsNullOrEmpty(dieuKienBaoCao))
             {
                 KhaiThacDuLieuProcess          process           = new KhaiThacDuLieuProcess();
                 DieuKienBaoCao                 dlgdieukienBaoCao = (DieuKienBaoCao)dieuKienBaoCao;
                 List <Tuple <string, string> > dsDieuKienBC;
                 dlgdieukienBaoCao(out dsDieuKienBC);
                 foreach (Tuple <string, string> tuple in dsDieuKienBC)
                 {
                     HT_BAOCAO_TSO tso = new HT_BAOCAO_TSO();
                     tso.MA_TSO   = tuple.Item2;
                     tso.LOAI_TSO = ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri();
                     tso.GTRI_TSO = tuple.Item1;
                     listHtBaoCaoTso.Add(tso);
                 }
                 if (process.DuLieuChiTieu(action, idBaoCao, ref htBaoCao, ref listHtBaoCaoTso, ref ds, ref responseMessage) == ApplicationConstant.ResponseStatus.THANH_CONG)
                 {
                     mi = uc.GetType().GetMethod("BuildData");
                     Delegate buildDLBaoCao = Delegate.CreateDelegate(typeof(BuildDuLieuBaoCao), uc, mi);
                     if (!LObject.IsNullOrEmpty(buildDLBaoCao))
                     {
                         BuildDuLieuBaoCao dlgbuildDLBaoCao = (BuildDuLieuBaoCao)buildDLBaoCao;
                         dlgbuildDLBaoCao(ds);
                     }
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         CommonFunction.ThongBaoLoi(ex);
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
     }
 }
        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 grvDanhSachHDV_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         Mouse.OverrideCursor = Cursors.Wait;
         DataRowView drv = (DataRowView)grvDanhSachHDV.SelectedItem;
         DataSet     ds  = new KhaiThacDuLieuProcess().GetThongTinGiaoDichTietKiem(Convert.ToInt32(drv["ID"]), drv["SO_SO_TG"].ToString());
         if (!LObject.IsNullOrEmpty(ds.Tables) && ds.Tables.Count > 0)
         {
             grvHuyDongGD.ItemsSource = ds.Tables["DANHSACH.GIAODICH"].DefaultView;
         }
     }
     catch (System.Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
         LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
     }
     finally
     {
         Mouse.OverrideCursor = Cursors.Arrow;
     }
 }
Пример #5
0
        public void OnModify(BC_MATK obj)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                KhaiThacDuLieuProcess       processKTDL = new KhaiThacDuLieuProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                ret = processKTDL.MaTK(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;
            }
        }
Пример #6
0
 public void OnDelete()
 {
     Mouse.OverrideCursor = Cursors.Wait;
     try
     {
         bool ret = false;
         List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
         KhaiThacDuLieuProcess       processKTDL = new KhaiThacDuLieuProcess();
         obj.ID        = ID;
         obj.MA_LOAITK = MA_LOAITK;
         ret           = processKTDL.LoaiTK(DatabaseConstant.Action.XOA, ref obj, ref listClientResponseDetail);
         AfterDelete(ret, listClientResponseDetail);
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
         throw ex;
     }
     finally
     {
         Mouse.OverrideCursor = Cursors.Arrow;
     }
 }
 /// <summary>
 /// Sự kiện double click trên data grid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void grKhachHangDS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         Mouse.OverrideCursor = Cursors.Wait;
         DataRowView drv = (DataRowView)grKhachHangDS.SelectedItem;
         DataSet     ds  = new KhaiThacDuLieuProcess().GetThongTinCoBanKhachHang(Convert.ToInt32(drv["ID"]), drv["MA_KHANG"].ToString());
         txtMaKhachHangGD.Text   = drv["MA_KHANG"].ToString();
         txtTenKhachHangGD.Text  = drv["TEN_KHANG"].ToString();
         txtMaKhachHangTD.Text   = drv["MA_KHANG"].ToString();
         txtTenKhachHangTD.Text  = drv["TEN_KHANG"].ToString();
         txtMaKhachHangHDV.Text  = drv["MA_KHANG"].ToString();
         txtTenKhachHangHDV.Text = drv["TEN_KHANG"].ToString();
         if (!LObject.IsNullOrEmpty(ds.Tables) && ds.Tables.Count > 0)
         {
             grKhachHangGD.ItemsSource   = ds.Tables["DANHSACH.GIAODICH"].DefaultView;
             grvDanhSachHDTD.ItemsSource = ds.Tables["DANHSACH.HDTDVM"].DefaultView;
             grvDanhSachHDV.ItemsSource  = ds.Tables["DANHSACH.SOTK"].DefaultView;
             tiTinDung.IsSelected        = true;
         }
     }
     catch (System.Exception ex)
     {
         grKhachHangGD.ItemsSource   = null;
         grvDanhSachHDTD.ItemsSource = null;
         grvDanhSachHDV.ItemsSource  = null;
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
         LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error);
     }
     finally
     {
         grvKheUocGD.ItemsSource     = null;
         grvDanhSachKUVM.ItemsSource = null;
         grvHuyDongGD.ItemsSource    = null;
         Mouse.OverrideCursor        = Cursors.Arrow;
     }
 }
        private void BuildGridBaoCao()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                DataTable dtBaoCao = new DataTable();
                dtBaoCao.Columns.Add("ID", typeof(int));
                dtBaoCao.Columns.Add("STT", typeof(string));
                dtBaoCao.Columns.Add("Mã chỉ tiêu", typeof(string));
                dtBaoCao.Columns.Add("Tên chỉ tiêu", typeof(string));
                dtBaoCao.Columns.Add("ID_CHA", typeof(int));
                int sttCha = 0;
                int sttCon = 0;

                //string maPhanHeBaoCao = ClientInformation.FormCase;
                string maPhanHeBaoCao                       = "KTDL_DM";
                KhaiThacDuLieuProcess process               = new KhaiThacDuLieuProcess();
                ApplicationConstant.ResponseStatus ret      = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                List <HT_BAOCAO>        lstBaoCaoTheoPhanHe = new List <HT_BAOCAO>();
                DatabaseConstant.Action action              = DatabaseConstant.Action.TRUY_VAN;
                string responseMessage                      = "";

                ret = process.DanhSachChiTieu(action, maPhanHeBaoCao, ref lstBaoCaoTheoPhanHe, ref responseMessage);
                if (ret == ApplicationConstant.ResponseStatus.THANH_CONG && lstBaoCaoTheoPhanHe.Count > 0)
                {
                    List <HT_BAOCAO> lstBaoCaoCha = lstBaoCaoTheoPhanHe.Where(e => e.ID_BAOCAO_CHA == null).ToList();
                    foreach (var itemCha in lstBaoCaoCha)
                    {
                        DataRow rCha = dtBaoCao.NewRow();
                        sttCha  = sttCha + 1;
                        rCha[0] = itemCha.ID_BAOCAO;
                        rCha[1] = sttCha.ToString();
                        rCha[2] = itemCha.MA_BAOCAO;
                        rCha[3] = itemCha.TEN_BAOCAO;
                        rCha[4] = 0;
                        dtBaoCao.Rows.Add(rCha);
                        sttCon = 0;
                        foreach (var item in lstBaoCaoTheoPhanHe)
                        {
                            if (item.ID_BAOCAO_CHA == itemCha.ID_BAOCAO)
                            {
                                DataRow rCon = dtBaoCao.NewRow();
                                sttCon  = sttCon + 1;
                                rCon[0] = item.ID_BAOCAO;
                                rCon[1] = sttCha.ToString() + "." + sttCon.ToString();
                                rCon[2] = item.MA_BAOCAO;
                                rCon[3] = "     " + item.TEN_BAOCAO;
                                rCon[4] = item.ID_BAOCAO_CHA;
                                dtBaoCao.Rows.Add(rCon);
                            }
                            else
                            {
                            }
                        }
                        // đổ source lên lưới
                        grDSBaoCao.ItemsSource = dtBaoCao.DefaultView;
                    }
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
Пример #9
0
        private void SetFormData()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                KhaiThacDuLieuProcess       processKTDL = new KhaiThacDuLieuProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                obj    = new BC_MATK();
                obj.ID = ID;

                ret = processKTDL.MaTK(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);

                    cmbLoaiTK.SelectedIndex = lstSourceLoaiTK.IndexOf(lstSourceLoaiTK.FirstOrDefault(i => i.KeywordStrings[0].ToString().Equals(obj.MA_LOAITK.ToString())));

                    txtMaTK.Text  = obj.MA_LOAITK;
                    txtTenTK.Text = obj.TEN_MATK;
                    #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;
            }
        }