Esempio n. 1
0
        // GET: Admin/PHNC/Create
        public ActionResult CreateDieuChinhPHNC(string ThongTinBaoId, string DieuChinhKHXBDetailId, string provincecode)
        {
            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(ThongTinBaoId, DieuChinhKHXBDetailId);
            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);
        }
Esempio n. 2
0
        public ActionResult CreateDieuChinhPHNC([Bind(Include = "Id,ThongTinBaoId,DieuChinhKHXBDetailId,DiemTiepNhanId")] BDieuChinhPhanHuongUnitModel BDieuChinhPhanHuongUnit, string listId, string typeid)
        {
            if (ModelState.IsValid)
            {
                //check session unitmodel
                string DieuChinhKHXBDetailId = BDieuChinhPhanHuongUnit.DieuChinhKHXBDetailId;
                UnitModelDieuChinh objUnitNew = BuildSessionDieuChinhPHNC(BDieuChinhPhanHuongUnit.ThongTinBaoId, DieuChinhKHXBDetailId);
                List<v_Unit> lstUnits = new List<v_Unit>();
                List<QuanHuyen> lstQuanHuyen = new List<QuanHuyen>();
                //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")
                {
                    if (DieuChinhKHXBDetailId != null)
                    {
                        lstUnits = objUnitNew.getUnitNotMap(lstids, typeid);
                        //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.toBDieuChinhPhanHuongUnit(), lstUnits);
                        //map lai list vua tao cho object
                        objUnitNew.setListUnitMapNew(lstUnits, BDieuChinhPhanHuongUnit.DiemTiepNhanId);
                        Session[Application.Session.UnitModelDieuChinh] = objUnitNew;
                    }
                    else
                    {
                        BDieuChinhPhanHuongUnitModel bDieuChinhPhanHuongUnitModel = new BDieuChinhPhanHuongUnitModel();
                        lstUnits = objUnitNew.getUnitNotMap(lstids, typeid);
                        //bind data for district
                        bDieuChinhPhanHuongUnitModel.DiemTiepNhanId = BDieuChinhPhanHuongUnit.DiemTiepNhanId;
                        bDieuChinhPhanHuongUnitModel.ThongTinBaoId = BDieuChinhPhanHuongUnit.ThongTinBaoId;
                        bDieuChinhPhanHuongUnitModel.DieuChinhKHXBDetailId = DieuChinhKHXBDetailId;
                        bDieuChinhPhanHuongUnitModel.CreateBy = userInfo.Id;
                        bDieuChinhPhanHuongUnitModel.CreateDate = DateTime.Now;
                        bDieuChinhPhanHuongUnitModel.ModifyBy = userInfo.Id;
                        bDieuChinhPhanHuongUnitModel.ModifyDate = DateTime.Now;
                        //add action
                        dbDieuChinhPHNC.Add(bDieuChinhPhanHuongUnitModel.toBDieuChinhPhanHuongUnit(), lstUnits);
                    }
                }
                else if(!string.IsNullOrWhiteSpace(typeid))
                {
                    lstQuanHuyen = objUnitNew.getDistrictNotMap(lstids, typeid);
                    if(DieuChinhKHXBDetailId != null)
                    {
                        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);
                    }
                    else
                    {
                        BPhanHuongNhuCauDistrictModel bPhanHuongNhuCauDistrictModel = new BPhanHuongNhuCauDistrictModel();
                        //bind data for district
                        bPhanHuongNhuCauDistrictModel.DiemTiepNhanId = BDieuChinhPhanHuongUnit.DiemTiepNhanId;
                        bPhanHuongNhuCauDistrictModel.ThongTinBaoId = BDieuChinhPhanHuongUnit.ThongTinBaoId;
                        bPhanHuongNhuCauDistrictModel.CreateBy = userInfo.Id;
                        bPhanHuongNhuCauDistrictModel.CreateDate = DateTime.Now;
                        bPhanHuongNhuCauDistrictModel.ModifyBy = userInfo.Id;
                        bPhanHuongNhuCauDistrictModel.ModifyDate = DateTime.Now;
                        //add action
                        dbDieuChinhPHNC.AddDistrict(bPhanHuongNhuCauDistrictModel.toBPhanHuongNhuCauDistrict(), lstQuanHuyen);
                    }
                }

                if (Session["ProvinceCode"] != null)
                {
                    return Json(new { MSG = "Bạn đã thiết lập thông tin phân hướng thành công !" });
                }
                else
                {
                    return Json(new { MSG = "Bạn đã thiết lập thông tin phân hướng thành công !" });
                }
            }

            return this.Json(new { MSG = "Có lỗi xảy ra, dữ liệu không hợp lệ !" });
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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));
        }
Esempio n. 6
0
        // GET: Admin/PHNC/delete/5
        //id : DiemTiepNhanId
        public ActionResult DeleteDieuChinhPHNC(string id, string DieuChinhKHXBDetailId)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            //get BDiemTiepNhan with DiemTiepNhanId
            BDiemTiepNhan bDiemTiepNhan = dbDieuChinhPHNC.getByDiemTiepNhanId(id);

            //tạo model mới để return ra view DiemTiepNhanId và ThongTinBaoId
            BDieuChinhPhanHuongUnitModel BDieuChinhPhanHuongUnit = new BDieuChinhPhanHuongUnitModel();
            BDieuChinhPhanHuongUnit.DiemTiepNhanId = id;
            BDieuChinhPhanHuongUnit.ThongTinBaoId = DieuChinhKHXBDetailId;

            //check lỗi không có điểm tiếp nhận
            if (bDiemTiepNhan == null)
            {
                return HttpNotFound();
            }

            //Viewbag chung để return ra view input
            ViewBag.DTNBC = dbDieuChinhPHNC.getAllData(userInfo.UnitCode, DieuChinhKHXBDetailId); //left tree data
            ViewBag.DiemTiepNhanId = new SelectList(dbDieuChinhPHNC.getAllDiemTiepNhan(), "Id", "Name", BDieuChinhPhanHuongUnit.DiemTiepNhanId);
            ViewBag.ThongTinBaoId = new SelectList(dbDieuChinhPHNC.getAllThongTinBao(), "Id", "DieuChinhKHXBDetailId", BDieuChinhPhanHuongUnit.ThongTinBaoId);
            ViewBag.UnitCode = dbDieuChinhPHNC.getAllUnitByDTNId(userInfo.UnitCode, id, DieuChinhKHXBDetailId);
            ViewBag.DieuChinhKHXBDetailId = DieuChinhKHXBDetailId;
            return View(BDieuChinhPhanHuongUnit);
        }