Ejemplo n.º 1
0
        // GET: Admin/PHNC/Create
        public ActionResult Create(string ThongTinBaoId, string provincecode)
        {
            BPhanHuongNhuCauUnitModel objPHNC = new BPhanHuongNhuCauUnitModel();
            bindCombobox(1);
            ViewBag.ThongTinBaoId = ThongTinBaoId;

            //check session unitmodel
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            objUnitNew = BuildSessionDieuChinhPHNC(ThongTinBaoId);
            List<TinhThanh> lstTinh = objUnitNew.getAllProvinceNotMap(provincecode);
            if (!string.IsNullOrWhiteSpace(provincecode))
            {
                ViewBag.CheckPrv = true;
                ViewBag.QuanHuyen = objUnitNew.getDistrictNotMapByProvinceCode(provincecode);
                Session["ProvinceCode"] = provincecode;
            }
            else
            {
                if (Session["ProvinceCode"] != null)
                {
                    Session["ProvinceCode"] = null;
                }
            }
            ViewBag.ProvinceComment = "huyện chưa thiết lập phân hướng nhu cầu xong";
            TempData["DistrictComment"] = "bưu cục chưa thiết lập phân hướng nhu cầu";
            TempData["TypeUnit"] = "1";
            ViewBag.Province = lstTinh;

            if (HttpContext.Request.IsAjaxRequest())
                return PartialView("_DiemTiepNhan", objPHNC);
            return View(objPHNC);
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
 public ActionResult LoadUnit(string districtcode)
 {
     UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
     List<v_Unit> lstUnit = new List<v_Unit>();
     if (Session[Application.Session.UnitModelDieuChinh] != null)
     {
         objUnitNew = (UnitModelDieuChinh)Session[Application.Session.UnitModelDieuChinh];
         lstUnit = objUnitNew.lstQuanHuyen.FirstOrDefault(t => t.DistrictCode.Equals(districtcode)).lstUnit;
     }
     return PartialView("_LoadUnit", lstUnit);
 }
Ejemplo n.º 4
0
 public ActionResult LoadDistrict(string provincecode)
 {
     UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
     List<QuanHuyen> lstQuanHuyen = new List<QuanHuyen>();
     if (Session[Application.Session.UnitModelDieuChinh] != null)
     {
         objUnitNew = (UnitModelDieuChinh)Session[Application.Session.UnitModelDieuChinh];
         lstQuanHuyen = objUnitNew.lstTinhThanh.FirstOrDefault(t => t.ProvinceCode.Equals(provincecode)).lstQuanHuyen;
     }
     return PartialView("_LoadDistrict", lstQuanHuyen);
 }
Ejemplo n.º 5
0
        public ActionResult LoadProvince(string objid, string objname)
        {
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            List<TinhThanh> lstTinhThanh = new List<TinhThanh>();
            TempData["ObjId"] = objid;
            TempData["ObjName"] = objname;

            if (Session[Application.Session.UnitModelDieuChinh] != null)
            {
                objUnitNew = (UnitModelDieuChinh)Session[Application.Session.UnitModelDieuChinh];
                lstTinhThanh = objUnitNew.lstTinhThanh;
            }
            return PartialView("_LoadProvince", lstTinhThanh);
        }
Ejemplo n.º 6
0
        public ActionResult LoadUnitDieuChinhPHNC(string lstUnit, string DieuChinhKHXBDetailId, string typestr)
        {
            string[] lstids = lstUnit.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);

            //check session unitmodel
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            //check session để xem thông tin
            objUnitNew = BuildSessionDieuChinhPHNC(DieuChinhKHXBDetailId);
            List<v_Unit> units = new List<v_Unit>();
            //typestr : 1: getUnitNotMap, 2: getUnitMap
            if (string.IsNullOrWhiteSpace(typestr) || typestr == "1")
            {
                units = objUnitNew.getUnitNotMap(lstids, "2");
            }
            else if (!string.IsNullOrWhiteSpace(typestr) && typestr == "2")
            {
               units = objUnitNew.getUnitMap(lstids, "2");
            }
            return PartialView("_inputFormBuuCuc", units);
        }
Ejemplo n.º 7
0
        public ActionResult LoadDistrictDieuChinhPHNC(string lstTinh, string DieuChinhKHXBDetailId, string typeid)
        {
            string[] lstids = lstTinh.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            //check session unitmodel
               UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            //check session để xem thông tin
            objUnitNew = BuildSessionDieuChinhPHNC(DieuChinhKHXBDetailId);
            List<QuanHuyen> lstPrv = new List<QuanHuyen>();
            lstPrv = objUnitNew.getDistrictNotMap(lstids, typeid);
            TempData["TypeUnit"] = "1";
            TempData["DistrictComment"] = "bưu cục chưa thiết lập phân hướng nhu cầu";

            return PartialView("_inputFormHuyen", lstPrv);
        }
Ejemplo n.º 8
0
        // GET: Admin/PHNC
        public ActionResult IndexDieuChinhPHNC(string ThongTinBaoId, string DieuChinhKHXBDetailId, string pageIndex = "")
        {
            BDieuChinhPhanHuongUnitModel objPHNC = new BDieuChinhPhanHuongUnitModel();
            BDieuChinhKHXBDetail objDetail = dbDieuChinhPHNC.getDieuChinhDetailById(DieuChinhKHXBDetailId);
            if (!string.IsNullOrWhiteSpace(DieuChinhKHXBDetailId))
            {
                objPHNC.ThongTinBaoId = objDetail.BDieuChinhKHXB.ThongTinBaoId;
                objPHNC.DieuChinhKHXBDetailId = objDetail.Id;
                objPHNC.SoBao = objDetail.SoBao;
            }

            //check session unitmodel
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            objUnitNew = BuildSessionDieuChinhPHNC(DieuChinhKHXBDetailId);
            List<TinhThanh> lstTinh = objUnitNew.getAllProvince();
            ViewBag.ThongTinDetail = objDetail;
            if (HttpContext.Request.IsAjaxRequest())
                return PartialView("_PHNCView", lstTinh);
            return View(lstTinh);
        }
Ejemplo n.º 9
0
 public ActionResult EditPHNCDieuChinhPHNC([Bind(Include = "Id,DieuChinhKHXBDetailId,SoBao,Nam,Quy,UnitCode,ThongTinBaoId,DieuChinhKHXBDetailId,DiemTiepNhanId,CreateDate,CreateBy")] BDieuChinhPhanHuongUnitModel BDieuChinhPhanHuongUnit)
 {
     UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
     if (ModelState.IsValid)
     {
         BDieuChinhPhanHuongUnit.ModifyDate = DateTime.Now;
         BDieuChinhPhanHuongUnit.ModifyBy = userInfo.Id;
         dbDieuChinhPHNC.Update(BDieuChinhPhanHuongUnit.toBDieuChinhPhanHuongUnit());
         objUnitNew = BuildSessionDieuChinhPHNC(BDieuChinhPhanHuongUnit.ThongTinBaoId);
         string[] lstids = { BDieuChinhPhanHuongUnit.UnitCode };
         List<v_Unit> lstUnits = objUnitNew.getUnitMap(lstids, "3");
         objUnitNew.UpdateListUnitMap(lstUnits, BDieuChinhPhanHuongUnit.DiemTiepNhanId);
         buildMessage("Bạn đã sửa thông tin phân hướng thành công");
         return RedirectToAction("Details" + subAction, new { DieuChinhKHXBDetailId = BDieuChinhPhanHuongUnit.DieuChinhKHXBDetailId, districtcode = lstUnits.FirstOrDefault().DistrictCode });
     }
     bindComboboxDieuChinhPHNC(0, BDieuChinhPhanHuongUnit.toBDieuChinhPhanHuongUnit());
     ViewBag.UnitCode = new SelectList(dbDieuChinhPHNC.getAllUnit(), "UnitCode", "UnitName", BDieuChinhPhanHuongUnit.UnitCode);
     buildMessage("Bạn đã sửa thông tin phân hướng thât bại !");
     return View(BDieuChinhPhanHuongUnit);
 }
Ejemplo n.º 10
0
 // GET: Admin/PHNC/Edit/5
 public ActionResult EditPHNCDieuChinhPHNC(string id)
 {
     string districtcode = "";
     UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     BDieuChinhPhanHuongUnit BDieuChinhPhanHuongUnit = dbDieuChinhPHNC.getById(id);
     if (BDieuChinhPhanHuongUnit == null)
     {
         buildMessage("Bưu cục chưa được cấu hình riêng nên không thể chỉnh sửa !");
         return Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString());
     }
     bindComboboxDieuChinhPHNC(1, BDieuChinhPhanHuongUnit);
     ViewBag.UnitCode = new SelectList(dbDieuChinhPHNC.getAllUnit(), "UnitCode", "UnitName", BDieuChinhPhanHuongUnit.UnitCode);
     string[] lstids = { BDieuChinhPhanHuongUnit.UnitCode };
     objUnitNew = BuildSessionDieuChinhPHNC(BDieuChinhPhanHuongUnit.DieuChinhKHXBDetailId);
     List<v_Unit> lstUnits = objUnitNew.getUnitMap(lstids, "3");
     districtcode = lstUnits.FirstOrDefault().DistrictCode;
     ViewBag.DistrictCodeDetail = districtcode;
     return View(new BDieuChinhPhanHuongUnitModel(BDieuChinhPhanHuongUnit));
 }
Ejemplo n.º 11
0
        public ActionResult EditDieuChinhPHNC([Bind(Include = "Id,UnitCode,DieuChinhKHXBDetailId,DiemTiepNhanId,CreateDate,CreateBy")] BDieuChinhPhanHuongUnit BDieuChinhPhanHuongUnit, string listId, string typeid)
        {
            string DieuChinhKHXBDetailId = null;
            //check session unitmodel
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            List<v_Unit> lstUnits = new List<v_Unit>();
            List<QuanHuyen> lstQuanHuyen = new List<QuanHuyen>();
            string currentprv = "";
            if (ModelState.IsValid)
            {
                DieuChinhKHXBDetailId = BDieuChinhPhanHuongUnit.DieuChinhKHXBDetailId;
                objUnitNew = BuildSessionDieuChinhPHNC(DieuChinhKHXBDetailId);
                //lstids typeid: 1: list province, 2: list district, 3: list unit
                string[] lstids = listId.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                if (lstids.Count() == 0)
                {
                    return this.Json(new { MSG = "Bạn chưa chọn quận huyện hay bưu cục nào !" });
                }
                if (!string.IsNullOrWhiteSpace(typeid) && typeid == "3")
                {
                    lstUnits = objUnitNew.getUnitMap(lstids, typeid);
                    //get current province to back
                    currentprv = lstUnits.Select(t => t.ProvinceCode).FirstOrDefault();
                    //bind data
                    BDieuChinhPhanHuongUnit.CreateBy = userInfo.Id;
                    BDieuChinhPhanHuongUnit.CreateDate = DateTime.Now;
                    BDieuChinhPhanHuongUnit.ModifyBy = userInfo.Id;
                    BDieuChinhPhanHuongUnit.ModifyDate = DateTime.Now;
                    BDieuChinhPhanHuongUnit.DieuChinhKHXBDetailId = DieuChinhKHXBDetailId;
                    //add action
                    dbDieuChinhPHNC.Add(BDieuChinhPhanHuongUnit, lstUnits);
                    //remap unit lai cho object
                    objUnitNew.UpdateListUnitMap(lstUnits, BDieuChinhPhanHuongUnit.DiemTiepNhanId);
                    Session[Application.Session.UnitModelDieuChinh] = objUnitNew;
                }
                else if (!string.IsNullOrWhiteSpace(typeid))
                {
                    lstQuanHuyen = objUnitNew.getDistrictMap(lstids, typeid);
                    currentprv = lstQuanHuyen.FirstOrDefault().ProvinceCode;
                    BDieuChinhPhanHuongDistrictModel bDieuChinhPhanHuongDistrict = new BDieuChinhPhanHuongDistrictModel();
                    //bind data for district
                    bDieuChinhPhanHuongDistrict.DiemTiepNhanId = BDieuChinhPhanHuongUnit.DiemTiepNhanId;
                    bDieuChinhPhanHuongDistrict.ThongTinBaoId = BDieuChinhPhanHuongUnit.ThongTinBaoId;
                    bDieuChinhPhanHuongDistrict.DieuChinhKHXBDetailId = DieuChinhKHXBDetailId;
                    bDieuChinhPhanHuongDistrict.CreateBy = userInfo.Id;
                    bDieuChinhPhanHuongDistrict.CreateDate = DateTime.Now;
                    bDieuChinhPhanHuongDistrict.ModifyBy = userInfo.Id;
                    bDieuChinhPhanHuongDistrict.ModifyDate = DateTime.Now;
                    //add action
                    dbDieuChinhPHNC.AddDistrict(bDieuChinhPhanHuongDistrict.toBDieuChinhPhanHuongDistrict(), lstQuanHuyen);
                    //map lai list vua tao cho object
                    objUnitNew.UpdateListDistrictMap(lstQuanHuyen, bDieuChinhPhanHuongDistrict.DiemTiepNhanId);
                    Session[Application.Session.UnitModelDieuChinh] = objUnitNew;
                }
                buildMessage("Bạn đã sửa thông tin phân hướng thành công .");
                return RedirectToAction("Edit" + subAction, new { provincecode = currentprv, DieuChinhKHXBDetailId = DieuChinhKHXBDetailId });
            }

            buildMessage("Bạn đã sửa thông tin phân hướng thât bại !");
            return RedirectToAction("Edit" + subAction, new { provincecode = currentprv, DieuChinhKHXBDetailId = DieuChinhKHXBDetailId });
        }
Ejemplo n.º 12
0
        // GET: Admin/PHNC/Edit/5?provinecode=1
        public ActionResult EditDieuChinhPHNC(string provincecode, string DieuChinhKHXBDetailId)
        {
            //ViewBag.DTNBC = dbDieuChinhPHNC.getAllData(userInfo.UnitCode, DieuChinhKHXBDetailId);
            BDieuChinhPhanHuongUnitModel objPHNC = new BDieuChinhPhanHuongUnitModel();
            bindComboboxDieuChinhPHNC(1);
            ViewBag.DieuChinhKHXBDetailId = DieuChinhKHXBDetailId;
            if (!string.IsNullOrWhiteSpace(DieuChinhKHXBDetailId))
            {
                BDieuChinhKHXBDetail objDetail = dbDieuChinhPHNC.getDieuChinhDetailById(DieuChinhKHXBDetailId);
                objPHNC.DieuChinhKHXBDetailId = objDetail.Id;
            }

            //check session unitmodel
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            objUnitNew = BuildSessionDieuChinhPHNC(DieuChinhKHXBDetailId);
            List<QuanHuyen> lstHuyen = objUnitNew.getDistrictMapByProvinceCode(provincecode);

            TempData["TypeUnit"] = "2";
            TempData["DistrictComment"] = "bưu cục đã thiết lập phân hướng nhu cầu";

            ViewBag.QuanHuyen = lstHuyen;
            return View(objPHNC);
        }
Ejemplo n.º 13
0
        // GET: Admin/PHNC/Details/5
        public ActionResult DetailsDieuChinhPHNC(string provincecode, string districtcode, string DieuChinhKHXBDetailId)
        {
            BDieuChinhPhanHuongUnitModel objPHNC = new BDieuChinhPhanHuongUnitModel();
            if (!string.IsNullOrWhiteSpace(DieuChinhKHXBDetailId))
            {
                BDieuChinhKHXBDetail objDetail = dbDieuChinhPHNC.getDieuChinhDetailById(DieuChinhKHXBDetailId);
                objPHNC.DieuChinhKHXBDetailId = objDetail.Id;
                objPHNC.ThongTinBaoId = objDetail.BDieuChinhKHXB.ThongTinBaoId;
                ViewBag.DieuChinhKHXBDetailId = DieuChinhKHXBDetailId;
            }

            //check session unitmodel
            UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
            objUnitNew = BuildSessionDieuChinhPHNC(DieuChinhKHXBDetailId);
            List<QuanHuyen> lstHuyen = new List<QuanHuyen>();
            if(!String.IsNullOrWhiteSpace(provincecode))
            {
                lstHuyen = objUnitNew.getDistrictMapByProvinceCode(provincecode);
                ViewBag.UnitForm = "0";
            }
            else if (!String.IsNullOrWhiteSpace(districtcode))
            {
                lstHuyen = objUnitNew.getDistrictMapByDistrictCode(districtcode);
                ViewBag.UnitForm = "1";
                ViewBag.ProvinceCodeDetail = lstHuyen.FirstOrDefault().ProvinceCode;
            }
            ViewBag.ProvinceCode = provincecode;
            return View(lstHuyen.OrderBy(t => t.DistrictName));
        }
Ejemplo n.º 14
0
 public UnitModelDieuChinh getModel()
 {
     UnitModelDieuChinh result = new UnitModelDieuChinh();
     result.lstTinhThanh = Utils.DeepClone(this.lstTinhThanh);
     result.lstQuanHuyen = Utils.DeepClone(this.lstQuanHuyen);
     result.ThongTinBaoId = this.ThongTinBaoId;
     result.lstUnit = this.lstUnit;
     result.lstProvince = this.lstProvince;
     result.lstPHNC = Utils.DeepClone(this.lstPHNC);
     result.lstDTN = this.lstDTN;
     return result;
 }
Ejemplo n.º 15
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;
        }
Ejemplo n.º 16
0
 // GET: Bao/DieuChinhPHNC
 public ActionResult Index(string ThongTinBaoId)
 {
     //check session unitmodel
     UnitModelDieuChinh objUnitNew = new UnitModelDieuChinh();
     objUnitNew = BuildSessionDieuChinhPHNC(ThongTinBaoId);
     List<TinhThanh> lstTinh = objUnitNew.getAllProvince();
     ViewBag.ThongTinBaoId = ThongTinBaoId;
     if (HttpContext.Request.IsAjaxRequest())
         return PartialView("_PHNCView", lstTinh);
     return View(lstTinh);
 }