private ViewCenters GetCenterAllInfo(int id) { ViewCenters c = new ViewCenters(); using (CentersServiceClient client = new CentersServiceClient()) { c = client.GetCentersById(id); } ViewBag.centerid = id; #region 评价列表 using (EvaluatesServiceClient clientEval = new EvaluatesServiceClient()) { int count = 0; clientEval.GetRecommendCount(id, out count); ViewBag.Recommend = count; List <ViewEvaluates> evalEntity = new List <ViewEvaluates>(); evalEntity = clientEval.GettEvalUid(id); List <ViewEvaluatesGroup> listGroupMsg = new List <ViewEvaluatesGroup>(); foreach (var item in evalEntity) { ViewEvaluatesGroup model = new ViewEvaluatesGroup(); model.entity = item; //评论人 ViewYogaUser usermodel = clientUser.GetYogaUserById(item.FromUid.Value); if (usermodel != null) { model.FromUser = usermodel.NickName; } //回复 List <ViewEvaluates> listM = clientEval.GetEvalParentID(item.Evaluateid); List <ViewEvaluatesGroup> entitylist = new List <ViewEvaluatesGroup>(); foreach (var it in listM) { ViewEvaluatesGroup entityMsg = new ViewEvaluatesGroup(); entityMsg.entity = it; //评论人 ViewYogaUser usermodel2 = clientUser.GetYogaUserById(it.FromUid.Value); if (usermodel2 != null) { entityMsg.FromUser = usermodel2.NickName; } entitylist.Add(entityMsg); } model.msgList = entitylist; listGroupMsg.Add(model); } ViewBag.EvalInfo = listGroupMsg; } #endregion return(c); }
public ViewCenters GetAllMechanis(int id, out int mycount, int page = 1) { ViewCenters c = new ViewCenters(); using (CentersServiceClient client = new CentersServiceClient()) { c = client.GetCentersById(id); } ViewBag.centerid = id; #region 评价列表 int count = 0; int pagesize = 10; List <ViewEvaluatesGroup> listGroupMsg = new List <ViewEvaluatesGroup>(); using (EvaluatesServiceClient clientEval = new EvaluatesServiceClient()) { int tjcount = 0; clientEval.GetRecommendCount(id, out tjcount); ViewBag.Recommend = tjcount; List <ViewEvaluates> evalEntity = new List <ViewEvaluates>(); evalEntity = clientEval.GettEvalUid(id, page, pagesize, out count); mycount = count; foreach (var item in evalEntity) { ViewEvaluatesGroup model = new ViewEvaluatesGroup(); model.entity = item; //评论人 ViewYogaUser usermodel = clientUser.GetYogaUserById(item.FromUid.Value); if (usermodel != null) { model.FromUser = usermodel.NickName; } if (usermodel.UserType == 0) { ViewYogaUserDetail newmodel = clientuserdetail.GetYogaUserDetailById(item.FromUid.Value); if (newmodel != null) { model.DisplayImg = CommonInfo.GetDisplayImg(newmodel.DisplayImg); model.Url = "/YogaUserDetail/Details/" + item.FromUid.Value; } } else { ViewYogisModels newmodel = clientmodel.GetYogisModelsById(item.FromUid.Value); if (newmodel != null) { model.DisplayImg = CommonInfo.GetDisplayImg(newmodel.DisplayImg); model.FromUser = newmodel.RealName; if (newmodel.YogisLevel == 4) { model.Url = "/Yogaguru/Details/" + item.FromUid.Value; } else { model.Url = "/YogisModels/Details/" + item.FromUid.Value; } } } //回复 List <ViewEvaluates> listM = clientEval.GetEvalParentID(item.Evaluateid); List <ViewEvaluatesGroup> entitylist = new List <ViewEvaluatesGroup>(); foreach (var it in listM) { ViewEvaluatesGroup entityMsg = new ViewEvaluatesGroup(); entityMsg.entity = it; //评论人 ViewYogaUser usermodel2 = clientUser.GetYogaUserById(it.FromUid.Value); if (usermodel2 != null) { entityMsg.FromUser = usermodel2.NickName; } entitylist.Add(entityMsg); } model.msgList = entitylist; listGroupMsg.Add(model); } ViewBag.EvalInfo = listGroupMsg; } #endregion return(c); }
// // GET: /Mechanism/ public ActionResult Index(int page = 1, string id = "0") { //派别 int typeid = 0; if (!string.IsNullOrEmpty(Request.Form["typeid"])) { typeid = Convert.ToInt32(Request.Form["typeid"]); } //瑜伽类别 if (!string.IsNullOrEmpty(Request.Form["centerclassid"])) { id = Request.Form["centerclassid"]; } //国家 int CountryID = 0; if (!string.IsNullOrEmpty(Request.Form["hidCountryID"])) { CountryID = Convert.ToInt32(Request.Form["hidCountryID"]); } //省份 int ProvinceID = 0; if (!string.IsNullOrEmpty(Request.Form["hidProvinceID"])) { ProvinceID = Convert.ToInt32(Request.Form["hidProvinceID"]); } //城市 int CityID = 0; if (!string.IsNullOrEmpty(Request.Form["hidCityID"])) { CityID = Convert.ToInt32(Request.Form["hidCityID"]); } //地区 int DistrictID = 0; if (!string.IsNullOrEmpty(Request.Form["hidDistrictID"])) { DistrictID = Convert.ToInt32(Request.Form["hidDistrictID"]); } List <ViewCenters> list = new List <ViewCenters>(); int count = 0; int pagesize = 5; using (CentersServiceClient client = new CentersServiceClient()) { list = client.GetCentersPageList("", DistrictID, CityID, ProvinceID, CountryID, typeid, id, page, pagesize, out count); } List <ViewCentersGroup> centergroups = new List <ViewCentersGroup>(); ViewCentersGroup centergroup = new ViewCentersGroup(); using (EvaluatesServiceClient eclient = new EvaluatesServiceClient()) { int rcount = 0; foreach (ViewCenters c in list) { rcount = 0; centergroup = new ViewCentersGroup(); centergroup.center = c; eclient.GetRecommendCount(c.CenterId, out rcount); centergroup.recommond = rcount; //派别 string typename = string.Empty; if (c.YogaTypeid != null) { string[] arrtypeid = c.YogaTypeid.Replace("|", "").Split(','); for (int i = 0; i < arrtypeid.Length; i++) { if (!String.IsNullOrEmpty(arrtypeid[i])) { typename += dicclient.GetYogaDicItemById(Convert.ToInt32(arrtypeid[i])).ItemName + ","; } } if (!String.IsNullOrEmpty(typename)) { typename = typename.Substring(0, typename.Length - 1); } } centergroup.Address = method.GetItemName(c.CountryID.Value) + "·" + method.GetItemName(c.ProvinceID.Value) + "·" + method.GetItemName(c.CityID.Value) + "·" + method.GetItemName(c.DistrictID.Value); centergroup.centertype = typename; centergroups.Add(centergroup); } } Webdiyer.WebControls.Mvc.PagedList <ViewCentersGroup> pagelist = new Webdiyer.WebControls.Mvc.PagedList <ViewCentersGroup>(centergroups, page, pagesize, count); if (Request.IsAjaxRequest()) { return(PartialView("IndexList", pagelist)); } return(View(pagelist)); }