Пример #1
0
        public UnitModelDieuChinh BuildSessionDieuChinhPHNC(string ThongTinBaoId = null,string DieuChinhKHXBDetailId= null)
        {
            BDieuChinhPHNCBussiness dbDieuChinhPHNC = new BDieuChinhPHNCBussiness();
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();

            if (HttpContext.Cache[Application.Session.UnitModelDieuChinh] == null)
            {
                objUnitNew = InsertCacheDieuChinhPHNC().getModel();
            }
            else
            {
                objUnitNew = (HttpContext.Cache[Application.Session.UnitModelDieuChinh] as UnitModelDieuChinh).getModel();
            }
            if (!String.IsNullOrWhiteSpace(ThongTinBaoId))
            {
                List<BPhanHuongNhuCauUnit> lstPHNC = dbDieuChinhPHNC.getAllPHNCByThongTinBaoIdConfig(ThongTinBaoId);
                List<BPhanHuongNhuCauDistrict> lstDistrict = dbDieuChinhPHNC.getAllDistrictPHNCByThongTinBaoIdConfig(ThongTinBaoId);
                objUnitNew.setListPHNC(lstPHNC, lstDistrict);

                if (!string.IsNullOrWhiteSpace(DieuChinhKHXBDetailId))
                {
                    List<BDieuChinhPhanHuongUnit> _lstPHNC = dbDieuChinhPHNC.getAllPHNCByDieuChinhKHXBDetailIdConfig(DieuChinhKHXBDetailId);
                    List<BDieuChinhPhanHuongDistrict> _lstDistrict = dbDieuChinhPHNC.getAllDistrictPHNCByDieuChinhKHXBDetailIdConfig(DieuChinhKHXBDetailId);
                    objUnitNew.setListDieuChinhPHNC(_lstPHNC, _lstDistrict);
                }
            }
            return objUnitNew;
        }
Пример #2
0
        private UnitModelDieuChinh InsertCacheDieuChinhPHNC()
        {
            BDieuChinhPHNCBussiness dbDieuChinhPHNC = new BDieuChinhPHNCBussiness();
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            List<v_Unit> lstVUnit = dbDieuChinhPHNC.getAllVunit();
            List<Province> lstAllPrv = dbDieuChinhPHNC.getAllProvince();
            List<BDiemTiepNhan> lstDTN = dbDieuChinhPHNC.getAllDiemTiepNhan();
            objUnitNew = new UnitModelDieuChinh(lstVUnit, lstAllPrv, lstDTN);
            List<BPhanHuongNhuCauUnit> lstPHNC = dbDieuChinhPHNC.getAllPHNCByThongTinBaoIdConfig();
            List<BPhanHuongNhuCauDistrict> lstDistrict = dbDieuChinhPHNC.getAllDistrictPHNCByThongTinBaoIdConfig();
            objUnitNew.setListPHNC(lstPHNC, lstDistrict);
            HttpContext.Cache[Application.Session.UnitModelDieuChinh] = objUnitNew;
            HttpContext.Cache["Default"] = objUnitNew;

            return objUnitNew;
        }