Example #1
0
        public void GetUserInfoByID(int id)
        {
            Models.ComboResponse _response = new Models.ComboResponse();
            _response.bool_result = true;
            _response.ErrorCode = 0;
            _response.ErrorMsg = "";

            ComboUser user = new ComboUser();
            user.GetUserByUserId(id);

            ComboComment comments = new ComboComment();
            comments.GetPostCommentsCountByUserID(user.ComboUserID);

            UserActivityLog log = new UserActivityLog();
            log.GetActivityDaysByUserID(user.ComboUserID);

            ComboUser stats = new ComboUser();
            stats.GetUserStatisticsByUserId(id);

            List<Models.ComboUser> Users = user.DefaultView.Table.AsEnumerable().Select(row =>
            {
                return new Models.ComboUser
                {
                    ComboUserID = Convert.ToInt32(row["ComboUserID"]),
                    UserName = row["UserName"].ToString(),
                    DisplayName = row["DisplayName"].ToString(),
                    Password = row["Password"].ToString(),
                    Email = row["Email"].ToString(),
                    Bio = row["Bio"].ToString(),
                    ProfileImgID = row.IsNull("ProfileImgID") ? 0 : Convert.ToInt32(row["ProfileImgID"]),
                    CoverImgID = row.IsNull("CoverImgID") ? 0 : Convert.ToInt32(row["CoverImgID"]),
                    GenderID = row.IsNull("GenderID") ? 0 : Convert.ToInt32(row["GenderID"]),
                    IsActivated = row.IsNull("IsActivated") ? false : Convert.ToBoolean(row["IsActivated"]),
                    ExternalIDType = row.IsNull("ExternalIDType") ? 0 : Convert.ToInt32(row["ExternalIDType"]),
                    ExternalID = row["ExternalID"].ToString(),
                    DeviceID = row["DeviceID"].ToString(),
                    ActivationCode = row.IsNull("ActivationCode") ? Guid.Empty : new Guid(row["ActivationCode"].ToString()),
                    PassResetCode = row.IsNull("PassResetCode") ? Guid.Empty : new Guid(row["PassResetCode"].ToString()),
                    FollowersCount = Convert.ToInt32(stats.GetColumn("FollowersCount")),
                    FollowingCount = Convert.ToInt32(stats.GetColumn("FollowingsCount")),
                    FriendsCount = Convert.ToInt32(stats.GetColumn("FriendsCount")),
                    PostsCount = Convert.ToInt32(stats.GetColumn("PostsCount")),
                    PostsLikeCount = Convert.ToInt32(stats.GetColumn("PostsLikeCount")),
                    ProfilePic = row["ProfilePic"].ToString(),
                    SecurityQuestion = row["SecurityQuestion"].ToString(),
                    SecurityAnswer = row["SecurityAnswer"].ToString(),
                    UserRankID = Convert.ToInt32(row["UserRankID"]),
                    ProfileLikerCount = Convert.ToInt32(stats.GetColumn("ProfileLikerCount")),
                    SecurityWord = row["SecurityWord"].ToString(),
                    CountryFlagPath = row["CountryFlagPath"].ToString(),
                    Location = row["Location"].ToString(),
                    TotalActivityDays = log.RowCount > 0 ? Convert.ToInt32(log.GetColumn("TotalActivityDays")) : 0,
                    CommentsCount = Convert.ToInt32(comments.GetColumn("TotalCount"))
                };
            }).ToList();

            _response.Entity = Users;
            SetContentResult(_response);
        }
Example #2
0
        public void GetUserByID(int id, int requester)
        {
            Models.ComboResponse _response = new Models.ComboResponse();
            _response.bool_result = true;
            _response.ErrorCode = 0;
            _response.ErrorMsg = "";

            ComboUser user = new ComboUser();
            user.GetUserByUserId(id, requester);

            ComboUser stats = new ComboUser();
            stats.GetUserStatisticsByUserId(id);

            List<Models.ComboUser> Users = user.DefaultView.Table.AsEnumerable().Select(row =>
            {
                return new Models.ComboUser
                {
                    ComboUserID = Convert.ToInt32(row["ComboUserID"]),
                    UserName = row["UserName"].ToString(),
                    DisplayName = row["DisplayName"].ToString(),
                    Password = row["Password"].ToString(),
                    Email = row["Email"].ToString(),
                    Bio = row["Bio"].ToString(),
                    ProfileImgID = row.IsNull("ProfileImgID") ? 0 : Convert.ToInt32(row["ProfileImgID"]),
                    CoverImgID = row.IsNull("CoverImgID") ? 0 : Convert.ToInt32(row["CoverImgID"]),
                    GenderID = row.IsNull("GenderID") ? 0 : Convert.ToInt32(row["GenderID"]),
                    IsActivated = row.IsNull("IsActivated") ? false : Convert.ToBoolean(row["IsActivated"]),
                    ExternalIDType = row.IsNull("ExternalIDType") ? 0 : Convert.ToInt32(row["ExternalIDType"]),
                    ExternalID = row["ExternalID"].ToString(),
                    DeviceID = row["DeviceID"].ToString(),
                    ActivationCode = row.IsNull("ActivationCode") ? Guid.Empty : new Guid(row["ActivationCode"].ToString()),
                    PassResetCode = row.IsNull("PassResetCode") ? Guid.Empty : new Guid(row["PassResetCode"].ToString()),
                    FollowersCount = Convert.ToInt32(stats.GetColumn("FollowersCount")),
                    FollowingCount = Convert.ToInt32(stats.GetColumn("FollowingsCount")),
                    FriendsCount = Convert.ToInt32(stats.GetColumn("FriendsCount")),
                    PostsCount = Convert.ToInt32(stats.GetColumn("PostsCount")),
                    PostsLikeCount = Convert.ToInt32(stats.GetColumn("PostsLikeCount")),
                    IsFriend = Convert.ToBoolean(row["IsFriend"]),
                    IsFollower = Convert.ToBoolean(row["IsFollower"]),
                    IsFollowing = Convert.ToBoolean(row["IsFollowing"]),
                    FriendRequestSent = Convert.ToInt32(row["IsFriendRequestSent"]),
                    ProfilePic = row["ProfilePic"].ToString(),
                    CoverPic = row["CoverPic"].ToString(),
                    UserRankID = Convert.ToInt32(row["UserRankID"]),
                    ProfileLikerCount = Convert.ToInt32(stats.GetColumn("ProfileLikerCount")),
                    BirthDate = row.IsNull("BirthDate") ? DateTime.MinValue : Convert.ToDateTime(row["BirthDate"]),
                    Country  = row["Country"].ToString(),
                    Phone = row["Phone"].ToString(),
                    Website = row["Website"].ToString(),
                    CountryFlagPath = row["CountryFlagPath"].ToString(),
                    Location = row["Location"].ToString(),
                    IsPrivateAccount = row.IsNull("IsPrivateAccount") ? false : Convert.ToBoolean(row["IsPrivateAccount"]),
                    IsFollowingRequestSent = Convert.ToBoolean(row["IsFollowingRequestSent"]),
                    IsFollowerRequestSent = Convert.ToBoolean(row["IsFollowerRequestSent"]),
                    IsBlocked = Convert.ToBoolean(row["IsBlocked"])
                };
            }).ToList();

            _response.Entity = Users;
            SetContentResult(_response);
        }