Esempio n. 1
0
        public ActionResult ShowAddFolderOrBookmarkView(long folderID)
        {
            long uid = UILoginHelper.GetUIDFromHttpContext(HttpContext);

            if (folderID == 0)
            {
                var lst = BizUserWebFolder.LoadAllByUID(uid);
                if (lst != null && lst.Count > 0)
                {
                    var firstFolder = lst.Where(folder => folder.ParentWebfolderID == 0);
                    if (firstFolder == null || firstFolder.Count() == 0)
                    {
                        return(View());
                    }
                    if (firstFolder.Count() == 1)
                    {
                        folderID = firstFolder.FirstOrDefault().UserWebFolderID;
                    }
                    else
                    {
                        BizUserWebFolder newFolderInfo = new BizUserWebFolder();
                        newFolderInfo.UserInfoID          = uid;
                        newFolderInfo.UserWebFolderID     = 0;
                        newFolderInfo.ParentWebfolderID   = 0;
                        newFolderInfo.ChildrenFolderList  = firstFolder.ToList();
                        newFolderInfo.BizBookmarkInfoList = new List <BizBookmarkInfo>();
                        return(View("ShowAddFolderOrBookmarkView", new UIWebFolderInfo(newFolderInfo)));
                    }
                }
            }
            var folderInfo = BizUserWebFolder.LoadContainsChirdrenAndBookmark(folderID);
            var model      = new UIWebFolderInfo(folderInfo);

            return(View("ShowAddFolderOrBookmarkView", model));
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            var loginUID        = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            var lstBookmarkInfo = RecommendBo.GetRecommendBookmarkList(loginUID);

            var dicUserInfo = UserInfoBo.GetListByUIDList(lstBookmarkInfo.Select(model => model.UserInfoID).ToList())
                              .ToDictionary(model => model.UserInfoID, model => model);

            var lstModel = new List <UIBookmarkInfo>();

            lstModel.AddRange(lstBookmarkInfo.Select(model => new UIBookmarkInfo()
            {
                Href            = model.Href,
                BookmarkName    = model.BookmarkName,
                BookmarkInfoID  = model.BookmarkInfoID,
                CreateTime      = model.CreateTime,
                UserWebFolderID = model.UserWebFolderID,
                UserInfoID      = model.UserInfoID,
                Host            = model.Host,
                UserInfo        = dicUserInfo.ContainsKey(model.UserInfoID) ? new UIUserInfo()
                {
                    UserEmail   = dicUserInfo[model.UserInfoID].UserEmail,
                    UserInfoID  = dicUserInfo[model.UserInfoID].UserInfoID,
                    UserName    = dicUserInfo[model.UserInfoID].UserName,
                    UserImagURL = dicUserInfo[model.UserInfoID].UserImagURL,
                } : new UIUserInfo()
                {
                    UserName = "******", UserInfoID = 0
                },
            }));

            lstModel = Extend.GetRandomList(lstModel);
            return(View(lstModel.Count > 15 ? lstModel.Take(15).ToList() : lstModel));
        }
Esempio n. 3
0
        //
        // GET: /User/

        public ActionResult Index()
        {
            var loginUid         = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            var dicBeFollowerID  = UserRelationshipBo.GetByFollowUserID(loginUid);
            var lstUserInfoModel = new List <SearchUserInfo>();
            var lstModel         = RecommendBo.GetRecommendUserList(loginUid);

            if (lstModel == null || lstModel.Count == 0)
            {
                lstModel = RecommendBo.GetRandomUserList();
            }

            lstUserInfoModel.AddRange(lstModel.Select(model => new SearchUserInfo()
            {
                UserImagURL     = model.UserImagURL,
                UserEmail       = model.UserEmail,
                UserInfoComment = model.UserInfoComment,
                UserName        = model.UserName,
                CreateTime      = model.CreateTime,
                UserInfoID      = model.UserInfoID,
                IsFollow        = dicBeFollowerID.ContainsKey(model.UserInfoID)
            }));

            return(PartialView("Index", lstUserInfoModel));
        }
Esempio n. 4
0
        /// <summary>
        /// 保存群组信息
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="groupIntro"></param>
        /// <returns></returns>
        public ActionResult SaveUserGroupInfo(string groupName, string groupIntro)
        {
            long          uid    = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            BizResultInfo result = new BizResultInfo();

            if (string.IsNullOrEmpty(groupName))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "群组名称不能为空呀....";
                return(Json(result));
            }
            BizGroupInfo groupInfo = new BizGroupInfo();

            groupInfo.CreateTime    = DateTime.Now;
            groupInfo.CreateUesrID  = uid;
            groupInfo.GroupName     = groupName;
            groupInfo.GroupIntro    = !string.IsNullOrEmpty(groupIntro) ? groupIntro : "";
            groupInfo.ObjectHascode = groupInfo.GetHashCode();
            groupInfo.Save();

            BizGroupUser groupUser = new BizGroupUser();

            groupUser.UserInfoID  = uid;
            groupUser.GroupInfoID = groupInfo.GroupInfoID;
            groupUser.IsPass      = (int)ApplyStatus.Pass;
            groupUser.CreateTime  = DateTime.Now;
            groupUser.Save();
            result.IsSuccess      = true;
            result.SuccessMessage = "创建成功!";
            return(Json(result));
        }
Esempio n. 5
0
        public ActionResult Index()
        {
            var loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            var lstModel = UserDynamicInfoBo.LoadDynamicLog(loginUID);

            return(View(lstModel));
        }
Esempio n. 6
0
        public ActionResult ShowUserBeFollwed(long uid = 0)
        {
            if (uid == 0)//当前登录用户
            {
                uid = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            }
            var dicLoginUserFollower = UserRelationshipBo.GetByFollowUserID(UILoginHelper.GetUIDFromHttpContext(HttpContext));

            var dicBeFollower = UserRelationshipBo.GetByBeFollwedUID(uid);

            var lstUserInfoModel = new List <SearchUserInfo>();

            var lstModel = UserInfoBo.GetListByUIDList(dicBeFollower.Keys.ToList());

            if (lstModel != null && lstModel.Count > 0)
            {
                lstUserInfoModel.AddRange(lstModel.Select(model => new SearchUserInfo()
                {
                    UserImagURL     = model.UserImagURL,
                    UserEmail       = model.UserEmail,
                    UserInfoComment = model.UserInfoComment,
                    UserName        = model.UserName,
                    CreateTime      = model.CreateTime,
                    UserInfoID      = model.UserInfoID,
                    IsFollow        = dicLoginUserFollower.ContainsKey(model.UserInfoID),
                }));
            }
            return(PartialView("ShowUserBeFollwed", lstUserInfoModel));
        }
Esempio n. 7
0
        /// <summary>
        /// 申请加入群组
        /// </summary>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public ActionResult ApplyToGroup(long groupID)
        {
            BizResultInfo result = new BizResultInfo();

            if (groupID == 0 || BizGroupInfo.LoadByGroupID(groupID) == null)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "群组ID不能为空呀,这个数据肯定有问题...不要逗我玩吧。";
                return(Json(result));
            }
            var lstGroupUser = BizGroupUser.LoadGroupUser(UILoginHelper.GetUIDFromHttpContext(HttpContext));

            if (lstGroupUser != null && lstGroupUser.Any(model => model.GroupInfoID == groupID))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "已经申请加入了,再等等吧....";
                return(Json(result));
            }


            BizGroupUser groupUser = new BizGroupUser();

            groupUser.GroupInfoID = groupID;
            groupUser.IsPass      = (int)ApplyStatus.Waiting;
            groupUser.CreateTime  = DateTime.Now;
            groupUser.UserInfoID  = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            groupUser.Save();
            MessageBo.CreateMessage(0, MessageTypeEnum.ApplyJoinGroup, groupUser);
            result.IsSuccess      = true;
            result.SuccessMessage = "申请成功....";


            return(Json(result));
        }
Esempio n. 8
0
        public ActionResult ModifyPasswordIndex()
        {
            UIUserInfo uiUserInfo = null;

            if (!UILoginHelper.CheckUserLogin(HttpContext))
            {
                return(View(uiUserInfo));
            }

            var result = UserInfoBo.GetUserInfoByLoginNameOrEmail(UILoginHelper.GetUIUserLoginNameOrEmail(HttpContext));

            if (result.IsSuccess)
            {
                var bizUserInfo = result.Target as BizUserInfo;
                if (bizUserInfo == null || bizUserInfo.UserInfoID == 0)
                {
                    return(View(uiUserInfo));
                }
                uiUserInfo                 = new UIUserInfo();
                uiUserInfo.UserEmail       = bizUserInfo.UserEmail;
                uiUserInfo.UserName        = bizUserInfo.UserName;
                uiUserInfo.LoginName       = bizUserInfo.UserLoginName;
                uiUserInfo.Phone           = bizUserInfo.UserPhone;
                uiUserInfo.LoginName       = bizUserInfo.UserLoginName;
                uiUserInfo.QQ              = bizUserInfo.UserQQ;
                uiUserInfo.UserInfoComment = bizUserInfo.UserInfoComment;
                uiUserInfo.UserImagURL     = bizUserInfo.UserImagURL;
            }
            return(View(uiUserInfo));
        }
Esempio n. 9
0
        /// <summary>
        /// 修改群组信息
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="groupIntro"></param>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public ActionResult ModifyUserGroupInfo(string groupName, string groupIntro, long groupID)
        {
            long          uid    = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            BizResultInfo result = new BizResultInfo();

            if (string.IsNullOrEmpty(groupName))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "群组名称不能为空呀....";
                return(Json(result));
            }


            if (groupID == 0)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "群组ID不能为空呀,这个数据目测有问题....";
                return(Json(result));
            }

            BizGroupInfo groupInfo = BizGroupInfo.LoadByGroupID(groupID);

            if (groupInfo != null)
            {
                groupInfo.GroupName  = groupName;
                groupInfo.GroupIntro = !string.IsNullOrEmpty(groupIntro) ? groupIntro : "";
                groupInfo.Save();
            }

            result.IsSuccess      = true;
            result.SuccessMessage = "保存成功!";
            return(Json(result));
        }
Esempio n. 10
0
        /// <summary>
        /// 驳回用户
        /// </summary>
        /// <param name="groupUserID"></param>
        /// <returns></returns>
        public ActionResult RejectGroupUser(long groupUserID)
        {
            BizResultInfo result = new BizResultInfo();


            var bizModel = BizGroupUser.LoadByGroupUserID(groupUserID);

            if (groupUserID == 0 || bizModel == null)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "取不到这个数据啊呀...不要逗我玩吧。";
                return(Json(result));
            }

            if (UILoginHelper.GetUIDFromHttpContext(HttpContext) == bizModel.UserInfoID)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "不允许驳回自己....";
                return(Json(result));
            }
            bizModel.IsPass = (int)ApplyStatus.Reject;
            bizModel.Save();
            MessageBo.CreateMessage(0, MessageTypeEnum.RejecrApplyJoinGroup, bizModel);
            result.IsSuccess = true;
            return(Json(result));
        }
Esempio n. 11
0
        public ActionResult ShowUserInfo(long showUserInfoID)
        {
            UIShowUserInfo showUserInfo = null;
            var            model        = BizUserInfo.LoadByUserInfoID(showUserInfoID);

            if (showUserInfoID == 0 || model == null)
            {
                return(PartialView("ShowUserInfo", showUserInfo));
            }

            var uid             = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            var dicBeFollowerID = UserRelationshipBo.GetByFollowUserID(uid);

            showUserInfo = new UIShowUserInfo()
            {
                UserImagURL     = model.UserImagURL,
                UserEmail       = model.UserEmail,
                UserInfoComment = model.UserInfoComment,
                UserName        = model.UserName,
                CreateTime      = model.CreateTime,
                UserInfoID      = model.UserInfoID,
                IsFollow        = dicBeFollowerID.ContainsKey(model.UserInfoID)
            };

            return(PartialView("ShowUserInfo", showUserInfo));
        }
Esempio n. 12
0
        public ActionResult ShowHasReadMessage()
        {
            var loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            var lstModel = BizMessageInfo.LoadHasReadListByUserID(loginUID);

            return(View("ShowHasReadMessage", lstModel));
        }
Esempio n. 13
0
        public ActionResult QuitGroup(long groupUserID)
        {
            BizResultInfo result = new BizResultInfo();


            var bizModel = BizGroupUser.LoadByGroupUserID(groupUserID);

            if (groupUserID == 0 || bizModel == null)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "取不到这个数据啊呀...不要逗我玩吧。";
                return(Json(result));
            }

            var groupInfo = BizGroupInfo.LoadByGroupID(bizModel.GroupInfoID);

            if (UILoginHelper.GetUIDFromHttpContext(HttpContext) == groupInfo.CreateUesrID)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "不允许移除自己....";
                return(Json(result));
            }

            if (bizModel.IsPass == (int)ApplyStatus.Pass)
            {
                MessageBo.CreateMessage(0, MessageTypeEnum.QuitGroupSuccess, bizModel);
            }
            bizModel.IsPass = (int)ApplyStatus.Quit;
            bizModel.Save();
            result.IsSuccess = true;
            return(Json(result));
        }
Esempio n. 14
0
        public ActionResult ImportWebBookmarkToDB(string importLogID)
        {
            BizResultInfo result = new BizResultInfo();

            if (string.IsNullOrEmpty(importLogID))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "先上传文件呀。";
                return(Json(result));
            }
            long uid = UILoginHelper.GetUIDFromHttpContext(HttpContext);

            var importLog = BizUserWebBookmarkImportLog.LoadImportLogID(importLogID.ConvertToPlainLong());

            if (importLog == null)
            {
                return(Json(new BizResultInfo()
                {
                    IsSuccess = false, SuccessMessage = "文件丢失,保存失败。"
                }));
            }

            var path = Server.MapPath(importLog.Path);

            result = ImportBookmarkHelper.ImportBookmarkDataToDB(path, uid);

            return(Json(new BizResultInfo()
            {
                IsSuccess = true, SuccessMessage = "保存成功耶,你可以到别的地方玩了。"
            }));
        }
Esempio n. 15
0
        public ActionResult UserLogin(UIUserInfo uiUserInfo)
        {
            string logionName = string.IsNullOrEmpty(uiUserInfo.LoginName) ? uiUserInfo.UserEmail : uiUserInfo.LoginName;
            var    rsp        = UserInfoBo.UserLogin(logionName, uiUserInfo.Password);

            if (rsp.IsSuccess)
            {
                UILoginHelper.WriteUserInfo(rsp.ResultID, logionName, uiUserInfo.Password, HttpContext);
            }
            return(Json(rsp));
        }
Esempio n. 16
0
        public ActionResult UploadWebBookmarkFile()
        {
            var result = UploadFileHelper.UploadFileToUserImportFile(Request);

            if (result.IsSuccess)
            {
                BizUserWebBookmarkImportLog importLog = result.Target as BizUserWebBookmarkImportLog;
                importLog.UserInfoID = UILoginHelper.GetUIDFromHttpContext(HttpContext);
                importLog.Save();
                result.ResultID = importLog.UserWebBookmarkImportLogID.ConvertToCiphertext();
            }

            return(Json(result));
        }
Esempio n. 17
0
        public ActionResult UnFollowUser(long beFollowUserID)
        {
            BizResultInfo result = new BizResultInfo();

            if (beFollowUserID == 0)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "ID为空,这是一条垃圾数据呀。";
                return(Json(result));
            }
            long userID = UILoginHelper.GetUIDFromHttpContext(HttpContext);

            result.IsSuccess = UserRelationshipBo.UnFollowUser(beFollowUserID, userID);
            return(Json(result));
        }
Esempio n. 18
0
        //
        // GET: /ShowMyHasPassGroup/

        public ActionResult Index()
        {
            var userID = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            List <UIUserGroupInfo> lstUIUserGroupInfo = null;

            var lstGroupUser = BizGroupUser.LoadGroupUser(userID);



            if (lstGroupUser == null)
            {
                return(View());
            }

            var lstGroupInfo = BizGroupInfo.LoadByGroupIDList(lstGroupUser.Select(model => model.GroupInfoID).ToList());
            var lstUserInfo  = UserInfoBo.GetListByUIDList(lstGroupInfo.Select(model => model.CreateUesrID).Distinct().ToList());
            Dictionary <long, BizUserInfo> dicUserInfo = new Dictionary <long, BizUserInfo>();

            if (lstUserInfo != null)
            {
                dicUserInfo = lstUserInfo.ToDictionary(model => model.UserInfoID, model => model);
            }

            var dicGroupInfo = lstGroupInfo.Select(info => new UIGroupInfo()
            {
                CreateTime     = info.CreateTime,
                CreateUesrID   = info.CreateUesrID,
                GroupInfoID    = info.GroupInfoID,
                GroupIntro     = info.GroupIntro,
                GroupName      = info.GroupName,
                CreateUesrInfo = GroupInfoController.ToUIUserInfo(info.CreateUesrID, dicUserInfo),
            }).ToDictionary(model => model.GroupInfoID, model => model);

            lstUIUserGroupInfo = lstGroupUser.Select(model => new UIUserGroupInfo()
            {
                GroupInfo   = dicGroupInfo.ContainsKey(model.GroupInfoID) ? dicGroupInfo[model.GroupInfoID] : null,
                GroupInfoID = model.GroupInfoID,
                GroupUserID = model.GroupUserID,
                CreateTime  = model.CreateTime,
                IsPass      = model.IsPass,
                UserInfoID  = model.UserInfoID,
            }).ToList();


            return(View(lstUIUserGroupInfo));
        }
Esempio n. 19
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext != null)
            {
                var loginUid = UILoginHelper.GetUIDFromHttpContext(filterContext.HttpContext);
                var userInfo = BizUserInfo.LoadByUserInfoID(loginUid);
                if (userInfo == null)
                {
                    throw new Exception("找不到你的登陆信息,不能让你继续玩下去.....");
                }
                var password = UILoginHelper.GetUIUserPassword(filterContext.HttpContext);

                if (userInfo.UserPassword != password)
                {
                    throw new Exception("找不到你的Token信息,不能让你继续玩下去.....");
                }
            }
        }
Esempio n. 20
0
        public ActionResult CheckUserLoginName(string loginName)
        {
            var           cookieLoginName = UILoginHelper.GetUIUserLoginNameOrEmail(HttpContext);
            BizResultInfo result          = UserInfoBo.GetUserInfoByLoginNameOrEmail(cookieLoginName);

            if (result.IsSuccess)
            {
                var userInfo = result.Target as BizUserInfo;
                if (!userInfo.UserLoginName.Equals(loginName))
                {
                    result = UserInfoBo.CheckUserEmailOrLoginName(loginName);
                }
                else
                {
                    result.IsSuccess      = true;
                    result.SuccessMessage = "邮箱是有效的哦,可以使用。";
                }
            }
            return(Json(result));
        }
Esempio n. 21
0
        public ActionResult SaveUserImag()
        {
            BizResultInfo result = UploadFileHelper.UploadFileToUserImg(Request);

            if (result.IsSuccess)
            {
                var loginEmail  = UILoginHelper.GetUIUserLoginNameOrEmail(HttpContext);
                var res         = UserInfoBo.GetUserInfoByLoginNameOrEmail(loginEmail);
                var bizUserInfo = res.Target as BizUserInfo;
                var path        = Server.MapPath(bizUserInfo.UserImagURL);
                if (System.IO.File.Exists(path))
                {
                    System.IO.File.Delete(path);
                }
                bizUserInfo.UserImagURL = result.ResultID;
                bizUserInfo.Save();
                result.SuccessMessage = "上传成功!";
            }
            return(Json(result));
        }
Esempio n. 22
0
        public ActionResult ShowBookmarkComment(long bookmarkID)
        {
            var lstBookmarkComment = BizBookmarkComment.LoadByBookmarkInfoID(bookmarkID);

            var loginUserInfo = BizUserInfo.LoadByUserInfoID(UILoginHelper.GetUIDFromHttpContext(HttpContext));

            UIUserInfo uiLoginUserInfo = new UIUserInfo()
            {
                UserName    = loginUserInfo.UserName,
                UserInfoID  = loginUserInfo.UserInfoID,
                UserImagURL = loginUserInfo.UserImagURL,
                UserEmail   = loginUserInfo.UserEmail,
            };

            var lstUserID   = lstBookmarkComment.Select(model => model.CriticsUserID).Distinct().ToList();
            var dicUserInfo = UserInfoBo.GetListByUIDList(lstUserID).ToDictionary(model => model.UserInfoID, model => model);

            IEnumerable <UICommentInfo> lstComment = new List <UICommentInfo>();

            lstComment = lstBookmarkComment.Select(model => new UICommentInfo()
            {
                BookmarkUserID  = model.BookmarkUserID,
                CommentContent  = model.CommentContent,
                CommentTitle    = model.CommentTitle,
                CommentID       = model.BookmarkCommentID,
                CreateTime      = model.CreateTime,
                CriticsUserID   = model.CriticsUserID,
                InfoID          = model.BookmarkInfoID,
                InfoType        = UICommentType.Bookmark,
                CriticsUserInfo = dicUserInfo.ContainsKey(model.CriticsUserID) ?  new UIUserInfo()
                {
                    UserName    = dicUserInfo[model.CriticsUserID].UserName,
                    UserEmail   = dicUserInfo[model.CriticsUserID].UserEmail,
                    UserImagURL = dicUserInfo[model.CriticsUserID].UserImagURL,
                    UserInfoID  = dicUserInfo[model.CriticsUserID].UserInfoID,
                }:new UIUserInfo(),
            });


            return(PartialView("ShowBookmarkComment", Tuple.Create <IEnumerable <UICommentInfo>, UIUserInfo>(lstComment, uiLoginUserInfo)));
        }
Esempio n. 23
0
        public ActionResult AddBookmarkLikeLog(long bookmarkID)
        {
            BizResultInfo result   = new BizResultInfo();
            var           loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext);

            var bookmarkInfo = BizBookmarkInfo.LoadByID(bookmarkID);

            if (bookmarkInfo != null)
            {
                var likelog = BizLikeLog.LoadUserIDAndBookmarkID(loginUID, bookmarkID);
                if (likelog != null)
                {
                    result.IsSuccess    = false;
                    result.ErrorMessage = "你已经点赞过了呀,不要重复点赞了。";
                }
                else
                {
                    likelog            = new BizLikeLog();
                    likelog.InfoID     = bookmarkID;
                    likelog.InfoType   = (int)InfoTypeEnum.Bookmark;
                    likelog.UserInfoID = loginUID;
                    likelog.Save();

                    bookmarkInfo.LoadLikeLog();
                    result.Target         = bookmarkInfo.LikeCount;
                    result.IsSuccess      = true;
                    result.SuccessMessage = "点赞成功。";

                    UserDynamicInfoBo.CreateDynamicInfoMessage(loginUID, DynamicInfoType.NewLikeBookmark, bookmarkInfo);
                    MessageBo.CreateMessage(loginUID, MessageTypeEnum.NewLikeBookmarkLog, bookmarkInfo);
                }
            }
            else
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "找不到书签呀,刷新一下再来试试?";
            }


            return(Json(result));
        }
Esempio n. 24
0
        public ActionResult CollectBookmarkToUserDefaultFolder(long bookmarkID)
        {
            BizResultInfo result       = new BizResultInfo();
            var           bookmarkInfo = BizBookmarkInfo.LoadByID(bookmarkID);

            if (bookmarkInfo == null || bookmarkInfo.BookmarkInfoID == 0)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "书签数据有误,可能是数据库被怪兽吃掉了,也可能是你娃误操作给了一个错误的书签ID。建议刷新重试吧。";
                return(Json(result));
            }

            var loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext);

            if (bookmarkInfo.UserInfoID == loginUID)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "不用收藏自己的书签哦。";
                return(Json(result));
            }
            long folderID = GetUserDefaultFolderID(loginUID);

            BizBookmarkInfo newBookmark = new BizBookmarkInfo()
            {
                BookmarkName    = bookmarkInfo.BookmarkName,
                CreateTime      = DateTime.Now,
                Host            = bookmarkInfo.Host,
                Href            = bookmarkInfo.Href,
                UserInfoID      = loginUID,
                HTML            = bookmarkInfo.HTML,
                IElementJSON    = bookmarkInfo.IElementJSON,
                UserWebFolderID = folderID,
            };

            newBookmark.HashCode = newBookmark.GetHashCode();
            newBookmark.Save();
            result.IsSuccess = true;
            return(Json(result));
        }
Esempio n. 25
0
        public ActionResult ShowUserAllFolder(long folderID)
        {
            long uid = UILoginHelper.GetUIDFromHttpContext(HttpContext);

            if (folderID == 0)
            {
                var lst = BizUserWebFolder.LoadAllByUID(uid);
                if (lst != null && lst.Count > 0)
                {
                    var firstFolder = lst.Where(folder => folder.ParentWebfolderID == 0);
                    if (firstFolder == null || firstFolder.Count() == 0)
                    {
                        return(View());
                    }
                    folderID = firstFolder.FirstOrDefault().UserWebFolderID;
                }
            }
            var folderInfo = BizUserWebFolder.LoadContainsChirdrenAndBookmark(folderID);
            var model      = new UIWebFolderInfo(folderInfo);

            return(View("ShowUserAllFolder", model));
        }
Esempio n. 26
0
        public ActionResult SavePassword(string oldpassword, string newpassword)
        {
            BizResultInfo result = new BizResultInfo();

            if (string.IsNullOrEmpty(oldpassword) || string.IsNullOrEmpty(newpassword))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "原密码和新密码都不能为空呀。";
                return(Json(result));
            }

            string password = UILoginHelper.GetUIUserPassword(HttpContext);

            if (password != oldpassword)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "原密码错误,请重新输入.";
                return(Json(result));
            }

            long uid = UILoginHelper.GetUIDFromHttpContext(HttpContext);

            var userInfo = BizUserInfo.LoadByUserInfoID(uid);

            if (userInfo != null && userInfo.UserInfoID != 0)
            {
                userInfo.UserPassword = newpassword;
                userInfo.Save();

                result.IsSuccess      = true;
                result.SuccessMessage = "修改成功,请重新登陆一下哦。";
            }
            else
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "数据库里面找不到你丫,重新登陆一下看看。";
            }
            return(Json(result));
        }
Esempio n. 27
0
        public ActionResult SearchUser(string nameOrEmail)
        {
            var dicBeFollowerID = UserRelationshipBo.GetByFollowUserID(UILoginHelper.GetUIDFromHttpContext(HttpContext));

            var lstUserInfoModel = new List <SearchUserInfo>();
            var lstModel         = UserInfoBo.SearchUserList(nameOrEmail);

            if (lstModel != null && lstModel.Count > 0)
            {
                lstUserInfoModel.AddRange(lstModel.Select(model => new SearchUserInfo()
                {
                    UserImagURL     = model.UserImagURL,
                    UserEmail       = model.UserEmail,
                    UserInfoComment = model.UserInfoComment,
                    UserName        = model.UserName,
                    CreateTime      = model.CreateTime,
                    UserInfoID      = model.UserInfoID,
                    IsFollow        = dicBeFollowerID.ContainsKey(model.UserInfoID)
                }));
            }
            return(PartialView("SearchUser", lstUserInfoModel));
        }
Esempio n. 28
0
        public ActionResult SaveBookmarkComment(long bookmarkID, string content)
        {
            BizResultInfo result = new BizResultInfo();

            try
            {
                var bookmark = BizBookmarkInfo.LoadByID(bookmarkID);
                if (bookmark == null || bookmark.BookmarkInfoID == 0)
                {
                    result.IsSuccess    = false;
                    result.ErrorMessage = "序列化书签数据失败,目测你要重新加载页面。";
                    return(Json(result));
                }
                BizBookmarkComment comment = new BizBookmarkComment();
                comment.CriticsUserID  = UILoginHelper.GetUIDFromHttpContext(HttpContext);
                comment.CommentTitle   = "";
                comment.CommentContent = content;
                comment.BookmarkInfoID = bookmark.BookmarkInfoID;
                comment.CreateTime     = DateTime.Now;
                comment.BookmarkUserID = bookmark.UserInfoID;
                comment.Save();
                var loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext);
                MessageBo.CreateMessage(bookmark.UserInfoID, MessageTypeEnum.NewBookmarkComment, comment);
                UserDynamicInfoBo.CreateDynamicInfoMessage(loginUID, DynamicInfoType.NewBookmarkComment, bookmark);

                result.IsSuccess      = true;
                result.SuccessMessage = "提交成功。";
            }catch (Exception ex)
            {
                LogHelper.WriteException("SaveBookmarkComment", ex, new {
                    BookmarkID = bookmarkID,
                    SubmitUser = UILoginHelper.GetUIDFromHttpContext(HttpContext),
                    Content    = content,
                });
                result.ErrorMessage = "提交失败,目测网络挂了或者别的....";
                result.IsSuccess    = false;
            }
            return(Json(result));
        }
Esempio n. 29
0
        /// <summary>
        /// 未通过审核的群组用户
        /// </summary>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public ActionResult ShowUserAllGroupMessage()
        {
            long loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext);
            List <UIUserGroupInfo> lstUIUserGroupInfo = null;
            var lstGroupInfo = BizGroupInfo.LoadByCreateUserID(loginUID);

            if (lstGroupInfo == null)
            {
                return(View("ShowUserAllGroupMessage", lstUIUserGroupInfo));
            }


            var lstGroupUser = BizGroupUser.LoadByGroupIDList(lstGroupInfo.Select(info => info.GroupInfoID).ToList());
            var dicGroupInfo = lstGroupInfo.ToDictionary(info => info.GroupInfoID, info => info);

            var dicUserInfo = UserInfoBo.GetListByUIDList(lstGroupUser.Select(model => model.UserInfoID).Distinct().ToList())
                              .ToDictionary(info => info.UserInfoID, info => info);

            lstUIUserGroupInfo = lstGroupUser.Where(model => model.IsPass == (int)ApplyStatus.Waiting).Select(model => new UIUserGroupInfo()
            {
                GroupInfo = dicGroupInfo.ContainsKey(model.GroupInfoID) ?
                            new UIGroupInfo()
                {
                    CreateTime   = dicGroupInfo[model.GroupInfoID].CreateTime,
                    CreateUesrID = dicGroupInfo[model.GroupInfoID].CreateUesrID,
                    GroupInfoID  = dicGroupInfo[model.GroupInfoID].GroupInfoID,
                    GroupName    = dicGroupInfo[model.GroupInfoID].GroupName,
                }:null,
                GroupInfoID   = model.GroupInfoID,
                GroupUserID   = model.GroupUserID,
                CreateTime    = model.CreateTime,
                IsPass        = model.IsPass,
                UserInfoID    = model.UserInfoID,
                GroupUserInfo = ToUIUserInfo(model.UserInfoID, dicUserInfo),
            }).ToList();

            return(View("ShowUserAllGroupMessage", lstUIUserGroupInfo));
        }
Esempio n. 30
0
        public ActionResult CheckUserEmail(string email)
        {
            var cookieLoginName = UILoginHelper.GetUIUserLoginNameOrEmail(HttpContext);

            if (!cookieLoginName.Contains('@'))
            {
                var userInfo = UserInfoBo.GetUserInfoByLoginNameOrEmail(cookieLoginName).Target as BizUserInfo;
                cookieLoginName = userInfo.UserEmail;
            }

            BizResultInfo result = new BizResultInfo();

            if (cookieLoginName.Equals(email))
            {
                result.IsSuccess      = true;
                result.SuccessMessage = "邮箱是有效的哦,可以使用。";
            }
            else
            {
                result = UserInfoBo.CheckUserEmailOrLoginName(email);
            }
            return(Json(result));
        }