Ejemplo n.º 1
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="pageIndex">页下标</param>
        /// <param name="rentalType">租售类型</param>
        /// <param name="ssjd">所属街道</param>
        /// <param name="zmj">总面积</param>
        /// <param name="rentalMoney">租售价格</param>
        /// <param name="name">楼宇名称</param>
        /// <returns></returns>
        public JsonResult GetJsonList(int pageIndex, string rentalType, string ssjd, string zmj, string rentalMoney, string name, Guid isImportant, Guid jsjd)
        {
            StringBuilder html = new StringBuilder();
            IQueryable <BuildingModel> list = db.BuildingsAndBuildingMonthInfo.Where(p => p.IsImportant == isImportant && p.JSJD == jsjd && p.Status == Status.Normal).Include(p => p.SWZJ).Include(p => p.SYZJ);

            #region where
            //所属街道
            if (!string.IsNullOrWhiteSpace(ssjd))
            {
                Guid ssjdGuid = Guid.Parse(ssjd);
                list = list.Where(p => p.SSJD == ssjdGuid);
            }
            //总面积
            if (!string.IsNullOrWhiteSpace(zmj))
            {
                int begin = zmj.Split(',')[0].Convert <int>(0);
                if (begin != 0)
                {
                    list = list.Where(p => p.ZJZMJ > begin);
                }
                int end = zmj.Split(',')[1].Convert <int>(0);
                if (end != 0)
                {
                    list = list.Where(p => p.ZJZMJ < end);
                }
            }
            //租售金额
            if (!string.IsNullOrWhiteSpace(rentalMoney))
            {
                //出租
                string zjStr = ControllersExtentstions.GetAreaIds(rentalMoney);
                if (string.IsNullOrWhiteSpace(zjStr))
                {
                    List <Guid> ids = new List <Guid>();
                    foreach (var item in zjStr.Split(','))
                    {
                        ids.Add(Guid.Parse(item));
                    }
                    list = list.Where(t => ids.Contains(t.SY_ZJ.Value) || ids.Contains(t.SW_ZJ.Value));
                }
                //出售
                int begin = rentalMoney.Split(',')[0].Convert <int>(0);
                if (begin != 0)
                {
                    list = list.Where(p => p.SY_XSJJ > begin || p.SW_XSJJ > begin);
                }
                int end = rentalMoney.Split(',')[1].Convert <int>(0);
                if (end != 0)
                {
                    list = list.Where(p => p.SY_XSJJ < end || p.SW_XSJJ < end);
                }
            }
            //楼宇名称
            if (!string.IsNullOrWhiteSpace(name))
            {
                list = list.Where(p => p.Name.Contains(name));
            }
            #endregion
            int    totalCount = list.Count();
            string pager      = RoadFlow.Utility.New.Tools.GetPagingHtml(totalCount, pageSize, pageIndex);
            list = list.OrderByDescending(p => p.CreateTime).Skip(pageSize * (pageIndex - 1)).Take(pageSize);
            return(Json(new { success = true, html = GetHtml(list, rentalType).ToString(), pager = pager, totalCount = totalCount, }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// json 异步加载
        /// </summary>
        /// <param name="pageIndex">页下标</param>
        /// <param name="jsjd">建设阶段</param>
        /// <param name="typeid">是否重点楼宇</param>
        /// <param name="ssjd">所属街道</param>
        /// <param name="zmj">总面积</param>
        /// <param name="name">楼宇名称</param>
        /// <returns></returns>
        public JsonResult GetList(int pageIndex, Guid jsjd, Guid typeid, string ssjd, string zmj, string name)
        {
            StringBuilder html = new StringBuilder();
            IQueryable <BuildingModel> list = db.BuildingsAndBuildingMonthInfo.Where(p => p.IsImportant == typeid && p.JSJD == jsjd);

            if (!string.IsNullOrWhiteSpace(ssjd))
            {
                Guid ssjdGuid = Guid.Parse(ssjd);
                list = list.Where(p => p.SSJD == ssjdGuid);
            }
            if (!string.IsNullOrWhiteSpace(zmj))
            {
                int begin = zmj.Split(',')[0].Convert <int>(0);
                if (begin != 0)
                {
                    list = list.Where(p => p.ZJZMJ > begin);
                }
                int end = zmj.Split(',')[1].Convert <int>(0);
                if (end != 0)
                {
                    list = list.Where(p => p.ZJZMJ < end);
                }
            }
            if (!string.IsNullOrWhiteSpace(name))
            {
                list = list.Where(p => p.Name.Contains(name));
            }
            int    totalCount = list.Count();
            string pager      = RoadFlow.Utility.New.Tools.GetPagingHtml(totalCount, pageSize, pageIndex);

            list = list.OrderByDescending(p => p.CreateTime).Skip(pageSize * (pageIndex - 1)).Take(pageSize);

            int count = 0;

            foreach (var item in list)
            {
                count++;
                if (count % 3 == 0)
                {
                    html.Append(" <li class=\"fl\" style=\"margin-right:0;\"><div>");
                }
                else
                {
                    html.Append(" <li class=\"fl\"><div>");
                }
                html.AppendFormat(" <a href=\"{0}\"><img src=\"{1}\"></a>", Url.Action("Details", new { id = item.ID }), ControllersExtentstions.GetFullPath(string.IsNullOrWhiteSpace(item.XGT) ? "" : item.XGT.Split('|')[0]));
                html.AppendFormat(" <h5>{0}</h5>", item.Name);
                html.AppendFormat(" <p>面积:{0}<span>平方米</span></p>", item.ZJZMJ);
                html.AppendFormat("<p>开发商:{0}</p>  </div>", item.LYGLYYF);
                html.Append("</li>");
            }
            return(Json(new { success = true, html = html.ToString(), pager = pager, totalCount = totalCount }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public StringBuilder GetHtml(IQueryable <BuildingModel> list, string rentalType)
        {
            StringBuilder html  = new StringBuilder();
            int           count = 0;

            foreach (var item in list)
            {
                count++;
                if (count % 2 == 1)
                {
                    html.Append(" <li class=\"clearfix\">");
                    html.Append("<div class=\"fl clearfix pr\">");
                    // html.Append(" <li class=\"fl clearfix pr\" style=\"margin-right:0;float:right;\">");
                }
                else
                {
                    html.Append("<div class=\"fr clearfix pr\">");
                }


                html.AppendFormat(" <a href=\"{0}\"><img class=\"fl\" src=\"{1}\">", Url.Action("Details", new { id = item.ID }), ControllersExtentstions.GetFullPath(string.IsNullOrWhiteSpace(item.XGT) ? "" : item.XGT.Split('|')[0]));//左侧图
                //中间部分
                html.Append(" <div class=\"fl\">");
                html.AppendFormat(" <h4>{0}</h4>", item.Name);
                html.AppendFormat("<div>地址:<span>{0}</span> </div>", item.LYXXDZ);
                html.AppendFormat(" <div>招商电话:<span>{0}</span></div>", item.ChinaMerchantsTel);
                html.AppendFormat("<div>面积:<span>{0}㎡</span>  </div>", item.ZJZMJ);
                html.AppendFormat(" <div>发布日期:<span>{0}</span></div>", ((DateTime)item.CreateTime).ToString("yyyy-MM-dd"));
                html.Append("</div>");
                //右侧部分
                if (!string.IsNullOrWhiteSpace(rentalType))
                {
                    if (rentalType == "出租")
                    {
                        html.AppendFormat(" <div class=\"pa pa1\"> <span class=\"txt1\">商业租金</span><span class=\"money\">{0}</span>元/㎡ · 月</div>", item.SYZJ == null?"": item.SYZJ.Title);
                        html.AppendFormat(" <div class=\"pa pa2\"><span class=\"txt1\">商务租金</span><span class=\"money\">{0}</span>元/㎡ · 月 </div>", item.SWZJ == null ? "" : item.SWZJ.Title);
                    }
                    else if (rentalType == "出售")
                    {
                        html.AppendFormat(" <div class=\"pa pa3\"><span class=\"txt1\">商业价格</span><span class=\"money\">{0}</span>元/㎡ · 月</div>", item.SY_XSJJ == null ? 0 : item.SY_XSJJ);
                        html.AppendFormat("<div class=\"pa pa4\"><span class=\"txt1\">商务价格</span><span class=\"money\">{0}</span>元/㎡ · 月</div>", item.SW_XSJJ == null ? 0 : item.SW_XSJJ);
                    }
                    else  //全部
                    {
                        html.AppendFormat(" <div class=\"pa pa1\"> <span class=\"txt1\">商业租金</span><span class=\"money\">{0}</span>元/㎡ · 月</div>", item.SYZJ == null ? "" : item.SYZJ.Title);
                        html.AppendFormat(" <div class=\"pa pa2\"><span class=\"txt1\">商务租金</span><span class=\"money\">{0}</span>元/㎡ · 月 </div>", item.SWZJ == null ? "" : item.SWZJ.Title);
                        html.AppendFormat(" <div class=\"pa pa3\"><span class=\"txt1\">商业价格</span><span class=\"money\">{0}</span>元/㎡ · 月</div>", item.SY_XSJJ == null ? 0 : item.SY_XSJJ);
                        html.AppendFormat("<div class=\"pa pa4\"><span class=\"txt1\">商务价格</span><span class=\"money\">{0}</span>元/㎡ · 月</div>", item.SW_XSJJ == null ? 0 : item.SW_XSJJ);
                    }
                }

                html.Append(" </a>");
                html.Append("</div>");

                if (count % 2 == 0)
                {
                    html.Append("</li>");
                }
            }
            return(html);
        }