/// <summary> /// 房源评价页面 /// add by fruitchan /// 2017-2-15 20:56:48 /// </summary> /// <param name="houseId">房源编号</param> /// <returns>View</returns> public ActionResult EvaluateView(int?houseId) { ViewBag.HouseId = houseId; IList <HouseEvaluate> houseEvaluateList = null; if (houseId.HasValue) { HouseInfoView houseInfo = OperateContext.Current.BLLSession.IHouseInfoViewBLL.GetListBy(m => m.ID == houseId && m.State == 0).FirstOrDefault(); if (houseInfo != null) { if (houseInfo.EvaluateNum > 0) { // 房源评价分 double cleanScoreTotal = OperateContext.Current.BLLSession.IHouseEvaluateBLL.GetListBy(m => m.HouseInfoID == houseInfo.ID).Sum(m => m.CleanScore); ViewBag.CleanScore = Convert.ToInt32(cleanScoreTotal / houseInfo.EvaluateNum); double locationScoreTotal = OperateContext.Current.BLLSession.IHouseEvaluateBLL.GetListBy(m => m.HouseInfoID == houseInfo.ID).Sum(m => m.LocationScore); ViewBag.LocationScore = Convert.ToInt32(locationScoreTotal / houseInfo.EvaluateNum); double environmentScoreTotal = OperateContext.Current.BLLSession.IHouseEvaluateBLL.GetListBy(m => m.HouseInfoID == houseInfo.ID).Sum(m => m.EnvironmentScore); ViewBag.EnvironmentScore = Convert.ToInt32(environmentScoreTotal / houseInfo.EvaluateNum); double serviceScoreTotal = OperateContext.Current.BLLSession.IHouseEvaluateBLL.GetListBy(m => m.HouseInfoID == houseInfo.ID).Sum(m => m.ServiceScore); ViewBag.ServiceScore = Convert.ToInt32(serviceScoreTotal / houseInfo.EvaluateNum); double performanceScoreScoreTotal = OperateContext.Current.BLLSession.IHouseEvaluateBLL.GetListBy(m => m.HouseInfoID == houseInfo.ID).Sum(m => m.PerformanceScore); ViewBag.PerformanceScore = Convert.ToInt32(performanceScoreScoreTotal / houseInfo.EvaluateNum); } } houseEvaluateList = OperateContext.Current.BLLSession.IHouseEvaluateBLL.GetListBy(m => m.HouseInfoID == houseId.Value, m => m.CreateTime, false); if (houseEvaluateList != null && houseEvaluateList.Count > 0) { // 隐藏手机号 for (int i = 0; i < houseEvaluateList.Count; i++) { if (!String.IsNullOrWhiteSpace(houseEvaluateList[i].UserPhone)) { var phone = houseEvaluateList[i].UserPhone; if (phone.Length > 6) { houseEvaluateList[i].UserPhone = phone.Substring(0, 3) + "****" + phone.Substring(phone.Length - 3, 3); } } } } } return(View(houseEvaluateList)); }
/// <summary> /// 提交订单页面 /// add by fruitchan /// 2016-12-20 23:49:49 /// </summary> /// <returns>View</returns> public ActionResult SubmitOrderView(int?id) { HouseInfoView houseInfo = null; UserInfoView loginUserInfo = OperateContext.Current.UserInfo; if (id.HasValue) { houseInfo = OperateContext.Current.BLLSession.IHouseInfoViewBLL.GetListBy(m => m.ID == id && m.State == 0).FirstOrDefault(); if (houseInfo != null) { houseInfo.HouseImgList = OperateContext.Current.BLLSession.IHouseImgBLL.GetListBy(m => m.HouseInfoID == houseInfo.ID, m => m.CreateTime, true); } } return(View(houseInfo)); }
/// <summary> /// 房源详情页面 /// add by fruitchan /// 2017-2-15 20:09:16 /// </summary> /// <param name="id">房源编号</param> /// <returns>View</returns> public ActionResult HouseDetailsView(int?id) { HouseInfoView houseInfo = null; if (id.HasValue) { houseInfo = OperateContext.Current.BLLSession.IHouseInfoViewBLL.GetListBy(m => m.ID == id && m.State == 0).FirstOrDefault(); if (houseInfo != null) { houseInfo.HouseImgList = OperateContext.Current.BLLSession.IHouseImgBLL.GetListBy(m => m.HouseInfoID == houseInfo.ID, m => m.CreateTime, true); #region 省、市、县 string cityName = ""; if (houseInfo.CityId.HasValue && houseInfo.CityId.Value > 0) { // 城市 Region city = OperateContext.Current.BLLSession.IRegionBLL.GetListBy(m => m.Id == houseInfo.CityId.Value).FirstOrDefault(); if (city != null) { // 省份 Region province = OperateContext.Current.BLLSession.IRegionBLL.GetListBy(m => m.Id == city.ParentId).FirstOrDefault(); if (province != null) { cityName = province.Name; } cityName += " " + city.Name; } } if (houseInfo.CountyId.HasValue && houseInfo.CountyId.Value > 0) { // 区县 Region county = OperateContext.Current.BLLSession.IRegionBLL.GetListBy(m => m.Id == houseInfo.CountyId.Value).FirstOrDefault(); if (county != null) { cityName += " " + county.Name; } } ViewBag.City = cityName; #endregion // 已预订订单 IList <OrderInfo> orderList = OperateContext.Current.BLLSession.IOrderInfoBLL.GetListBy(m => m.HouseInfoID == houseInfo.ID && (m.State == 0 || m.State == 1 || m.State == 2) && m.EndDate >= DateTime.Now, m => m.StartDate, true); ViewBag.HouseOrderList = orderList; //获取店铺 var shop = OperateContext.Current.BLLSession.IShopInfoBLL.GetListBy(h => h.ID == houseInfo.ShopId).FirstOrDefault(); if (shop != null) { houseInfo.About = shop.About; houseInfo.ChargesNotes = shop.ChargesNotes; houseInfo.Rules = shop.Rules; houseInfo.Address = shop.Locations; ViewBag.COORDINATE = shop.COORDINATE; } } } return(View(houseInfo)); }