예제 #1
0
        public static List <UserFriendsBO> getAllSuggestions(string UserId)
        {
            List <UserFriendsBO> list = FriendsDAL.getAllSuggestions(UserId);

            foreach (UserFriendsBO Useritem in list)
            {
                BasicInfoBO info = BasicInfoDAL.getBasicInfoByUserId(Useritem.FriendUserId);
                Useritem.Hometown = info.HomeTown;
                Useritem.Location = info.CurrentCity;
                EmployerBO emp = EmployerDAL.getEmployerByUserId(Useritem.FriendUserId);

                Useritem.Employer = emp.Organization;

                UniversityBO uni = UniversityDAL.getUniversityByUniversityId(Useritem.FriendUserId);
                Useritem.Education = uni.UniversityName;
            }
            return(list);
        }
예제 #2
0
        public static void sendFriendSuggestion(string UserId, string FriendId)
        {
            FriendsDAL.sendFriendSuggestion(UserId, FriendId);

            string     emailHost = ConfigurationSettings.AppSettings["EmailHost"];
            SmtpClient client    = new SmtpClient(emailHost);

            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.EnableSsl      = true;

            client.Host = emailHost;
            client.Port = 587;
            string myEmail  = ConfigurationSettings.AppSettings["Email"];
            string Password = ConfigurationSettings.AppSettings["Password"];

            System.Net.NetworkCredential credentials =
                new System.Net.NetworkCredential(myEmail, Password);
            client.UseDefaultCredentials = false;
            client.Credentials           = credentials;

            MailMessage msg = new MailMessage();

            msg.From = new MailAddress(myEmail);
            UserBO ub  = UserDAL.getUserByUserId(UserId);
            UserBO ub2 = UserDAL.getUserByUserId(FriendId);

            msg.To.Add(new MailAddress(ub.Email));
            msg.Subject    = "Pyramid Plus Friend Suggestion";
            msg.IsBodyHtml = true;

            msg.Body = "Dear Pyramid Plus user, Your have been introduced by your friend to " + ub2.FirstName + " " + ub2.LastName + ". ";

            try
            {
                client.Send(msg);
            }
            catch (Exception ex)
            {
            }
        }
예제 #3
0
        public static void confirmRequest(FriendsBO objClass)
        {
            FriendsDAL.confirmRequest(objClass);

            string     emailHost = ConfigurationSettings.AppSettings["EmailHost"];
            SmtpClient client    = new SmtpClient(emailHost);

            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.EnableSsl      = true;

            client.Host = emailHost;
            client.Port = 587;
            string myEmail  = ConfigurationSettings.AppSettings["Email"];
            string Password = ConfigurationSettings.AppSettings["Password"];

            System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(myEmail, Password);
            client.UseDefaultCredentials = false;
            client.Credentials           = credentials;

            MailMessage msg = new MailMessage();

            msg.From = new MailAddress(myEmail);
            UserBO ub = UserDAL.getUserByUserId(objClass.FriendUserId);

            msg.To.Add(new MailAddress(ub.Email));

            msg.Subject    = "Pyramid Plus Friend Request";
            msg.IsBodyHtml = true;

            msg.Body = "Dear Pyramid Plus user, Your friend request has been accepted. ";

            try
            {
                client.Send(msg);
            }
            catch (Exception ex)
            {
            }
        }
예제 #4
0
 public static long countFriendRequests(string UserId, string status)
 {
     return(FriendsDAL.countFriendRequests(UserId, status));
 }
예제 #5
0
 public static void updateFriends(FriendsBO objFriends)
 {
     FriendsDAL.updateFriends(objFriends);
 }
예제 #6
0
 public static bool isExistingFriend(string UserId, string FriendId)
 {
     return(FriendsDAL.isExistingFriend(UserId, FriendId));
 }
예제 #7
0
 public static List <UserFriendsBO> getAllFriendRequests(string UserId, string status)
 {
     return(FriendsDAL.getAllFriendRequests(UserId, status));
 }
예제 #8
0
 public static List <UserFriendsBO> getAllFriendsFilterByList(string UserId, string status, string FilterByListName)
 {
     return(FriendsDAL.getAllFriendsFilterByList(UserId, status, FilterByListName));
 }
예제 #9
0
 public static List <UserFriendsBO> getBirthdayAlertFriends(string UserId)
 {
     return(FriendsDAL.getBirthdayAlertFriends(UserId));
 }
예제 #10
0
 public static void cancelFriendRequest(string UserId, string FriendId)
 {
     FriendsDAL.cancelFriendRequest(UserId, FriendId);
 }
예제 #11
0
 public static void deleteFriends(string FriendsId)
 {
     FriendsDAL.deleteFriends(FriendsId);
 }
예제 #12
0
 public static void sendFriendRequest(string UserId, string FriendId)
 {
     FriendsDAL.sendFriendRequest(UserId, FriendId);
 }
예제 #13
0
 public static void delayRequest(FriendsBO objClass)
 {
     FriendsDAL.delayRequest(objClass);
 }
예제 #14
0
 public static string insertFriends(FriendsBO objFriends)
 {
     return(FriendsDAL.insertFriends(objFriends));
 }
예제 #15
0
 public static List <Friends> getAllFriendsList()
 {
     return(FriendsDAL.getAllFriendsList());
 }
예제 #16
0
 public static List <UserFriendsBO> getFriendsListByName(string UserId, string value)
 {
     return(FriendsDAL.getFriendsListByName(UserId, value));
 }
예제 #17
0
 public static FriendsBO getFriendsByFriendsId(string FriendsId)
 {
     return(FriendsDAL.getFriendsByFriendsId(FriendsId));
 }
예제 #18
0
 public static List <UserFriendsBO> FindByListCurrent(string UserId, string value, string status)
 {
     return(FriendsDAL.FindUserListCurrentCity(UserId, value, status));
 }
예제 #19
0
 public static List <UserFriendsBO> getAllFriendsListName(string UserId, string status)
 {
     return(FriendsDAL.getAllFriendsListName(UserId, status));
 }
예제 #20
0
 public static List <UserFriendsBO> FindByListHomeTown(string UserId, string value, string status)
 {
     return(FriendsDAL.FindUserListHomeTown(UserId, value, status));
 }
예제 #21
0
 public static List <UserFriendsBO> getPSFriends(string UserId)
 {
     return(FriendsDAL.getPSFriends(UserId));
 }
예제 #22
0
 public static List <UserFriendsBO> FindByListWorkPlace(string UserId, string value, string status)
 {
     return(FriendsDAL.FindUserListWorkPlace(UserId, value, status));
 }
예제 #23
0
        public static List <Newsfeed> getNewsfeedByUserId(string UserId, int top)
        {
            List <Newsfeed> lstNewsfeed = new List <Newsfeed>();

            List <UserFriendsBO> lstfriends = new List <UserFriendsBO>();

            MongoCollection <Newsfeed>          objCollection  = db.GetCollection <Newsfeed>("c_Wall");
            MongoCollection <PostHidSpamStatus> objCollection2 = db.GetCollection <PostHidSpamStatus>("c_PostStatus");
            MongoCollection <PostOptions>       objCollection3 = db.GetCollection <PostOptions>("c_PostOption");

            objCollection.EnsureIndex("Type");

            //get all friends
            lstfriends = FriendsDAL.getAllFriendsListName(UserId, Global.CONFIRMED);

            //against every friend
            foreach (UserFriendsBO friend in lstfriends)
            {
                ////get hidden posts or posts reported as spam
                var query1 = Query.And(
                    Query.EQ("UserId", ObjectId.Parse(UserId)),
                    Query.EQ("FriendId", ObjectId.Parse(friend.FriendUserId)),
                    Query.Or(
                        Query.EQ("PostStatus", 1),
                        Query.EQ("PostStatus", 2))
                    );

                var hiddenposts = objCollection2.Find(query1);

                //get all posts of a friend
                var query = Query.EQ("WallOwnerUserId", ObjectId.Parse(friend.FriendUserId));

                var cursor = objCollection.Find(query);
                cursor.Limit = top;
                var sortBy = SortBy.Descending("AddedDate");
                cursor.SetSortOrder(sortBy);

                //for every post of friend
                foreach (var item in cursor)
                {
                    //add post to list
                    lstNewsfeed.Add(item);
                }

                //against every hidden post
                foreach (var po in hiddenposts)
                {
                    //check friends posts in list
                    foreach (Newsfeed storyitem in lstNewsfeed.ToList())
                    {
                        //if hidden post id is equal to friends post id then remove it from list

                        if (po.PostId.ToString().Equals(storyitem._id.ToString()))
                        {
                            lstNewsfeed.Remove(storyitem);
                        }
                    }
                }

                // get updates type for a friend

                var querysub = Query.And(
                    Query.EQ("UserId", ObjectId.Parse(UserId)),
                    Query.EQ("FriendId", ObjectId.Parse(friend.FriendUserId))
                    );

                var types = objCollection3.Find(querysub);

                if (types.Count() != 0)
                {
                    // int AllSub = 0;
                    int         PhotoSub     = 0;
                    int         LinksSub     = 0;
                    int         VideoSub     = 0;
                    int         VideolinkSub = 0;
                    int         StatusSub    = 0;
                    int         updatestype  = 0;
                    PostOptions postoption   = null;
                    foreach (PostOptions po in types)
                    {
                        updatestype = po.UpdatesType;
                        //  AllSub = po.SubscriptionAll;
                        PhotoSub     = po.SubscriptionPhotos;
                        LinksSub     = po.SubscriptionLinks;
                        VideoSub     = po.SubscriptionVideos;
                        VideolinkSub = po.SubscriptionVideoLinks;
                        StatusSub    = po.SubscriptionStatus;
                        postoption   = po;
                        break;
                    }
                    if (PhotoSub == 1 && LinksSub == 1 && VideoSub == 1 && VideolinkSub == 1 && StatusSub == 1)
                    {
                        foreach (Newsfeed storyitem in lstNewsfeed.ToList())
                        {
                            //if hidden post id is equal to friends post id then remove it from list
                            if (friend.FriendUserId.Equals(storyitem.PostedByUserId.ToString()))
                            {
                                lstNewsfeed.Remove(storyitem);
                            }
                        }
                    }
                    else
                    {
                        //against every story of friend
                        foreach (Newsfeed storyitem in lstNewsfeed.ToList())
                        {
                            //if friend story type is different from updates type then remove it from list
                            switch (updatestype)
                            {
                            case 1:    //all updates


                                break;

                            case 2:    // most updates photos and status messages
                                if (storyitem.Type == Global.TEXT_POST ||
                                    storyitem.Type == Global.PHOTO ||
                                    storyitem.Type == Global.TAG_PHOTO ||
                                    storyitem.Type == Global.TAG_POST)
                                {
                                }
                                else
                                {
                                    lstNewsfeed.Remove(storyitem);
                                }
                                break;

                            case 3:    // only important
                                if (storyitem.Type == Global.PROFILE_CHANGE)
                                {
                                }
                                else
                                {
                                    lstNewsfeed.Remove(storyitem);
                                }
                                break;

                            default:
                                break;
                            }
                            //below is logic for removing items that are unsubscribed
                            if (checkIfStorySubscribe(postoption, storyitem))
                            {
                                lstNewsfeed.Remove(storyitem);
                            }
                        }
                    }
                }
            }

            return(lstNewsfeed);
        }
예제 #24
0
 public static List <UserFriendsBO> getMutualFriends(string UserId, string FriendId, string status)
 {
     return(FriendsDAL.getMutualFriends(UserId, FriendId, status));
 }