Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">报道ClassId</param>
        /// <param name="classReportId">报道id</param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult ActivityReportDetailsPage(int id, int classReportId, int page = 1)
        {
            ViewBag.id = id;
            int       rcount   = 0;
            int       pagesize = 10;
            ViewClass entity   = new ViewClass();

            entity = client.Get(id);

            if (entity.iReadNums == null)
            {
                entity.iReadNums = 1;
            }
            else
            {
                entity.iReadNums++;
            }
            client.Edit(entity);
            ViewBag.iShareNums = entity.iShareNums == null ? 0 : entity.iShareNums;

            ViewBag.Entity     = entity;
            ViewBag.interCount = interclient.Count(id);                    //分享人数

            ViewBag.MsgInfo = method.listMessage(id, 3, page, out rcount); //评论

            YogisModelsServiceClient ymClient = new YogisModelsServiceClient();
            //老师粉丝
            FollowServiceClient followClient = new FollowServiceClient();
            int teacherFollowCount           = 0;

            foreach (var item in entity.Teachers)
            {
                //followClient.GetFollowUidList(item.UserId, 1, 1, out teacherFollowCount);
                //ViewData[item.UserId.ToString()] = teacherFollowCount;
                var ymModel = ymClient.GetById((int)item.TeacherId);
                int num     = followClient.GetFollowByCount(ymModel.UID);
                ViewData[item.UserId.ToString()] = num;
            }
            //发起人粉丝
            ViewBag.Sponsor = followClient.GetFollowByCount(entity.UserId);

            Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup> messlist = new Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup>(ViewBag.MsgInfo, page, pagesize, rcount);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("PartialMessage", messlist));
            }

            ViewData["ClassStatus"] = Session["ClassStatus"];

            using (ClassReportServiceClient rClient = new ClassReportServiceClient())
            {
                List <ViewClassReport> classReportList = rClient.GetClassId(id);
                ViewBag.ClassReport     = classReportList;
                ViewBag.ClassReportShow = new ViewClassReport();
                if (classReportList.Any())
                {
                    if (classReportId == -99)
                    {
                        ViewBag.ClassReportShow = classReportList.First();
                    }
                    else
                    {
                        ViewBag.ClassReportShow = classReportList.First(p => p.Id == classReportId);
                    }
                }
            }

            return(View(messlist));
        }
        /// <summary>
        /// 升级导师审核中页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Audit()
        {
            #region 登录者的级别
            if (user.UserType == 0)
            {
            }
            else//导师级别
            {
                ViewYogisModels vyogism = new ViewYogisModels();
                vyogism = mclient.GetYogisModelsById(user.Uid);
                if (vyogism != null)
                {
                    ViewBag.level = vyogism.YogisLevel;
                }
            }
            #endregion
            int             id    = user.Uid;
            ViewYogisModels model = new ViewYogisModels();

            using (YogisModelsServiceClient client = new YogisModelsServiceClient())
            {
                model = client.GetYogisModelsById(id);
                if (model != null)
                {
                    #region
                    //昵称

                    using (YogaUserServiceClient YogaUserServiceClient = new YogaUserServiceClient())
                    {
                        ViewBag.NickName = YogaUserServiceClient.GetYogaUserById(model.UID).NickName ?? "";
                    }

                    #region 会馆
                    if (!string.IsNullOrEmpty(model.CenterID))
                    {
                        string[] cenlist = model.CenterID.Split(',');

                        List <ViewCenters> listcenter = new List <ViewCenters>();
                        using (CentersServiceClient CentersServiceClient = new CentersServiceClient())
                        {
                            listcenter = CentersServiceClient.GetCentersUid();

                            string strCentValue = "";
                            foreach (var i in cenlist)
                            {
                                foreach (var itemCenter in listcenter)
                                {
                                    if (i.ToString() == itemCenter.CenterId.ToString())
                                    {
                                        strCentValue += itemCenter.CenterName + ',';
                                    }
                                }
                            }
                            ViewBag.CentValue = strCentValue;
                        }
                    }
                    #endregion

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

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

                    #region 导师列表

                    if (!string.IsNullOrEmpty(model.TeachYogis))
                    {
                        string[]        TeachYogislist     = model.TeachYogis.Split(',');
                        ViewYogisModels model3             = new ViewYogisModels();
                        string          strTeachYogisValue = "";
                        foreach (var k in TeachYogislist)
                        {
                            model3 = client.GetById(Convert.ToInt32(k));
                            if (model3 != null)
                            {
                                strTeachYogisValue += model3.RealName + ',';
                            }
                        }
                        ViewBag.TeachYogisValue = strTeachYogisValue;
                    }
                    #endregion

                    //国籍
                    if (!string.IsNullOrEmpty(model.Nationality))
                    {
                        if (model.Nationality != "0")
                        {
                            using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient())
                            {
                                ViewBag.Nationality = YogaDicItemServiceClient.GetYogaDicItemById(Convert.ToInt32(model.Nationality)).ItemName ?? "";
                            }
                        }
                    }


                    //国家

                    if (model.CountryID != null && model.CountryID != 0)
                    {
                        using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient())
                        {
                            ViewBag.CountryID = YogaDicItemServiceClient.GetYogaDicItemById(model.CountryID.Value).ItemName ?? "";
                        }
                    }
                    else
                    {
                        ViewBag.CountryID = "";
                    }

                    //地址;  省 城市 城区
                    if (model.ProvinceID != null && model.ProvinceID != 0)
                    {
                        using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient())
                        {
                            ViewBag.ProvinceID = YogaDicItemServiceClient.GetYogaDicItemById(model.ProvinceID.Value).ItemName ?? "";
                        }
                    }
                    else
                    {
                        ViewBag.ProvinceID = "";
                    }
                    if (model.CityID != null && model.CityID != 0)
                    {
                        using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient())
                        {
                            ViewBag.CityID = YogaDicItemServiceClient.GetYogaDicItemById(model.CityID.Value).ItemName ?? "";
                        }
                    }
                    else
                    {
                        ViewBag.CityID = "";
                    }
                    if (model.DistrictID != null && model.DistrictID != 0)
                    {
                        using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient())
                        {
                            ViewBag.DistrictID = YogaDicItemServiceClient.GetYogaDicItemById(model.DistrictID.Value).ItemName ?? "";
                        }
                    }
                    else
                    {
                        ViewBag.DistrictID = "";
                    }
                    ViewBag.Address = ViewBag.ProvinceID + "--" + ViewBag.CityID + "--" + ViewBag.DistrictID;
                    #endregion
                }
                else
                {
                    ViewBag.CentValue       = "";
                    ViewBag.YogaTypeidValue = "";
                    ViewBag.TeachYogisValue = "";
                }
            }
            YogiProfileServiceClient proClient = new YogiProfileServiceClient();
            ViewYogiProfile          pro       = proClient.GetYogiProfileById(id);
            if (pro != null)
            {
                ViewBag.pro = pro;
            }
            //using (YogaPictureServiceClient clientpic = new YogaPictureServiceClient())
            //{
            //    List<ViewYogaPicture> pic = clientpic.GetUidList(id);
            //    if (pic != null)
            //    {
            //        ViewBag.Pic = pic;
            //    }
            //}
            return(View(model));
        }
Esempio n. 3
0
        public ActionResult ViewActivity(int id)
        {
            //, bool isOrder = false ViewBag.isOrder = isOrder;
            ViewBag.id = id;
            ClassServiceClient       client  = new ClassServiceClient();
            YogaDicItemServiceClient dclient = new YogaDicItemServiceClient();
            ViewClass model             = client.Get(id);
            List <ViewYogaDicItem> dics = dclient.GetSelectList(model.TopicIds);

            model.TopicIds = "";
            //主题
            foreach (var item in dics)
            {
                if (model.TopicIds == "")
                {
                    model.TopicIds = item.ItemName;
                }
                else
                {
                    model.TopicIds = model.TopicIds + " " + item.ItemName;
                }
            }
            //发起人头像
            model.Poster = client.GetAvatars(model.UserId.ToString())[0];

            //兴趣
            InterestServiceClient interestClient = new InterestServiceClient();

            ViewBag.IsInterest    = interestClient.Exists(id, user.Uid);
            ViewBag.InterestCount = interestClient.ClassInterests(id, 1, 10).RecordCount;

            ////老师粉丝
            //FollowServiceClient followClient = new FollowServiceClient();
            //int teacherFollowCount = 0;
            //foreach (var item in model.Teachers)
            //{
            //    followClient.GetFollowUidList(item.UserId, 1, 1, out teacherFollowCount);
            //    ViewData[item.UserId.ToString()] = teacherFollowCount;
            //}

            YogisModelsServiceClient ymClient = new YogisModelsServiceClient();
            //老师粉丝
            FollowServiceClient followClient = new FollowServiceClient();

            foreach (var item in model.Teachers)
            {
                //followClient.GetFollowUidList(item.UserId, 1, 1, out teacherFollowCount);
                //ViewData[item.UserId.ToString()] = teacherFollowCount;
                var ymModel = ymClient.GetById((int)item.TeacherId);
                int num     = followClient.GetFollowByCount(ymModel.UID);
                ViewData[item.UserId.ToString()] = num;
            }
            //发起人粉丝
            ViewBag.Sponsor = followClient.GetFollowByCount(model.UserId);

            //参加
            OrderServiceClient orderClient = new OrderServiceClient();
            // 只查询出有效的订单
            PageResult <ViewOrder> orders = orderClient.GetByClass(id, 1, 6000);

            //等待加入
            #region
            string uids      = "";
            int    joinCount = 0;
            foreach (ViewOrder item in orders.Objects)
            {
                if (uids == "")
                {
                    uids = item.UserId.ToString();
                }
                else
                {
                    uids += "," + item.UserId;
                }
                joinCount += item.Number;
            }
            ViewBag.JoinCount = joinCount;
            List <UserListItem> orderAvatars   = client.GetAvatars(uids == "" ? "0" : uids);
            List <UserListItem> allJoinAvatars = new List <UserListItem>();
            foreach (var item in orders.Objects)
            {
                foreach (var ui in orderAvatars)
                {
                    if (item.UserId == ui.ID)
                    {
                        for (int i = 0; i < item.Number; i++)
                        {
                            allJoinAvatars.Add(ui);
                        }
                    }
                }
            }
            ViewData["AllJoinAvatars"] = allJoinAvatars;
            #endregion

            return(View(model));
        }
Esempio n. 4
0
        /// <summary>
        /// 获得当前人的级别
        /// </summary>
        /// <param name="uid">用户ID</param>
        /// <returns></returns>
        public static string GetCurrentLevel(BasicInfo bas)
        {
            string levelname = string.Empty;

            if (bas != null)
            {
                int type = bas.UserType.Value;

                if (type == 0)
                {
                    //习练者
                    using (YogaUserDetailServiceClient userclient = new YogaUserDetailServiceClient())
                    {
                        ViewYogaUserDetail userdetail = userclient.GetYogaUserDetailById(bas.Uid);
                        if (userdetail != null)
                        {
                            int level = userdetail.Ulevel;
                            switch (level)
                            {
                            case (0):
                                levelname = MemberLevel.基础习练者.ToString();
                                break;

                            case (1):
                                levelname = MemberLevel.初级习练者.ToString();
                                break;

                            case (2):
                                levelname = MemberLevel.中级习练者.ToString();
                                break;

                            case (3):
                                levelname = MemberLevel.高级习练者.ToString();
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
                else
                {
                    //导师
                    using (YogisModelsServiceClient modelclient = new YogisModelsServiceClient())
                    {
                        ViewYogisModels model = modelclient.GetById(bas.Uid);
                        if (model != null)
                        {
                            int level = model.YogisLevel.Value;
                            switch (level)
                            {
                            case (0):
                                levelname = TeacherLevel.初级老师.ToString();
                                break;

                            case (1):
                                levelname = TeacherLevel.中级老师.ToString();
                                break;

                            case (2):
                                levelname = TeacherLevel.高级老师.ToString();
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
            return(levelname);
        }