Пример #1
0
        public ActionResult ValidateMessage()
        {
            var Owner    = GetCurrentUser();
            var PlaceIds = GetVerifiedPlaceIds();
            //用户创建的圈子ID集合
            var sIds = Owner.SocialCircles.Select(s => s.Id).ToList();

            IUserSocialCircleBLL UserSocialCircleBll = BLLFactory <IUserSocialCircleBLL> .GetBLL("UserSocialCircleBLL");

            MyListSocialCircleModel model = new MyListSocialCircleModel();

            model.MyListSocialCircle = UserSocialCircleBll.GetList(s => sIds.Contains(s.SocialCircleId) && PlaceIds.Contains(s.SocialCircle.PlaceId)).ToList().Select(s => new MySocialCircleModel()
            {
                Id          = s.Id,
                Name        = s.SocialCircle.Name,
                UserName    = s.ApplyUser.UserName,
                ApplyStatus = s.ApplyStatus,
                ApplyTime   = s.ApplyTime,
                HeadPath    = string.IsNullOrEmpty(s.ApplyUser.HeadPath) ? "/Images/news_item_default.png" : s.ApplyUser.HeadPath
            }).OrderByDescending(m => m.ApplyTime).ToList();
            return(View(model));
        }
Пример #2
0
        public ActionResult MyCircle()
        {
            MySocialCircleListModel model = new MySocialCircleListModel();

            var Owner    = GetCurrentUser();
            var PlaceIds = GetVerifiedPlaceIds();
            //用户创建的圈子ID集合
            var sIds = Owner.SocialCircles.Select(s => s.Id).ToList();
            IUserSocialCircleBLL userSocialCircleBll = BLLFactory <IUserSocialCircleBLL> .GetBLL("UserSocialCircleBLL");

            var userSocialCircles = userSocialCircleBll.GetList(us => sIds.Contains(us.SocialCircleId) && PlaceIds.Contains(us.SocialCircle.PlaceId) && us.ApplyStatus == ConstantParam.IsVerified_DEFAULT);

            //获取未处理个数
            model.NoDealCount = userSocialCircles.Count();
            if (model.NoDealCount > 0)
            {
                var usc = userSocialCircles.OrderByDescending(us => us.ApplyTime).First();
                model.ApplyInfo = new ApplyInfoModel()
                {
                    ApplyUserName = usc.ApplyUser.UserName,
                    CircleName    = usc.SocialCircle.Name,
                    ApplyTime     = TimeFormat(usc.ApplyTime)
                };
            }

            //获取我接收到的最新群发消息
            IUserSocialCircleMassTextingBLL usMassTextingBll = BLLFactory <IUserSocialCircleMassTextingBLL> .GetBLL("UserSocialCircleMassTextingBLL");

            var usMassTextings = usMassTextingBll.GetList(m => m.UserId == Owner.Id && PlaceIds.Contains(m.SocialCircleMassTexting.SocialCircle.PlaceId));

            //如果有接收到的群发消息
            if (usMassTextings.Count() > 0)
            {
                var firstMass = usMassTextings.OrderByDescending(m => m.SocialCircleMassTexting.ChatTime).First();
                model.NewsetMass = new MassTextingModel()
                {
                    CircleName   = firstMass.SocialCircleMassTexting.SocialCircle.Name,
                    MassSendTime = TimeFormat(firstMass.SocialCircleMassTexting.ChatTime)
                };
            }
            model.NoReadCount = usMassTextings.Count(um => um.IsNoRead);

            ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL");

            //获取我创建的圈子列表
            model.CreateList = socialCircleBLL.GetList(s => s.CreaterId == Owner.Id && PlaceIds.Contains(s.PlaceId)).ToList().Select(s => new SocialCircleItemModel()
            {
                Id             = s.Id,
                Name           = s.Name,
                PlaceName      = s.PropertyPlace.Name,
                HeadPath       = s.HeadImgPath,
                NewestChatTime = s.SocialCircleChats.Count > 0 ? TimeFormat(s.SocialCircleChats.OrderByDescending(c => c.ChatTime).First().ChatTime) : ""
            }).ToList();
            //获取我加入的圈子列表
            model.JoinList = GetCurrentUser().UserSocialCircles.Where(us => us.ApplyStatus == ConstantParam.IsVerified_YES && PlaceIds.Contains(us.SocialCircle.PlaceId)).ToList().Select(us => new SocialCircleItemModel()
            {
                Id             = us.SocialCircleId,
                Name           = us.SocialCircle.Name,
                PlaceName      = us.SocialCircle.PropertyPlace.Name,
                HeadPath       = us.SocialCircle.HeadImgPath,
                NewestChatTime = us.SocialCircle.SocialCircleChats.Count > 0 ? TimeFormat(us.SocialCircle.SocialCircleChats.OrderByDescending(c => c.ChatTime).First().ChatTime) : ""
            }).Distinct(new SocialCircleComparer()).ToList();
            return(View(model));
        }