Beispiel #1
0
 /// <summary>
 /// 星级打分
 /// </summary>
 /// <returns></returns>
 public JsonResult SaveStare()
 {
     try
     {
         using (CenterStareServiceClient client = new CenterStareServiceClient())
         {
             int uid = user.Uid;
             int mid = Convert.ToInt32(Request.Form["mid"]);
             if (client.IfUidSave(uid, mid) > 0)
             {
                 return(Json(new { code = 2 })); //已经推荐,不需重复推荐
             }
             else
             {
                 ViewCenterStare model = new ViewCenterStare();
                 decimal         price = 0;
                 if (Request.Form["price"] != null)
                 {
                     if (Request.Form["price"] != "")
                     {
                         price = Convert.ToDecimal(Request.Form["price"].ToString());
                     }
                 }
                 model.Price       = price;
                 model.Centerclass = GetPar("centerclass");
                 model.Service     = GetPar("service");
                 model.Env         = GetPar("env");
                 model.CreateDate  = DateTime.Now;
                 model.Uid         = uid;
                 model.Mid         = mid;
                 model.Satate      = 0;//打分状态
                 client.Add(model);
                 return(Json(new { code = 0 }));
             }
         }
     }
     catch (Exception ex)
     {
         return(Json(new { code = ex.Message }));
     }
 }
        //
        // GET: /Mechanism/Details/5

        public ActionResult Details(int id, int page = 1)
        {
            int mycount = 0;

            ViewBag.url = Request.Url.AbsolutePath;
            ViewCenters c = GetAllMechanis(id, out mycount, page);

            ViewBag.C         = c;
            ViewBag.evalcount = mycount;

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

            #endregion

            #region 机构星级分数
            using (CenterStareServiceClient client = new CenterStareServiceClient())
            {
                int     count       = 0;
                decimal price       = 0;
                double  centerclass = 0;
                double  env         = 0;
                double  service     = 0;
                List <ViewCenterStare> starelist = client.GetCentersPageList(id, out count);
                if (starelist != null && starelist.Count != 0)
                {
                    price       = (from s in starelist select s.Price).Average();
                    centerclass = (from s in starelist select s.Centerclass).Average();
                    env         = (from s in starelist select s.Env).Average();
                    service     = (from s in starelist select s.Service).Average();
                }
                ViewBag.price       = price;
                ViewBag.centerclass = centerclass;
                ViewBag.env         = env;
                ViewBag.service     = service;
            }
            #endregion


            #region 机构活动
            ClassServiceClient classclient = new ClassServiceClient();
            List <ViewClass>   classlist   = classclient.GetClassesByZhuanYe(0, page, c.CenterId, 3);
            ViewBag.classlist = classlist;
            #endregion

            ViewBag.Members = Members(id);
            Webdiyer.WebControls.Mvc.PagedList <ViewEvaluatesGroup> l = new Webdiyer.WebControls.Mvc.PagedList <ViewEvaluatesGroup>(ViewBag.EvalInfo, page, 10, mycount);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("GetAllMechanis", l));
            }
            return(View(l));
        }