public JsonResult getDataDic(string pageSize, string page,
                                     string dkey, string dvalue, string dvalue2, string dvalue3
                                     )
        {
            List <DataDictionary> datas = DataDictionaryService.LoadEntities(d => true).ToList();

            int pageInt     = Convert.ToInt32(page);
            int pageSizeInt = Convert.ToInt32(pageSize);

            if (!string.IsNullOrWhiteSpace(dkey))
            {
                datas = datas.Where(d => d.dkey.Contains(dkey)).ToList();
            }

            if (!string.IsNullOrWhiteSpace(dvalue))
            {
                datas = datas.Where(d => d.dvalue.Contains(dvalue)).ToList();
            }

            if (!string.IsNullOrWhiteSpace(dvalue2))
            {
                datas = datas.Where(d => d.dvalue2.Contains(dvalue2)).ToList();
            }

            if (!string.IsNullOrWhiteSpace(dvalue3))
            {
                datas = datas.Where(d => d.dvalue3.Contains(dvalue3)).ToList();
            }

            int count = datas.Count;

            datas = datas.Skip((pageInt - 1) * pageSizeInt).Take(pageSizeInt).ToList();

            return(Json(new { datas = datas, count = count }, JsonRequestBehavior.AllowGet));
        }
 //
 // GET: /DataDictionary/Details/5
 public ViewResult Details(int id)
 {
     DataDictionaryService service = new DataDictionaryService();
     DataDictionary model = service.GetDataDictionaryByID(new DataDictionary() { Id = id });
     model.ActionOperationType = EActionOperationType.Details;
     return View("Create",model);
 }
        public JsonResult addDataDic(DataDictionary dataDic)
        {
            if (string.IsNullOrEmpty(dataDic.dvalue))
            {
                dataDic.dvalue = " ";
            }

            if (string.IsNullOrEmpty(dataDic.dvalue2))
            {
                dataDic.dvalue2 = " ";
            }


            if (string.IsNullOrEmpty(dataDic.dvalue3))
            {
                dataDic.dvalue3 = " ";
            }

            if (string.IsNullOrEmpty(dataDic.remark))
            {
                dataDic.remark = " ";
            }

            DataDictionary res = DataDictionaryService.AddEntity(dataDic);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public ActionResult partialRentHouse()
        {
            if (Session["houseDic"] != null)
            {
                ViewBag.houseDic    = Session["houseDic"];
                Session["houseDic"] = null;
                return(View());
            }

            string city = Session["rentCity"].ToString();

            Dictionary <string, List <HousePicture> > houseDic = new Dictionary <string, List <HousePicture> >();
            // 出租房 type = 1 出租 state = 0 未出售  audit 房屋审核通过允许上架
            List <House>        houseList = HouseService.LoadEntities(t => t.type == "1" && t.state == "0" && t.audit == "1" && t.city == city).ToList();
            List <HousePicture> hps       = newHousePicture(houseList);

            //Console.WriteLine(houseList);
            houseDic.Add("rent", hps);

            List <DataDictionary> datas = DataDictionaryService.LoadEntities(t => t.dkey == "region").ToList();



            ViewBag.houseDic = houseDic;
            ViewBag.dataDic  = datas;
            return(View());
        }
Beispiel #5
0
        //
        // GET: /House/

        public ActionResult Index()
        {
            List <DataDictionary> regions = DataDictionaryService.LoadEntities(t => t.dkey == "region").ToList();

            List <string> province = new List <string>();

            foreach (DataDictionary item in regions)
            {
                if (!province.Contains(item.dvalue3))
                {
                    province.Add(item.dvalue3);
                }
            }

            List <string> region = new List <string>();

            regions = DataDictionaryService.LoadEntities(t => t.dkey == "region" && t.dvalue2 == "北京市").ToList();
            foreach (DataDictionary item in regions)
            {
                if (!region.Contains(item.dvalue))
                {
                    region.Add(item.dvalue);
                }
            }

            ViewBag.province = province;
            ViewBag.region   = region;

            return(View());
        }
 public ActionResult DeleteConfirmed(int id)
 {
     DataDictionaryService service = new DataDictionaryService();
     DataDictionary model = service.GetDataDictionaryByID(new DataDictionary() { Id = id });
     service.Remove(model);
     return RedirectToAction("Index");
 }
 //
 // GET: /DataDictionary/Edit/5
 public ActionResult Edit(int id)
 {
     DataDictionaryService service = new DataDictionaryService();
     DataDictionary model = service.GetDataDictionaryByID(new DataDictionary() { Id = id });
     model.ActionOperationType = EActionOperationType.Edit;
     this.LoadEditViewBag(model);
     return View("Create",model);
 }
Beispiel #8
0
        static void Main(string[] args)
        {
            var dataDictionaryService = new DataDictionaryService();

            dataDictionaryService.CreateHtml();

            Console.ReadKey();
        }
        public JsonResult removeDataDic(string did)
        {
            int            didInt = Convert.ToInt32(did);
            DataDictionary data   = DataDictionaryService.LoadEntities(d => d.did == didInt).FirstOrDefault();

            bool res = DataDictionaryService.DeleteEntity(data);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
 public ActionResult Create(DataDictionary model)
 {
     model.ActionOperationType = EActionOperationType.Create;
     if (ModelState.IsValid)
     {
         DataDictionaryService service = new DataDictionaryService();
         service.Add(model);
         return RedirectToAction("Index");
     }
     this.LoadEditViewBag(model);
     return View("Create",model);
 }
Beispiel #11
0
        public JsonResult getRegion(string city)
        {
            List <string>         region = new List <string>();
            List <DataDictionary> datas  = DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue2 == city).ToList();

            foreach (var item in datas)
            {
                if (!region.Contains(item.dvalue))
                {
                    region.Add(item.dvalue);
                }
            }

            return(Json(region, JsonRequestBehavior.AllowGet));
        }
Beispiel #12
0
        public JsonResult getCity(string province)
        {
            List <string>         city  = new List <string>();
            List <DataDictionary> datas = DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue3 == province).ToList();

            foreach (var item in datas)
            {
                if (!city.Contains(item.dvalue2))
                {
                    city.Add(item.dvalue2);
                }
            }

            return(Json(city, JsonRequestBehavior.AllowGet));
        }
Beispiel #13
0
        public JsonResult getProvince()
        {
            List <string>         province = new List <string>();
            List <DataDictionary> datas    = DataDictionaryService.LoadEntities(d => d.dkey == "region").ToList();

            foreach (var item in datas)
            {
                if (!province.Contains(item.dvalue3))
                {
                    province.Add(item.dvalue3);
                }
            }

            return(Json(province, JsonRequestBehavior.AllowGet));
        }
Beispiel #14
0
        public JsonResult PlaceOrder(string id, string duration)
        {
            int   hid   = Convert.ToInt32(id);
            House house = HouseService.LoadEntities(h => h.hid == hid).FirstOrDefault();

            // 服务费
            DataDictionary servicePrice = DataDictionaryService.LoadEntities(t => t.dkey == "service").FirstOrDefault();

            int rent = Convert.ToInt32(duration) * house.price + Convert.ToInt32(servicePrice.dvalue);

            DateTime df  = DateTime.Now;
            string   now = df.ToString();

            Orders newOrder = OrdersService.AddEntity(new Orders {
                duration = Convert.ToInt32(duration),
                rent     = rent,
                state    = "0",
                time     = now
            });

            User user = Session["user"] as My.RentingSystem.Model.User;


            //
            OrdersUserHouse newOrderUserHouse = OrdersUserHouseService.AddEntity(new OrdersUserHouse {
                oid     = newOrder.oid,
                uid     = user.uid,
                hid     = hid,
                pubTime = df.ToString("yyyyMMdd")
            });

            // 更新房屋状态state=1
            house.state = "1";
            HouseService.EditEntity(house);
            Session["city"] = Session["rentCity"];

            if (newOrder == null || newOrderUserHouse == null)
            {
                return(Json("error", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("success", JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #15
0
        public ActionResult getCity(string province)
        {
            List <string> regions = new List <string>();
            //if (province == "北京市" || province == "上海市" || province == "重庆市" || province == "深圳市")
            //{
            //    List<DataDictionary> region = DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue2 == province).ToList();
            //    foreach (DataDictionary item in region)
            //    {
            //        if (!regions.Contains(item.dvalue))
            //        {
            //            regions.Add(item.dvalue);
            //        }
            //    }
            //}


            List <DataDictionary> datas = DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue3 == province).ToList();

            List <string> city = new List <string>();

            //city.Add()
            foreach (DataDictionary item in datas)
            {
                if (!city.Contains(item.dvalue2))
                {
                    city.Add(item.dvalue2);
                }
            }

            string firstCity             = city[0];
            List <DataDictionary> region = DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue2 == firstCity).ToList();

            foreach (DataDictionary item in region)
            {
                if (!regions.Contains(item.dvalue))
                {
                    regions.Add(item.dvalue);
                }
            }


            return(Json(new { province = province, city = city, region = regions }, JsonRequestBehavior.AllowGet));
        }
Beispiel #16
0
        public JsonResult editOrder(string ouhid,
                                    string oid,
                                    string community,
                                    string area,
                                    string unitType,
                                    string duration,
                                    string rent,
                                    string floor,
                                    string state
                                    )
        {
            int    oidInt   = Convert.ToInt32(oid);
            Orders order    = OrdersService.LoadEntities(o => o.oid == oidInt).FirstOrDefault();
            int    ouhidInt = Convert.ToInt32(ouhid);
            int    hid      = OrdersUserHouseService.LoadEntities(o => o.ouhid == ouhidInt).FirstOrDefault().hid;

            House house = HouseService.LoadEntities(h => h.hid == hid).FirstOrDefault();

            // 如果时长不变 只变价格
            if (Convert.ToInt32(duration) == order.duration)
            {
                order.rent  = Convert.ToInt32(rent);
                order.state = state;
            }
            else
            {
                // 改变时长 重新计算价格
                order.state    = state;
                order.duration = Convert.ToInt32(duration);
                string service = DataDictionaryService.LoadEntities(d => d.remark == "服务费").FirstOrDefault().dvalue;

                order.rent = (Convert.ToInt32(duration) * house.price) + Convert.ToInt32(service);
            }

            bool res = OrdersService.EditEntity(order);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Beispiel #17
0
        public JsonResult getProvince()
        {
            DataDictionaryService.LoadEntities(d => d.dkey == "region").ToList();

            return(Json(null, JsonRequestBehavior.AllowGet));
        }
Beispiel #18
0
 public JsonResult getRegion(string city)
 {
     DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue2 == city).ToList();
     return(Json(null, JsonRequestBehavior.AllowGet));
 }
 public virtual IList <DataDictionaryInfo> DataDictionarys() => DataDictionaryService.Query().Data;
 public DataDictionaryController()
 {
     dataDictionaryService = new DataDictionaryService();
 }
 public virtual IList <DataDictionaryInfo> DataDictionarys() => DataDictionaryService.Query(HttpContext.CreateCommonUseData(ComUseDataFactory, menuCode: MenuCode(), functionCodes: FunCodeDefine.QUERY_CODE)).Data;
Beispiel #22
0
        public JsonResult editDataDic(DataDictionary dataDic)
        {
            bool res = DataDictionaryService.EditEntity(dataDic);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
        private void LoadSearchViewBag(ProjectPlanCollectionSearch searchModel)
        {
            #region sort
            ViewBag.IsAsc = !searchModel.IsAsc;
            ViewBag.SortBy = searchModel.SortBy;
            #endregion
                var projectplanService = new ProjectPlanService();
                if (!searchModel.ProjectPlanId.HasValue)
                {
                    ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ProjectPlanId);
                }
                var contractService = new ContractService();
                if (!searchModel.ContractId.HasValue)
                {
                    ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ContractId);
                }
                var orgchartService = new OrgChartService();
                if (!searchModel.OrgChartId.HasValue)
                {
                    ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrgChartId);
                }
                var datadictionaryService = new DataDictionaryService();
                if (!searchModel.BidTypeId.HasValue)
                {
                    ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.BidTypeId);
                }
                var departmentService = new DepartmentService();
                if (!searchModel.DepartmentId.HasValue)
                {
                    ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.DepartmentId);
                }
                var employeeService = new EmployeeService();
                if (!searchModel.ResearchOwnerEmployeeId.HasValue)
                {
                    ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ResearchOwnerEmployeeId);
                }

                if (!searchModel.EngeerEmployeeId.HasValue)
                {
                    ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.EngeerEmployeeId);
                }

                if (!searchModel.CostOwnerEmployeeId.HasValue)
                {
                    ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.CostOwnerEmployeeId);
                }

                if (!searchModel.AuthorEmployeeId.HasValue)
                {
                    ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.AuthorEmployeeId);
                }

                if (!searchModel.OrganizerEmployeeId.HasValue)
                {
                    ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrganizerEmployeeId);
                }
        }
        private void LoadEditViewBag(ProjectPlanCollection model)
        {
            ProjectPlanService projectplanService = new ProjectPlanService();
            ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name",model.ProjectPlanId);
             ContractService contractService = new ContractService();
            ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name",model.ContractId);
             OrgChartService orgchartService = new OrgChartService();
            ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrgChartId);
             DataDictionaryService datadictionaryService = new DataDictionaryService();
            ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name",model.BidTypeId);
             DepartmentService departmentService = new DepartmentService();
            ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name",model.DepartmentId);
             EmployeeService employeeService = new EmployeeService();
            ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.ResearchOwnerEmployeeId);

            ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.EngeerEmployeeId);

            ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.CostOwnerEmployeeId);

            ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.AuthorEmployeeId);

            ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrganizerEmployeeId);
        }
        private void LoadSearchViewBag(ContractSearch searchModel)
        {
            #region sort
            ViewBag.IsAsc = !searchModel.IsAsc;
            ViewBag.SortBy = searchModel.SortBy;
            #endregion
                var datadictionaryService = new DataDictionaryService();
                if (!searchModel.ContractTypeId.HasValue)
                {
                    ViewBag.ContractTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ContractTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ContractTypeId);
                }

                if (!searchModel.AgreementTypeId.HasValue)
                {
                    ViewBag.AgreementTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.AgreementTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.AgreementTypeId);
                }

                if (!searchModel.ContractRelationId.HasValue)
                {
                    ViewBag.ContractRelationId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ContractRelationId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ContractRelationId);
                }
        }
        private void LoadEditViewBag(Contract model)
        {
            DataDictionaryService datadictionaryService = new DataDictionaryService();
            ViewBag.ContractTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name",model.ContractTypeId);

            ViewBag.AgreementTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name",model.AgreementTypeId);

            ViewBag.ContractRelationId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name",model.ContractRelationId);
        }
Beispiel #27
0
        public JsonResult getMainData(string province)
        {
            int userToday = 0;
            int userMonth = 0;
            int userHis   = 0;

            DateTime dt  = DateTime.Now;
            string   now = dt.ToString("yyyyMMdd");
            // 用户
            List <UserUserInfo> userList = UserUserInfoService.LoadEntities(u => true).ToList();

            userToday = userList.Where(u => u.pubTime == now).ToList().Count;
            foreach (UserUserInfo item in userList)
            {
                DateTime itemDate = DateTime.ParseExact(item.pubTime, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                //DateTime _itemDate = itemDate.ToShortDateString();
                DateTime startMonth = DateTime.ParseExact(dt.AddDays(1 - dt.Day).ToString("yyyyMMdd"), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                //本月月初 带分钟
                //DateTime _startMonth = DateTime.ParseExact(startMonth.ToShortDateString(), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                //DateTime endMonth = startMonth.AddMonths(1).AddDays(-1);  //本月月末
                DateTime endMonth = DateTime.ParseExact(dt.AddDays(1 - dt.Day).AddMonths(1).AddDays(-1).ToString("yyyyMMdd"), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                //DateTime _endMonth = DateTime.ParseExact(startMonth.ToShortDateString(), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                if (itemDate >= startMonth && itemDate <= endMonth)
                {
                    userMonth++;
                }
            }

            userHis = userList.Count;

            // 订单
            int orderToday  = 0;
            int orderMonth  = 0;
            int orderHis    = 0;
            int waitOrder   = 0;
            int placedOrder = 0;
            List <OrdersUserHouse> ouhList = OrdersUserHouseService.LoadEntities(o => true).ToList();

            orderToday = ouhList.Where(o => o.pubTime == now).ToList().Count;
            foreach (OrdersUserHouse ouh in ouhList)
            {
                Orders order = OrdersService.LoadEntities(o => o.oid == ouh.oid).FirstOrDefault();

                DateTime itemDate = DateTime.ParseExact(ouh.pubTime, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);

                DateTime startMonth = dt.AddDays(1 - dt.Day);              //本月月初
                DateTime endMonth   = startMonth.AddMonths(1).AddDays(-1); //本月月末

                if (itemDate >= startMonth && itemDate <= endMonth)
                {
                    orderMonth++;
                }

                if (order.state == "0")
                {
                    waitOrder++;
                }

                if (order.state == "1")
                {
                    placedOrder++;
                }
            }

            orderHis = ouhList.Count;

            // 房屋
            int          houseToday = 0;
            int          houseMonth = 0;
            int          houseHis   = 0;
            List <House> houseList  = HouseService.LoadEntities(h => true).ToList();

            houseToday = houseList.Where(h => h.time == now).ToList().Count;
            foreach (House item in houseList)
            {
                DateTime itemDate = DateTime.ParseExact(item.time, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);

                DateTime startMonth = dt.AddDays(1 - dt.Day);              //本月月初
                DateTime endMonth   = startMonth.AddMonths(1).AddDays(-1); //本月月末

                if (itemDate >= startMonth && itemDate <= endMonth)
                {
                    houseMonth++;
                }
            }

            houseHis = houseList.Count;


            Dictionary <string, int> userChart  = new Dictionary <string, int>();
            Dictionary <string, int> houseChart = new Dictionary <string, int>();
            DateTime last7Day = DateTime.Now.AddDays(-6);

            for (int i = 0; i <= 6; i++)
            {
                string date = last7Day.ToString("yyyyMMdd");
                //DateTime itemDate = DateTime.ParseExact(date, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                int count      = UserUserInfoService.LoadEntities(u => u.pubTime == date).ToList().Count;
                int countHouse = HouseService.LoadEntities(h => h.time == date).ToList().Count;
                userChart.Add(date, count);
                houseChart.Add(date, countHouse);
                last7Day = last7Day.AddDays(1);
            }


            houseList = HouseService.LoadEntities(h => h.province == province).ToList();
            Dictionary <string, int> houseDic = new Dictionary <string, int>();

            foreach (House item in houseList)
            {
                if (!houseDic.ContainsKey(item.city))
                {
                    houseDic.Add(item.city, 1);
                }
                else
                {
                    int count = houseDic[item.city] += 1;
                    houseDic[item.city] = count;
                }
            }

            List <string> userChartX = userChart.Keys.ToList();
            List <int>    userChartY = userChart.Values.ToList();

            //List<string> houseDicX = houseDic.Keys.ToList();
            List <int>      houseDicY = houseDic.Values.ToList();
            List <HousePie> housePie  = new List <HousePie>();

            foreach (var item in houseDic)
            {
                housePie.Add(new HousePie {
                    name = item.Key, value = item.Value.ToString()
                });
            }

            List <string>         provinces = new List <string>();
            List <DataDictionary> datas     = DataDictionaryService.LoadEntities(d => d.dkey == "region").ToList();

            foreach (var item in datas)
            {
                if (!provinces.Contains(item.dvalue3))
                {
                    provinces.Add(item.dvalue3);
                }
            }

            AdminMainEntity entity = new AdminMainEntity
            {
                userToday   = userToday,
                userMonth   = userMonth,
                userHis     = userHis,
                orderToday  = orderToday,
                orderMonth  = orderMonth,
                orderHis    = orderHis,
                waitOrder   = waitOrder,
                placedOrder = placedOrder,
                houseToday  = houseToday,
                houseMonth  = houseMonth,
                houseHis    = houseHis,
                userChartX  = userChartX,
                userChartY  = userChartY,
                //houseDicX = houseDicX,
                houseDicY = houseChart.Values.ToList(),
                housePie  = housePie,
                provinces = provinces
            };

            return(Json(entity, JsonRequestBehavior.AllowGet));
        }
        private PagedList<DataDictionary> QueryListData(DataDictionarySearch searchModel)
        {
            int recordCount = 0;
            int pageSize = ConstantManager.PageSize;
            DataDictionaryService service = new DataDictionaryService();

            string Group = searchModel.IsAsc ? searchModel.SortBy : searchModel.SortBy + " Descending";

            IList<DataDictionary> allEntities = service.QueryByPage(this.GetSearchFilter(searchModel), Group, pageSize, searchModel.PageIndex + 1, out recordCount);

            var formCondition = "var condition=" + JsonConvert.SerializeObject(searchModel);
            return new PagedList<DataDictionary>(allEntities, searchModel.PageIndex, pageSize, recordCount, "Id", "Id", formCondition);
        }
Beispiel #29
0
        //
        // GET: /Home/

        public ActionResult Index(string city = "洛阳市")
        {
            Session["nav"] = 0;
            List <string> provinces = new List <string>();

            if (Session["user"] != null)
            {
                ViewBag.user = Session["user"];
            }
            List <string> citys = new List <string>();

            if (Session["city"] != null)
            {
                city = Session["city"].ToString();

                // 通过城市反查询省
                string thisProvince = DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue2 == city).FirstOrDefault().dvalue3;

                provinces.Add(thisProvince);

                List <DataDictionary> dataDic = DataDictionaryService.LoadEntities(d => d.dkey == "region").ToList();

                foreach (DataDictionary data in dataDic)
                {
                    if (!provinces.Contains(data.dvalue3))
                    {
                        provinces.Add(data.dvalue3);
                    }
                }

                // 同理需要查询市
                citys.Add(city);
                dataDic = DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue3 == thisProvince).ToList();

                foreach (DataDictionary data in dataDic)
                {
                    if (!citys.Contains(data.dvalue2))
                    {
                        citys.Add(data.dvalue2);
                    }
                }

                //ViewBag.citys = citys;
                Session["selectCity"] = citys;
                // 给租房列表使用
                Session["rentCity"] = city;
                //Session["city"] = null;
            }
            else
            {
                // 查询所有
                List <DataDictionary> dataDic = DataDictionaryService.LoadEntities(d => d.dkey == "region").ToList();
                provinces.Add("河南省");
                foreach (DataDictionary data in dataDic)
                {
                    if (!provinces.Contains(data.dvalue3))
                    {
                        provinces.Add(data.dvalue3);
                    }
                }

                dataDic = DataDictionaryService.LoadEntities(d => d.dkey == "region" && d.dvalue3 == "河南省").ToList();
                citys.Add("洛阳市");
                foreach (DataDictionary data in dataDic)
                {
                    if (!citys.Contains(data.dvalue2))
                    {
                        citys.Add(data.dvalue2);
                    }
                }
                Session["city"]        = Session["rentCity"];
                Session["defaultCity"] = citys;
                Session["rentCity"]    = city;
            }

            Dictionary <string, List <HousePicture> > houseDic = new Dictionary <string, List <HousePicture> >();
            // 出租房
            List <House>        houseList = HouseService.LoadEntities(t => t.type == "1" && t.state == "0" && t.audit == "1" && t.city == city).ToList();
            List <HousePicture> hps       = newHousePicture(houseList);

            //Console.WriteLine(houseList);
            houseDic.Add("rent", hps);
            // 新房
            houseList = HouseService.LoadEntities(t => t.type == "2" && t.state == "0" && t.audit == "1" && t.city == city).ToList();
            hps       = newHousePicture(houseList);
            houseDic.Add("new", hps);

            houseList = HouseService.LoadEntities(t => t.type == "3" && t.state == "0" && t.audit == "1" && t.city == city).ToList();
            // houseList.Capacity
            // 二手房
            hps = newHousePicture(houseList);
            houseDic.Add("second", hps);

            // 数据字典区域划分 提取session
            List <DataDictionary> datas = DataDictionaryService.LoadEntities(t => t.dvalue2 == city).ToList();

            Session["region"] = datas;

            // 推荐房源
            List <House>        recommendhouseList = HouseService.LoadEntities(t => t.isRecommend == "1" && t.audit == "1").ToList();
            List <HousePicture> rhp = newHousePicture(recommendhouseList);

            Session["recommendHouse"] = rhp;


            Session["provinces"] = provinces;

            ViewBag.houseDic = houseDic;
            return(View());
        }