Exemplo n.º 1
0
 public FeedController()
 {
     feedService = new FeedService();
     friendService = new FriendService();
     visitorService = new VisitorService();
     followService = new FollowerService();
 }
Exemplo n.º 2
0
 public FriendController() {
     followService = new FollowerService();
     friendService = new FriendService();
     userService = new UserService();
     blacklistService = new BlacklistService();
     LayoutControllerType = typeof( MicroblogController );
 }
Exemplo n.º 3
0
 public MicroblogService()
 {
     feedService = new FeedService();
     nfService = new NotificationService();
     friendService = new FriendService();
     followerService = new FollowerService();
 }
Exemplo n.º 4
0
 public PhotoPostService()
 {
     friendService = new FriendService();
     pickedService = new PickedService();
     incomeService = new UserIncomeService();
     followerService = new FollowerService();
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 6
0
 public ViewerContext( MvcContext ctx )
 {
     friendService = new FriendService();
     msgService = new MessageService();
     followService = new FollowerService();
     this.ctx = ctx;
 }
Exemplo n.º 7
0
 public FriendController()
 {
     friendService = new FriendService();
     userService = new UserService();
     followService = new FollowerService();
     blacklistService = new BlacklistService();
 }
Exemplo n.º 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;
        }
Exemplo n.º 9
0
        public MicroblogCommentsController()
        {
            microblogService = new MicroblogService();
            followService = new FollowerService();
            commentService = new MicroblogCommentService();

            LayoutControllerType = typeof( MicroblogController );
        }
Exemplo n.º 10
0
        public ShareController()
        {
            feedService = new FeedService();
            friendService = new FriendService();
            followService = new FollowerService();

            shareService = new ShareService();
        }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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);
        }
Exemplo n.º 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 );

            }
        }
Exemplo n.º 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 );

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