Exemple #1
0
        public JsonResult GetSocialCircleJsonList(SearchModel model)
        {
            PageResultModel m        = new PageResultModel();
            var             ownerId  = GetCurrentUser().Id;
            var             PlaceIds = GetVerifiedPlaceIds();

            //查询条件
            Expression <Func <T_SocialCircle, bool> > where = s => PlaceIds.Contains(s.PlaceId) && s.CreaterId != ownerId &&
                                                              s.UserSocialCircles.Count(us => us.UserId == ownerId && us.ApplyStatus == ConstantParam.IsVerified_YES) == 0;
            if (!string.IsNullOrEmpty(model.Kword))
            {
                where = PredicateBuilder.And(where, s => s.Name.Contains(model.Kword));
            }
            ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL");

            m.Total  = socialCircleBLL.Count(where);
            m.Result = socialCircleBLL.GetPageList(where, "Id", false, model.PageIndex).Select(s => new SocialCircleItemModel()
            {
                Id        = s.Id,
                Name      = s.Name.Length > 10 ? s.Name.Substring(0, 10) + ".." : s.Name,
                PlaceName = s.PropertyPlace.Name.Length > 10 ? s.PropertyPlace.Name.Substring(0, 10) + ".." : s.PropertyPlace.Name,
                HeadPath  = s.HeadImgPath,
                IsApplyed = s.UserSocialCircles.Count(us => us.UserId == ownerId && us.ApplyStatus == 0) > 0
            });
            return(Json(m, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        /// <summary>
        /// 业主圈子首页2
        /// </summary>
        /// <returns></returns>
        public ActionResult Index2()
        {
            ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL");

            //获取验证通过的小区圈子总数
            var PlaceIds = GetVerifiedPlaceIds();

            ViewBag.Count = socialCircleBLL.Count(s => PlaceIds.Contains(s.PlaceId));
            return(View());
        }
Exemple #3
0
        public JsonResult GetSearchMySocialCircle(string kwords)
        {
            var placeIds = GetVerifiedPlaceIds();
            MySocialCircleListModel model = new MySocialCircleListModel();
            var ownerId = GetCurrentUser().Id;
            ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL");

            //我创建的圈子查询条件
            Expression <Func <T_SocialCircle, bool> > where1 = s => s.CreaterId == ownerId && placeIds.Contains(s.PlaceId);

            if (!string.IsNullOrEmpty(kwords))
            {
                where1 = PredicateBuilder.And(where1, s => s.Name.Contains(kwords));
            }
            //获取我创建的圈子列表
            model.CreateList = socialCircleBLL.GetList(where1).ToList().Select(s => new SocialCircleItemModel()
            {
                Id        = s.Id,
                Name      = s.Name.Length > 10 ? s.Name.Substring(0, 10) + ".." : s.Name,
                PlaceName = s.PropertyPlace.Name.Length > 10 ? s.PropertyPlace.Name.Substring(0, 10) + ".." : s.PropertyPlace.Name,
                HeadPath  = s.HeadImgPath
            }).ToList();
            model.CreateCount = socialCircleBLL.Count(where1);

            //我加入的圈子查询条件
            Func <R_UserSocialCircle, bool> where2 = us => us.ApplyStatus == ConstantParam.IsVerified_YES && placeIds.Contains(us.SocialCircle.PlaceId) &&
                                                     (string.IsNullOrEmpty(kwords) ? true : us.SocialCircle.Name.Contains(kwords));

            //获取我加入的圈子列表
            model.JoinList = GetCurrentUser().UserSocialCircles.Where(where2).ToList().Select(us => new SocialCircleItemModel()
            {
                Id             = us.SocialCircleId,
                Name           = us.SocialCircle.Name.Length > 10 ? us.SocialCircle.Name.Substring(0, 10) + ".." : us.SocialCircle.Name,
                PlaceName      = us.SocialCircle.PropertyPlace.Name.Length > 10 ? us.SocialCircle.PropertyPlace.Name.Substring(0, 10) + ".." : us.SocialCircle.PropertyPlace.Name,
                HeadPath       = us.SocialCircle.HeadImgPath,
                NewestChatTime = ""
            }).Distinct(new SocialCircleComparer()).ToList();

            model.JoinCount = model.JoinList.Count;
            return(Json(model, JsonRequestBehavior.AllowGet));
        }