Esempio n. 1
0
        /// <summary>
        /// 区域查询
        /// </summary>
        /// <param name="page"></param>
        /// <param name="count"></param>
        /// <param name="keyword"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public ActionResult AreaList(int?page, int?count, string keyword, string parent)
        {
            page  = page.ToInt() == 0 ? 1 : page;
            count = count.ToInt() == 0 ? 10 : count;

            var predicate = PredicateBuilder.New <PD_Areas>(true);

            if (!string.IsNullOrEmpty(keyword))
            {
                ViewBag.Keyword = keyword;
                predicate       = predicate.And(t => t.Name.Contains(keyword));
            }
            if (!string.IsNullOrEmpty(parent))
            {
                predicate      = predicate.And(t => t.Parent == parent);
                ViewBag.Parent = parent;
            }

            PdAreasBll bll = new PdAreasBll();

            int             total    = 0;
            List <PD_Areas> allAreas = bll.QueryByPage(page.ToInt(), count.ToInt(), out total, predicate, t => t.Id, false);

            ViewBag.Total     = total;
            ViewBag.PageIndex = page;
            ViewBag.PageCount = count;
            ViewBag.Province  = bll.Query(t => t.Parent == "CN").ToDictionary(t => t.Id, t => t.Name);

            return(View(allAreas));
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult AreaEdit(string Id)
        {
            PdAreasBll bll   = new PdAreasBll();
            PD_Areas   model = new PD_Areas();

            if (!string.IsNullOrEmpty(Id))
            {
                model = bll.Query(t => t.Id == Id).FirstOrDefault();
            }

            return(View(model));
        }
Esempio n. 3
0
        public ActionResult AreaEdit(PD_Areas model)
        {
            PdAreasBll bll = new PdAreasBll();

            if (!string.IsNullOrEmpty(model.Id))
            {
                bll.Update(model);
            }

            ViewBag.Success = true;
            ViewBag.Message = "修改成功!";

            return(View(model));
        }
Esempio n. 4
0
        public ActionResult GetDistrict(string city)
        {
            var allArea = new PdAreasBll().Query(t => t.Parent == (string.IsNullOrEmpty(city) ? "110100" : city));

            return(Json(allArea.Select(t => new { t.Id, t.Name })));
        }
Esempio n. 5
0
        public ActionResult GetCity(string province)
        {
            var allArea = new PdAreasBll().Query(t => t.Parent == (string.IsNullOrEmpty(province) ? "110000" : province));

            return(Json(allArea.Select(t => new { t.Id, t.Name })));
        }