예제 #1
0
        public ActionResult SchoolPicList(int id, int page = 1)
        {
            ViewCenters c = new ViewCenters();

            using (CentersServiceClient client = new CentersServiceClient())
            {
                c = client.GetCentersById(id);
            }
            int mycount = 0;

            ViewBag.url       = Request.Url.AbsolutePath;
            ViewBag.id        = id;
            ViewBag.C         = c;
            ViewBag.evalcount = mycount;

            #region 机构相册
            List <ViewYogaPicture> pic = null;
            using (YogaPictureServiceClient clientpic = new YogaPictureServiceClient())
            {
                //机构相册分类5
                pic = clientpic.GetListByType(id, 5);
            }

            #endregion

            return(View(pic));
        }
예제 #2
0
        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);
        }
예제 #3
0
        /// <summary>
        /// 返回学院简介
        /// </summary>
        /// <param name="id">学院编号</param>
        /// <returns></returns>
        public string SchoolDetailsByJson(int id)
        {
            ViewCenters c = new ViewCenters();

            using (CentersServiceClient client = new CentersServiceClient())
            {
                c = client.GetCentersById(id);
            }
            return(c.CenterProfile);
        }
예제 #4
0
        //
        // GET: /Manage/Centers/Edit/5

        public ActionResult Edit(int id)
        {
            ViewCenters center = new ViewCenters();

            center = client.GetCentersById(id);

            #region 流派
            if (!string.IsNullOrEmpty(center.YogaTypeid))
            {
                string[] YogaTypeidlist = center.YogaTypeid.Replace("|", "").Split(',');

                List <ViewYogaDicItem> listcenter2 = new List <ViewYogaDicItem>();
                using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient())
                {
                    listcenter2 = YogaDicItemServiceClient.GetYogaDicItemList();
                    string strYogaTypeidValue = "";
                    foreach (var j in YogaTypeidlist)
                    {
                        if (!string.IsNullOrEmpty(j))
                        {
                            foreach (var itemDic in listcenter2)
                            {
                                if (j.ToString() == itemDic.ID.ToString())
                                {
                                    strYogaTypeidValue += itemDic.ItemName + ',';
                                }
                            }
                        }
                    }
                    ViewBag.YogaTypeidValue = strYogaTypeidValue;
                }
            }

            #endregion

            return(View(center));
        }
예제 #5
0
        /// <summary>
        /// 格式化json
        /// </summary>
        /// <param name="imgs"></param>
        /// <returns></returns>
        private string FormateJson(List <ViewYogaPicture> imgs, int id, int imgid)
        {
            //获得当前相册人
            ViewCenters center = null;

            //获得当前相册人
            ViewYogisModels             model         = null;
            ViewYogaUserDetail          udetail       = null;
            ViewYogaUser                u             = null;
            YogaUserDetailServiceClient udetailClient = new YogaUserDetailServiceClient();
            YogisModelsServiceClient    modelClient   = new YogisModelsServiceClient();
            YogaUserServiceClient       userClient    = new YogaUserServiceClient();

            string defaultimg  = string.Empty;
            string defaultname = string.Empty;


            using (CentersServiceClient centerClient = new CentersServiceClient())
            {
                center = centerClient.GetCentersById(id);
            }


            if (center != null)
            {
                defaultimg  = center.CenterPortraint;
                defaultname = center.CenterName;
            }

            tMessageServiceClient mesClient = new tMessageServiceClient();


            StringBuilder sb = new StringBuilder();

            sb.Append("{");
            sb.Append("\"code\":1,");
            sb.Append("\"album\":\"默认相册\",");
            sb.Append(String.Format("\"showimages\":\"{0}\",", imgid));
            sb.Append("\"thumbList\":[");

            using (tMessageServiceClient msgClient = new tMessageServiceClient())
            {
                foreach (ViewYogaPicture img in imgs)
                {
                    sb.Append("{");
                    sb.Append("\"id\":");
                    sb.Append(String.Format("\"{0}\",", img.Pid));
                    sb.Append("\"title\":");
                    sb.Append("\"相册\",");
                    sb.Append("\"user\":");
                    sb.Append(String.Format("\"{0}\",", defaultname));
                    sb.Append("\"avatar\":");
                    sb.Append(String.Format("\"{0}\",", defaultimg));
                    sb.Append("\"time\":");
                    sb.Append(string.Format("\"{0}\",", img.CreateTime == null ? "" : Convert.ToDateTime(img.CreateTime).ToString("yyyy-MM-dd HH:mm")));
                    sb.Append("\"desc\":");
                    sb.Append(string.Format("\"{0}\",", img.PictureContent));
                    sb.Append("\"thumb\":");
                    sb.Append(string.Format("\"{0}\",", img.PictureOriginal));
                    sb.Append("\"large\":");
                    sb.Append(string.Format("\"{0}\",", img.PictureOriginal));
                    sb.Append("\"comment\":");
                    sb.Append("[");
                    List <ViewtMessage> messages = mesClient.GettMessageUid(img.Pid, 5);
                    foreach (ViewtMessage v in messages)
                    {
                        string defcovimg = string.Empty;
                        string defname   = string.Empty;
                        if (v.FormType == 0)
                        {
                            udetail = udetailClient.GetYogaUserDetailById((int)v.FromUid);
                            if (udetail != null)
                            {
                                defcovimg = CommonInfo.GetDisplayImg(udetail.DisplayImg);
                            }
                            u = userClient.GetYogaUserById((int)v.FromUid);
                            if (u != null)
                            {
                                defname = u.NickName;
                            }
                        }
                        else
                        {
                            model = modelClient.GetYogisModelsById((int)v.FromUid);
                            if (model != null)
                            {
                                defcovimg = CommonInfo.GetDisplayImg(model.DisplayImg);
                                defname   = model.RealName;
                            }
                        }

                        sb.Append("{");
                        sb.Append("\"avatar\":");
                        sb.Append(String.Format("\"{0}\",", defcovimg));
                        sb.Append("\"user\":");
                        sb.Append(String.Format("\"{0}\",", defname));
                        sb.Append("\"msg\":");
                        sb.Append(String.Format("\"{0}\"", v.sContent));
                        sb.Append("},");
                    }
                    if (messages != null && messages.Count > 0)
                    {
                        sb.Remove(sb.Length - 1, 1);
                    }

                    sb.Append("]");
                    sb.Append("},");
                }
            }
            if (imgs != null && imgs.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }


            sb.Append("]");
            sb.Append("}");
            return(sb.ToString());
        }
예제 #6
0
        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);
        }