예제 #1
0
 public FeedController()
 {
     feedService = new FeedService();
     friendService = new FriendService();
     visitorService = new VisitorService();
     followService = new FollowerService();
 }
예제 #2
0
 public FriendController() {
     followService = new FollowerService();
     friendService = new FriendService();
     userService = new UserService();
     blacklistService = new BlacklistService();
     LayoutControllerType = typeof( MicroblogController );
 }
예제 #3
0
 public MicroblogService()
 {
     feedService = new FeedService();
     nfService = new NotificationService();
     friendService = new FriendService();
     followerService = new FollowerService();
 }
예제 #4
0
 public PhotoPostService()
 {
     friendService = new FriendService();
     pickedService = new PickedService();
     incomeService = new UserIncomeService();
     followerService = new FollowerService();
 }
예제 #5
0
        public virtual void DeleteFriend(long userId, long fid, String ip)
        {
            FollowerService followService = new FollowerService();

            String     condition = "User.Id=" + userId + " and Friend.Id=" + fid + " and Status=" + FriendStatus.Approved;
            FriendShip ship      = db.find <FriendShip>(condition).first();

            if (ship != null)
            {
                db.delete(ship);
                if (followService.IsFollowing(userId, fid) == false)
                {
                    followService.Follow(userId, fid, ip);
                }
                recountFriends(userId);
                recountFriends(fid);

                return;
            }

            condition = "User.Id=" + fid + " and Friend.Id=" + userId + " and Status=" + FriendStatus.Approved;
            ship      = db.find <FriendShip>(condition).first();
            if (ship != null)
            {
                db.delete(ship);
                if (followService.IsFollowing(fid, userId) == false)
                {
                    followService.Follow(fid, userId, ip);
                }
                recountFriends(userId);
                recountFriends(fid);
            }
        }
예제 #6
0
 public ViewerContext( MvcContext ctx )
 {
     friendService = new FriendService();
     msgService = new MessageService();
     followService = new FollowerService();
     this.ctx = ctx;
 }
예제 #7
0
 public FriendController()
 {
     friendService = new FriendService();
     userService = new UserService();
     followService = new FollowerService();
     blacklistService = new BlacklistService();
 }
예제 #8
0
        public virtual Result AddFriend( int userId, int friendId, String msg )
        {
            Result result = CanAddFriend( userId, friendId );
            if (result.HasErrors) return result;

            FriendShip fs = new FriendShip();

            User user = userService.GetById( userId );
            User friend = userService.GetById( friendId );

            fs.User = user;
            fs.Friend = friend;
            fs.Msg = msg;

            fs.Status = FriendStatus.Waiting;

            result = db.insert( fs );
            if (result.IsValid) {
                string userLink = Link.ToMember( user );
                String note = string.Format( "<a href=\"{0}\" target=\"_blank\" class=\"requestUser\">{1}</a> " + lang.get( "requestFriend" ), userLink, user.Name );
                if (strUtil.HasText( msg )) {
                    note += "<br/><span class=\"quote\">" + msg + "</span>";
                }
                notificationService.sendFriendRequest( userId, friendId, note );

                // 顺带添加关注
                FollowerService followService = new FollowerService();
                if (followService.IsFollowing( userId, friendId ) == false)
                    followService.Follow( userId, friendId );
            }
            return result;
        }
예제 #9
0
        public MicroblogCommentsController()
        {
            microblogService = new MicroblogService();
            followService = new FollowerService();
            commentService = new MicroblogCommentService();

            LayoutControllerType = typeof( MicroblogController );
        }
예제 #10
0
        public ShareController()
        {
            feedService = new FeedService();
            friendService = new FriendService();
            followService = new FollowerService();

            shareService = new ShareService();
        }
예제 #11
0
 public MicroblogController()
 {
     microblogService = new MicroblogService();
     followService = new FollowerService();
     visitorService = new VisitorService();
     mfService = new MicroblogFavoriteService();
     commentService = new MicroblogCommentService();
     matService = new MicroblogAtService();
     userTagService = new UserTagService();
 }
예제 #12
0
 public MicroblogController()
 {
     microblogService = new MicroblogService();
     followService = new FollowerService();
     visitorService = new VisitorService();
     mfService = new MicroblogFavoriteService();
     commentService = new MicroblogCommentService();
     matService = new MicroblogAtService();
     videoSpider = new WojiluVideoSpider();
 }
예제 #13
0
 public HomeController()
 {
     microblogService = new MicroblogService();
     followService = new FollowerService();
     visitorService = new VisitorService();
     mfService = new MicroblogFavoriteService();
     commentService = new OpenCommentService();
     photoPostService = new PhotoPostService();
     friendService = new FriendService();
     blogAppService = new BlogService();
     photoAppService = new PhotoService();
 }
예제 #14
0
        public virtual Result AddFriend(long userId, long friendId, String msg, String ip)
        {
            Result result = CanAddFriend(userId, friendId);

            if (result.HasErrors)
            {
                return(result);
            }

            FriendShip fs = new FriendShip();

            User user   = userService.GetById(userId);
            User friend = userService.GetById(friendId);

            fs.User   = user;
            fs.Friend = friend;
            fs.Msg    = msg;

            fs.Status = FriendStatus.Waiting;
            fs.Ip     = ip;

            result = db.insert(fs);
            if (result.IsValid)
            {
                string userLink = Link.ToMember(user);
                String note     = string.Format("<a href=\"{0}\" target=\"_blank\" class=\"requestUser\">{1}</a> " + lang.get("requestFriend"), userLink, user.Name);
                if (strUtil.HasText(msg))
                {
                    note += "<br/><span class=\"quote\">" + msg + "</span>";
                }
                notificationService.sendFriendRequest(userId, friendId, note);

                // 顺带添加关注
                FollowerService followService = new FollowerService();
                if (followService.IsFollowing(userId, friendId) == false)
                {
                    followService.Follow(userId, friendId, ip);
                }
            }
            return(result);
        }
예제 #15
0
        public virtual void DeleteFriend( long userId, long fid, String ip )
        {
            FollowerService followService = new FollowerService();

            String condition = "User.Id=" + userId + " and Friend.Id=" + fid + " and Status=" + FriendStatus.Approved;
            FriendShip ship = db.find<FriendShip>( condition ).first();
            if (ship != null) {
                db.delete( ship );
                if (followService.IsFollowing( userId, fid ) == false) {
                    followService.Follow( userId, fid, ip );
                }
                recountFriends( userId );
                recountFriends( fid );

                return;
            }

            condition = "User.Id=" + fid + " and Friend.Id=" + userId + " and Status=" + FriendStatus.Approved;
            ship = db.find<FriendShip>( condition ).first();
            if (ship != null) {
                db.delete( ship );
                if (followService.IsFollowing( fid, userId ) == false) {
                    followService.Follow( fid, userId, ip );
                }
                recountFriends( userId );
                recountFriends( fid );

            }
        }
예제 #16
0
        public virtual void DeleteFriendByBlacklist( int userId, int fid )
        {
            FollowerService followService = new FollowerService();

            String condition = "User.Id=" + userId + " and Friend.Id=" + fid + " and Status=" + FriendStatus.Approved;
            FriendShip ship = db.find<FriendShip>( condition ).first();
            if (ship != null) {
                db.delete( ship );
                if (followService.IsFollowing( userId, fid )) followService.DeleteFollow( userId, fid );
                recountFriends( userId );
                recountFriends( fid );

                return;
            }

            condition = "User.Id=" + fid + " and Friend.Id=" + userId + " and Status=" + FriendStatus.Approved;
            ship = db.find<FriendShip>( condition ).first();
            if (ship != null) {
                db.delete( ship );
                if (followService.IsFollowing( fid, userId )) followService.DeleteFollow( fid, userId );
                recountFriends( userId );
                recountFriends( fid );

            }
        }
예제 #17
0
 public BlacklistService()
 {
     userService = new UserService();
     friendService = new FriendService();
     followerService = new FollowerService();
 }
예제 #18
0
 public FeedService()
 {
     friendService = new FriendService();
     followerService = new FollowerService();
     nfService = new NotificationService();
 }
예제 #19
0
 public ShareCommentsController()
 {
     shareService = new ShareService();
     followService = new FollowerService();
 }
예제 #20
0
 public ViewerContext()
 {
     friendService = new FriendService();
     msgService = new MessageService();
     followService = new FollowerService();
 }