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); }