コード例 #1
0
        private void EmailBind()
        {
            string password = _Request.Get("password", Method.Post, string.Empty, false);
            string email = _Request.Get("email", Method.Post, string.Empty, false);
            CheckUser();

            //UserBO.Instance.UpdateEmail(LoginUser, email);
            using (ErrorScope es = new ErrorScope())
            {
                m_Success = UserBO.Instance.LoginEmailBind(LoginUser, password, email);

                if (Success)
                {
                    ShowSuccess("Email绑定成功");
                }
                else
                {
                    es.CatchError<UserNotActivedError>(delegate(UserNotActivedError err)
                    {
                        Response.Redirect(err.ActiveUrl);
                    });
                    es.CatchError<EmailNotValidatedError>(delegate(EmailNotValidatedError err)
                    {
                        Response.Redirect(err.ValidateUrl);
                    });
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                    });
                }
            }

        }
コード例 #2
0
ファイル: friend-move.aspx.cs プロジェクト: huchao007/bbsmax
        protected void Page_Load(object sender, EventArgs e)
        {
            m_FriendUserIdsText = _Request.Get("uid");
            m_FriendUserIds = StringUtil.Split<int>(m_FriendUserIdsText, ',');

            if (_Request.IsClick("movefriend"))
            {
                Move();
            }

            using (ErrorScope es = new ErrorScope())
            {
                m_FriendListToMove = FriendBO.Instance.GetFriends(MyUserID, m_FriendUserIds);

                WaitForFillSimpleUsers<Friend>(m_FriendListToMove);

                if (es.HasUnCatchedError)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                        return;
                    });
                }
            }
        }
コード例 #3
0
        private void DeletePhotos(string[] ids)
        {
            using (ErrorScope es = new ErrorScope())
            {
                if (ids.Length == 1 && ids[0] == string.Empty)
                {
                    ShowError("请先选择要删除的相片");
                    return;
                }

                int[] photoIDs = new int[ids.Length];

                for (int i = 0; i < ids.Length; i++)
                {
                    photoIDs[i] = int.Parse(ids[i]);
                }

                if (AlbumBO.Instance.DeletePhotos(MyUserID, photoIDs, true))
                {
                    ShowSuccess("删除成功", new object());
                }
                else
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                    });

                    ShowError("您所在的用户组没有权限删除该相片");
                }
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            m_GroupID = _Request.Get<int>("groupid", Method.Get, 0);

            if (m_GroupID <= 0)
                ShowError(new InvalidParamError("groupid"));


            using (ErrorScope es = new ErrorScope())
            {
                m_Group = FriendBO.Instance.GetFriendGroup(MyUserID, m_GroupID);

                if (es.HasUnCatchedError)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                    });
                }
                else if (m_Group == null)
                    ShowError(new NotExistsFriendGroupError(m_GroupID));
            }

            if (_Request.IsClick("delete"))
            {
                Delete();
            }
        }
コード例 #5
0
        private void DeletePhotos(string[] ids)
        {
            using (ErrorScope es = new ErrorScope())
            {
                if (ids.Length == 1 && ids[0] == string.Empty)
                {
                    ShowError("请先选择要删除的相片");
                    return;
                }

                int[] photoIDs = new int[ids.Length];

                for (int i = 0; i < ids.Length; i++)
                {
                    photoIDs[i] = int.Parse(ids[i]);
                }

                if (AlbumBO.Instance.DeletePhotos(MyUserID, photoIDs, true))
                {
                    ShowSuccess("删除成功", new object());
                }
                else
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                    });

                    ShowError("您所在的用户组没有权限删除该相片");
                }
            }
        }
コード例 #6
0
        private void SendInviteMail()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();
            string         obiterText;
            string         emailString;

            string[] emails;

            obiterText  = _Request.Get("message", Method.Post);
            emailString = _Request.Get("emails", Method.Post);

            using (ErrorScope es = new ErrorScope())
            {
                if (string.IsNullOrEmpty(emailString))
                {
                    ThrowError(new EmptyEmailError("emails"));
                }
                else
                {
                    emails = StringUtil.GetLines(emailString);
                    UserBO.Instance.MassEmailingInvite(My, emails, InviteBO.Instance.BuildFixInviteCode(MyUserID), obiterText);
                }

                if (es.HasUnCatchedError)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }
        }
コード例 #7
0
        private void DeleteCategory()
        {
            bool success = false;
            using (ErrorScope es = new ErrorScope())
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();

                bool isDeleteArticle = _Request.Get<bool>("witharticle", Method.Post, false);

                try
                {
                    success = BlogBO.Instance.DeleteBlogCategory(MyUserID, categoryID.Value, isDeleteArticle, true);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }
             
                if (success == false)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
            {
                Return("id", categoryID.Value);
            }
        }
コード例 #8
0
        private void Approve()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            int[] ids     = StringUtil.Split <int>(_Request.Get("commentid", Method.All, ""));
            bool  success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = CommentBO.Instance.ApproveComments(MyUserID, ids);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
            {
                Return(true);
            }
        }
コード例 #9
0
ファイル: Service_Friend.cs プロジェクト: huchao007/bbsmax
        public APIResult Friend_AcceptAddFriend(int operatorID, int notifyID, int groupIDToAdd)
        {
            if (!CheckClient()) return null;
            APIResult result = new APIResult();
            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    result.IsSuccess = FriendBO.Instance.Server_AcceptAddFriend(operatorID, notifyID, groupIDToAdd);
                    if (result.IsSuccess == false)
                    {
                        es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                        {
                            result.AddError(error.TatgetName,error.Message);
                        });
                    }
                }
                catch (Exception ex)
                {
                    result.ErrorCode = Consts.ExceptionCode;
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                }
            }

            return result;
        }
コード例 #10
0
        private void Add()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            m_UsernameToAdd = _Request.Get("username", Method.Post, string.Empty, false);

            try
            {
                using (ErrorScope es = new ErrorScope())
                {
                    bool sucess = FriendBO.Instance.AddUserToBlacklist(MyUserID, m_UsernameToAdd);
                    if (sucess == false || es.HasError)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error.Message);
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }
        }
コード例 #11
0
ファイル: album-list.aspx.cs プロジェクト: huchao007/bbsmax
		protected override void OnLoadComplete(EventArgs e)
		{
			using (ErrorScope es = new ErrorScope())
			{
				int pageNumber = _Request.Get<int>("page", 0);

				m_AlbumListPageSize = Consts.DefaultPageSize;

				m_AlbumList = AlbumBO.Instance.GetUserAlbums(MyUserID, SpaceOwnerID, pageNumber, m_AlbumListPageSize);

				if (m_AlbumList != null)
				{
					m_AlbumTotalCount = m_AlbumList.TotalRecords;

					UserBO.Instance.CacheSimpleUsers(m_AlbumList.GetUserIds());
				}
				else
				{
					es.CatchError<ErrorInfo>(delegate(ErrorInfo error) {
						ShowError(error);
					});
				}

				base.OnLoadComplete(e);
			}
        }
コード例 #12
0
ファイル: doing-delete.aspx.cs プロジェクト: huchao007/bbsmax
        private void Delete()
        {
            bool success = false;

            MessageDisplay msgDisplay = CreateMessageDisplay();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = DoingBO.Instance.DeleteDoing(MyUserID, doingID.Value);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }
 
                if (success == false)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
                Return("id", doingID);
        }
コード例 #13
0
        protected void CreatePassportClient()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("clientname", "url", "apifilepath");

            string clientname  = _Request.Get("clientname", Method.Post);
            string url         = _Request.Get("url", Method.Post);
            string apifilepath = _Request.Get("apifilepath", Method.Post);
            string accesskey   = _Request.Get("accesskey", Method.Post);

            InstructType[] structs = _Request.GetList <InstructType>("instructs", Method.Post, new InstructType[0]);

            using (ErrorScope es = new ErrorScope())
            {
                PassportClient client = PassportBO.Instance.CreatePassportClient(clientname, url, apifilepath, accesskey, structs);

                if (client != null)
                {
                    Return(true);
                    //ShowSuccess("创建客户端成功!");
                }
                else
                {
                    es.CatchError(delegate(ErrorInfo error) {
                        msgDisplay.AddError(error);
                    });
                }
            }
        }
コード例 #14
0
        private void ChangePassword()
        {
            string oldPassword;
            string newPassword, newPassword2;
            oldPassword = _Request.Get("password", Method.Post, string.Empty, false);
            newPassword = _Request.Get("newpassword", Method.Post, string.Empty, false);
            newPassword2 = _Request.Get("newpassword2", Method.Post, string.Empty, false);

            using (ErrorScope es = new ErrorScope())
            {
                MessageDisplay msgDisplay = CreateMessageDisplayForForm("changePwd", new string[] { "oldpassword", "newpassword", "newpassword2" });

                if (newPassword != newPassword2)
                {
                    msgDisplay.AddError(new PasswordInconsistentError("newpassword2"));
                }
                else
                {
                    if (UserBO.Instance.ResetPassword(My, oldPassword, newPassword) == false)
                    {
                        es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                }
            }
        }
コード例 #15
0
        protected void CreateDirectory()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();
            int newDirId;
            int dirId = _Request.Get<int>("directoryid", Method.Get, 0);
            DiskDirectory currentDir= DiskBO.Instance.GetDiskDirectory( MyUserID, dirId);

            string dirName = _Request.Get("directoryname", Method.Post);

            //if(new InvalidFileNameRegex().IsMatch(HttpUtility.HtmlDecode(dirName)))
            //{
            //    msgDisplay.AddError("目录名称能包含以下字符:"+HttpUtility.HtmlEncode(" \" | / \\ < > * ? "));
            //    return;
            //}

            using (ErrorScope es = new ErrorScope())
            {
                bool success = DiskBO.Instance.CreateDiskDirectory(MyUserID, dirId, dirName, out newDirId);

                if (success)
                    Return(newDirId);

                else
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error) {
                        msgDisplay.AddError(error);
                    });
                }
            }

        }
コード例 #16
0
ファイル: doing-list.aspx.cs プロジェクト: huchao007/bbsmax
        protected void Page_Load(object sender, EventArgs e)
        {
            int? userID = _Request.Get<int>("uid", Method.Get);
			int pageNumber = _Request.Get<int>("page", 1);

			m_DoingListPageSize = Consts.DefaultPageSize;

			if (_Request.IsClick("addcomment"))
				AddComment("space/" + SpaceOwnerID + "/doing", "#doing_" + CommentTargetID);

			using (ErrorScope es = new ErrorScope())
			{
				m_DoingList = DoingBO.Instance.GetUserDoingsWithComments(MyUserID, userID.Value, pageNumber, m_DoingListPageSize);

				if (m_DoingList != null)
				{
					m_TotalDoingCount = m_DoingList.TotalRecords;

					UserBO.Instance.WaitForFillSimpleUsers<Doing>(m_DoingList);

					foreach (Doing doing in m_DoingList)
					{
						UserBO.Instance.WaitForFillSimpleUsers<Comment>(doing.CommentList);
					}
				}

				if (es.HasUnCatchedError)
				{
					es.CatchError<ErrorInfo>(delegate(ErrorInfo error) {
						ShowError(error);
					});
				}
			}
        }
コード例 #17
0
        private void Delete()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            CommentType type = _Request.Get<CommentType>("type", Method.Get, CommentType.All);

            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = CommentBO.Instance.RemoveComment(MyUserID, commentID.Value);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }
                if (success == false)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }


            if (success)
                Return("commentID", commentID);
        }
コード例 #18
0
        public void DeleteChatSession()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            bool success = false;


            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = ChatBO.Instance.DeleteChatSession(ChatSession.OwnerID, ChatSession.UserID);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }


            if (success)
                Return("sesionid", sessionID);
        }
コード例 #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            m_FriendUserID = _Request.Get <int>("uid", Method.Get, 0);

            if (_Request.IsClick("shieldfriend"))
            {
                Shield();
                return;
            }

            using (ErrorScope es = new ErrorScope())
            {
                m_FriendToShield = FriendBO.Instance.GetFriend(MyUserID, m_FriendUserID);
                WaitForFillSimpleUser <Friend>(m_FriendToShield);

                if (es.HasUnCatchedError)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                        return;
                    });
                }
            }
        }
コード例 #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            m_GroupID = _Request.Get <int>("groupid", Method.Get, 0);

            if (m_GroupID <= 0)
            {
                ShowError(new InvalidParamError("groupid"));
            }


            using (ErrorScope es = new ErrorScope())
            {
                m_Group = FriendBO.Instance.GetFriendGroup(MyUserID, m_GroupID);

                if (es.HasUnCatchedError)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                    });
                }
                else if (m_Group == null)
                {
                    ShowError(new NotExistsFriendGroupError(m_GroupID));
                }
            }

            if (_Request.IsClick("delete"))
            {
                Delete();
            }
        }
コード例 #21
0
        private void ChangeMobile()
        {
            MessageDisplay messageDisplay = CreateMessageDisplay("mobilePhone");
            string         newMobilePhone = _Request.Get("mobilePhone", Method.Post, string.Empty);

            using (ErrorScope es = new ErrorScope())
            {
                ChangeMobileSecond = UserBO.Instance.SendChangePhoneSms(My, newMobilePhone);

                es.CatchError <PhoneRepeatError>(delegate(PhoneRepeatError error)
                {
                    ChangeMobileFirst  = true;
                    ChangeMobileSecond = false;
                    messageDisplay.AddError(error);
                });
                es.CatchError <PhoneValidateLimitError>(delegate(PhoneValidateLimitError error)
                {
                    //如果抛出一天限制三次的异常,则跳转到输入短信验证码页面.
                    ChangeMobileSecond   = true;
                    IsOverrunLimitTryNum = true;
                    messageDisplay.AddError(error);
                });
                es.CatchError <ErrorInfo>(delegate(ErrorInfo err)
                {
                    ChangeMobileFirst  = true;
                    ChangeMobileSecond = false;
                    messageDisplay.AddError(err.TatgetName, err.Message);
                });
            }
        }
コード例 #22
0
        private void SendEmail()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            string serialString, email;

            serialString = _Request.Get("serial", MaxLabs.WebEngine.Method.Post);
            email        = _Request.Get("email", MaxLabs.WebEngine.Method.Post);

            bool success;

            using (ErrorScope es = new ErrorScope())
            {
                Guid serial;
                try
                {
                    serial = new Guid(serialString);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddError(ex.Message);
                    return;
                }
                success = InviteBO.Instance.SendInviteByEmail(My, serial, email);
                es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                {
                    msgDisplay.AddError(error);
                });
            }

            if (success)
            {
                ShowSuccess("邀请邮件发送成功!");
            }
        }
コード例 #23
0
ファイル: album-create.aspx.cs プロジェクト: zhangbo27/bbsmax
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("create"))
            {
                using (ErrorScope es = new ErrorScope())
                {
                    MessageDisplay md = CreateMessageDisplay();

                    int albumID = 0;

                    string albumName     = _Request.Get("albumname");
                    string description   = _Request.Get("description");
                    string albumPassword = _Request.Get("albumpassword");

                    PrivacyType privacyType = _Request.Get <PrivacyType>("albumprivacy", Method.Post, PrivacyType.AllVisible);

                    if (AlbumBO.Instance.CreateAlbum(MyUserID, albumName, description, null, privacyType, albumPassword, out albumID) == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            ShowError(error);
                        });
                    }
                    else
                    {
                        ShowSuccess("相册创建成功", new object());
                    }
                }
            }
        }
コード例 #24
0
        private void Delete()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            CommentType type = _Request.Get <CommentType>("type", Method.Get, CommentType.All);

            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = CommentBO.Instance.RemoveComment(MyUserID, commentID.Value);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }
                if (success == false)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }


            if (success)
            {
                Return("commentID", commentID);
            }
        }
コード例 #25
0
ファイル: album-list.aspx.cs プロジェクト: zhangbo27/bbsmax
        protected override void OnLoadComplete(EventArgs e)
        {
            using (ErrorScope es = new ErrorScope())
            {
                int pageNumber = _Request.Get <int>("page", 0);

                m_AlbumListPageSize = Consts.DefaultPageSize;

                m_AlbumList = AlbumBO.Instance.GetUserAlbums(MyUserID, SpaceOwnerID, pageNumber, m_AlbumListPageSize);

                if (m_AlbumList != null)
                {
                    m_AlbumTotalCount = m_AlbumList.TotalRecords;

                    UserBO.Instance.CacheSimpleUsers(m_AlbumList.GetUserIds());
                }
                else
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error) {
                        ShowError(error);
                    });
                }

                base.OnLoadComplete(e);
            }
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {

            m_FriendUserID = _Request.Get<int>("uid", Method.Get, 0);

            if (_Request.IsClick("shieldfriend"))
            {
                Shield();
                return;
            }

            using (ErrorScope es = new ErrorScope())
            {
                m_FriendToShield = FriendBO.Instance.GetFriend(MyUserID, m_FriendUserID);
                WaitForFillSimpleUser<Friend>(m_FriendToShield);

                if (es.HasUnCatchedError)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                        return;
                    });
                }
            }

        }
コード例 #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string passportRoot = _Request.Get("passportroot", Method.Post);

            if (string.IsNullOrEmpty(passportRoot))
            {
                ShowError("请填写Passport服务器地址");
                return;
            }

            bool success;
            string errMsg = string.Empty;

            using (ErrorScope es = new ErrorScope())
            {
                PassportClientConfig setting = new PassportClientConfig();

                success = setting.TestPassportService(passportRoot, 5000);

                if (es.HasUnCatchedError)
                {
                    CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                        return;
                        //errMsg += error.Message;
                    });
                }
            }

            if (success)
                ShowSuccess("Passport服务器通讯正常!");
            else
                ShowError("无法连接" + passportRoot + "上的Passport服务!");
        }
コード例 #28
0
        protected void CreatePassportClient()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("clientname", "url", "apifilepath");

            string clientname = _Request.Get("clientname", Method.Post);
            string url = _Request.Get("url", Method.Post);
            string apifilepath = _Request.Get("apifilepath", Method.Post);
            string accesskey = _Request.Get("accesskey", Method.Post);

            InstructType[] structs =  _Request.GetList<InstructType>("instructs", Method.Post, new InstructType[0]);

            using (ErrorScope es = new ErrorScope())
            {
                PassportClient client = PassportBO.Instance.CreatePassportClient(clientname, url, apifilepath, accesskey, structs);

                if (client != null)
                {
                    Return(true);
                    //ShowSuccess("创建客户端成功!");
                }
                else
                {
                    es.CatchError(delegate(ErrorInfo error) {
                        msgDisplay.AddError(error);
                    });
                }
            }
        }
コード例 #29
0
        protected void CreateDirectory()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();
            int            newDirId;
            int            dirId      = _Request.Get <int>("directoryid", Method.Get, 0);
            DiskDirectory  currentDir = DiskBO.Instance.GetDiskDirectory(MyUserID, dirId);

            string dirName = _Request.Get("directoryname", Method.Post);

            //if(new InvalidFileNameRegex().IsMatch(HttpUtility.HtmlDecode(dirName)))
            //{
            //    msgDisplay.AddError("目录名称能包含以下字符:"+HttpUtility.HtmlEncode(" \" | / \\ < > * ? "));
            //    return;
            //}

            using (ErrorScope es = new ErrorScope())
            {
                bool success = DiskBO.Instance.CreateDiskDirectory(MyUserID, dirId, dirName, out newDirId);

                if (success)
                {
                    Return(newDirId);
                }

                else
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error) {
                        msgDisplay.AddError(error);
                    });
                }
            }
        }
コード例 #30
0
ファイル: album-create.aspx.cs プロジェクト: huchao007/bbsmax
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("create"))
            {
                using (ErrorScope es = new ErrorScope())
                {
                    MessageDisplay md = CreateMessageDisplay();

                    int albumID = 0;

                    string albumName = _Request.Get("albumname");
                    string description = _Request.Get("description");
                    string albumPassword = _Request.Get("albumpassword");

                    PrivacyType privacyType = _Request.Get<PrivacyType>("albumprivacy", Method.Post, PrivacyType.AllVisible);

                    if (AlbumBO.Instance.CreateAlbum(MyUserID, albumName, description, null, privacyType, albumPassword, out albumID) == false)
                    {
                        es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                        {
                            ShowError(error);
                        });
                    }
                    else
                    {
                        ShowSuccess("相册创建成功", new object());
                    }
                }
            }
        }
コード例 #31
0
        public APIResult Chat_AdminDeleteSessions(int userID, List <int> sessionIds)
        {
            if (!CheckClient())
            {
                return(null);
            }
            APIResult result = new APIResult();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    ChatBO.Instance.AdminDeleteSessions(userID, sessionIds);
                    bool hasError = false;
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        hasError = true;
                        result.AddError(error.TatgetName, error.Message);
                    });

                    result.IsSuccess = hasError == false;
                }
                catch (Exception ex)
                {
                    result.ErrorCode = Consts.ExceptionCode;
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                }
            }

            return(result);
        }
コード例 #32
0
ファイル: medal-users.aspx.cs プロジェクト: huchao007/bbsmax
        private void DeleteMedals()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            int[] userIDs = _Request.GetList<int>("userids", Method.Post, new int[0] { });
            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = UserBO.Instance.DeleteUserMedals(My, Medal.ID, userIDs);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    _Request.Clear(Method.Post);
                }
            }
        }
コード例 #33
0
        public APIResult Chat_DeleteChatSessions(int userID, List <int> targetUserIds)
        {
            if (!CheckClient())
            {
                return(null);
            }
            APIResult result = new APIResult();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    result.IsSuccess = ChatBO.Instance.DeleteChatSessions(userID, targetUserIds);

                    if (result.IsSuccess == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            result.AddError(error.TatgetName, error.Message);
                        });
                    }
                }
                catch (Exception ex)
                {
                    result.ErrorCode = Consts.ExceptionCode;
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                }
            }

            return(result);
        }
コード例 #34
0
        private void SetMyInviteSerial()
        {
            string myInviteSerial;

            myInviteSerial = _Request.Get("MyInviteSerial", Method.Post);

            using (ErrorScope es = new ErrorScope())
            {
                MessageDisplay msgDisplay = CreateMessageDisplayForForm("setSerial");

                if (!UserBO.Instance.SetUserInviteCode(MyUserID, myInviteSerial))
                {
                    ThrowError(new InviteSerialError("MyInviteSerial", myInviteSerial));
                }

                if (es.HasUnCatchedError)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    //msgDisplay.ShowInfo(this);
                    ShowSuccess();
                    //BbsRouter.JumpToCurrentUrl("success=1");
                }
            }
        }
コード例 #35
0
ファイル: friend-move.aspx.cs プロジェクト: zhangbo27/bbsmax
        protected void Page_Load(object sender, EventArgs e)
        {
            m_FriendUserIdsText = _Request.Get("uid");
            m_FriendUserIds     = StringUtil.Split <int>(m_FriendUserIdsText, ',');

            if (_Request.IsClick("movefriend"))
            {
                Move();
            }

            using (ErrorScope es = new ErrorScope())
            {
                m_FriendListToMove = FriendBO.Instance.GetFriends(MyUserID, m_FriendUserIds);

                WaitForFillSimpleUsers <Friend>(m_FriendListToMove);

                if (es.HasUnCatchedError)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                        return;
                    });
                }
            }
        }
コード例 #36
0
        public void RecoverPassword()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("email", "username", GetValidateCodeInputName("recoverpassword"));

            using (ErrorScope es = new ErrorScope())
            {
                ValidateCodeManager.CreateValidateCodeActionRecode("recoverpassword");
                
                if (CheckValidateCode("recoverpassword", msgDisplay))
                {
                    string username = _Request.Get("username", Method.Post, string.Empty, false);
                    string email = _Request.Get("email", Method.Post, string.Empty, false);

                    UserBO.Instance.TryRecoverPassword(username, email);

                    if (es.HasUnCatchedError)
                    {
                        es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        ShowSuccess("已经有一封邮件发到你的邮箱,请收取邮件,按照提示进行下一步操作", IndexUrl);
                        //msgDisplay.ShowInfoPage(this);
                    }
                }
            }
        }
コード例 #37
0
ファイル: club-create.aspx.cs プロジェクト: huchao007/bbsmax
	protected void Page_Load(object sender, EventArgs e)
	{
		m_ClubName = _Request.Get("ClubName", MaxLabs.WebEngine.Method.Post);
		m_ClubCategoryID = _Request.Get<int>("ClubCategoryID", MaxLabs.WebEngine.Method.Post, 0);

		if (_Request.IsClick("step2"))
		{
			MessageDisplay md = CreateMessageDisplay();

			using (ErrorScope es = new ErrorScope())
			{
				int newClubID = 0;

				if (ClubBO.Instance.CreateClub(MyUserID, m_ClubCategoryID, m_ClubName, out newClubID))
				{
					BbsRouter.JumpTo("club/" + newClubID + "/setting");
				}
				else
				{
					es.CatchError<ErrorInfo>(delegate(ErrorInfo error) {
						md.AddError(error);
					});

					m_HasError = true;
				}
			}
		}

		m_ClubCategoryList = ClubBO.Instance.GetClubCategories();
	}
コード例 #38
0
        private void Approve()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            int[] ids = StringUtil.Split<int>(_Request.Get("commentid", Method.All, ""));
            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = CommentBO.Instance.ApproveComments(MyUserID, ids);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
                Return(true);
        }
コード例 #39
0
        protected void Page_Load(object sender, EventArgs e)
        {
			m_Filter = AdminCommentFilter.GetFromFilter("filter");

            if (_Request.IsClick("deletecomment"))
                Delete();
            else if (_Request.IsClick("searchcomment"))
                Search();
            else if (_Request.IsClick("approvecomment"))
                Approve();
            else if (_Request.IsClick("deletesearch"))
                DeleteBySearch();

			using (ErrorScope es = new ErrorScope())
			{
				int pageNumber = _Request.Get<int>("page", 0);

				m_CommentList = CommentBO.Instance.GetCommentsForAdmin(MyUserID, m_Filter, pageNumber);

				if (m_CommentList != null)
				{
					m_CommentTotalCount = m_CommentList.TotalRecords;

					UserBO.Instance.WaitForFillSimpleUsers<Comment>(m_CommentList);
				}

				if (es.HasUnCatchedError)
				{
					es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
					{
						ShowError(error);
					});
				}
			}
        }
コード例 #40
0
ファイル: doing-delete.aspx.cs プロジェクト: zhangbo27/bbsmax
        private void Delete()
        {
            bool success = false;

            MessageDisplay msgDisplay = CreateMessageDisplay();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = DoingBO.Instance.DeleteDoing(MyUserID, doingID.Value);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
            {
                Return("id", doingID);
            }
        }
コード例 #41
0
        private void Add()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = FriendBO.Instance.AddUsersToBlacklist(MyUserID, m_UserIdsToAdd);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
            {
                Return(true);
            }
        }
コード例 #42
0
        public void DeleteChatSession()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            bool success = false;


            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = ChatBO.Instance.DeleteChatSession(MyUserID, m_TargetUserID);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
            {
                Return("targetUserID", m_TargetUserID);
            }
        }
コード例 #43
0
        private void SendEmail()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            string serialString, email;
            serialString = _Request.Get("serial", MaxLabs.WebEngine.Method.Post);
            email = _Request.Get("email", MaxLabs.WebEngine.Method.Post);

            bool success;

            using (ErrorScope es = new ErrorScope())
            {
                Guid serial;
                try
                {
                    serial = new Guid(serialString);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddError(ex.Message);
                    return;
                }
                success = InviteBO.Instance.SendInviteByEmail(My, serial, email);
                es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                {
                    msgDisplay.AddError(error);
                });
            }

            if (success)
            {
                ShowSuccess("邀请邮件发送成功!");
            }
        }
コード例 #44
0
ファイル: Service_Friend.cs プロジェクト: zhangbo27/bbsmax
        public APIResult Friend_RenameFriendGroup(int userID, int groupID, string groupName)
        {
            if (!CheckClient())
            {
                return(null);
            }
            APIResult result = new APIResult();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    int errorCode;
                    result.IsSuccess = FriendBO.Instance.Server_RenameFriendGroup(userID, groupID, groupName, out errorCode);
                    if (result.IsSuccess == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            result.AddError(error.TatgetName, error.Message);
                        });
                    }
                    result.ErrorCode = errorCode;
                }
                catch (Exception ex)
                {
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                    result.ErrorCode = Consts.ExceptionCode;
                }
            }
            return(result);
        }
コード例 #45
0
ファイル: Service_Friend.cs プロジェクト: zhangbo27/bbsmax
        public APIResult Friend_MoveFriends(int userID, List <int> friendUserIds, int friendGroupID)
        {
            if (!CheckClient())
            {
                return(null);
            }
            APIResult result = new APIResult();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    result.IsSuccess = FriendBO.Instance.Server_MoveFriends(userID, friendUserIds, friendGroupID);
                    if (result.IsSuccess == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            result.AddError(error.TatgetName, error.Message);
                        });
                    }
                }
                catch (Exception ex)
                {
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                    result.ErrorCode = Consts.ExceptionCode;
                }
            }
            return(result);
        }
コード例 #46
0
ファイル: manage-doing.aspx.cs プロジェクト: huchao007/bbsmax
        protected void Page_Load(object sender, EventArgs e)
		{
			if (_Request.IsClick("searchdoing"))
				Search();
			else if (_Request.IsClick("deletedoing"))
				DeleteBySelect();
			else if (_Request.IsClick("deletesearch"))
				DeleteBySearch();

			int pageNumber = _Request.Get<int>("page", 0);

			using (ErrorScope es = new ErrorScope())
			{
				m_DoingList = DoingBO.Instance.GetDoingsForAdmin(MyUserID, Filter, pageNumber);

				if (m_DoingList != null)
				{
					UserBO.Instance.WaitForFillSimpleUsers<Doing>(m_DoingList);

					m_DoingTotalCount = m_DoingList.TotalRecords;
				}

				if (es.HasUnCatchedError)
				{
					es.CatchError<ErrorInfo>(delegate(ErrorInfo error) {
						ShowError(error);
					});
				}
			}
		}
コード例 #47
0
ファイル: medal-users.aspx.cs プロジェクト: zhangbo27/bbsmax
        private void DeleteMedals()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            int[] userIDs = _Request.GetList <int>("userids", Method.Post, new int[0] {
            });
            bool success  = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = UserBO.Instance.DeleteUserMedals(My, Medal.ID, userIDs);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    _Request.Clear(Method.Post);
                }
            }
        }
コード例 #48
0
ファイル: prop-soldout.aspx.cs プロジェクト: huchao007/bbsmax
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("delete"))
            {
				int propID = _Request.Get<int>("id", Method.Get, 0);

                if (propID == 0)
					ShowError("缺少必要参数");

                MessageDisplay msgDisplay = CreateMessageDisplay();
                using (ErrorScope es = new ErrorScope())
                {
                    bool succeed = PropBO.Instance.SaleUserProp(My, propID, 0, 0);

                    if (succeed == false)
                    {
                        es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        Return(true);
                    }
                }
            }
        }
コード例 #49
0
        private void EmailBind()
        {
            string password = _Request.Get("password", Method.Post, string.Empty, false);
            string email    = _Request.Get("email", Method.Post, string.Empty, false);

            CheckUser();

            //UserBO.Instance.UpdateEmail(LoginUser, email);
            using (ErrorScope es = new ErrorScope())
            {
                m_Success = UserBO.Instance.LoginEmailBind(LoginUser, password, email);

                if (Success)
                {
                    ShowSuccess("Email绑定成功");
                }
                else
                {
                    es.CatchError <UserNotActivedError>(delegate(UserNotActivedError err)
                    {
                        Response.Redirect(err.ActiveUrl);
                    });
                    es.CatchError <EmailNotValidatedError>(delegate(EmailNotValidatedError err)
                    {
                        Response.Redirect(err.ValidateUrl);
                    });
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                    });
                }
            }
        }
コード例 #50
0
ファイル: blacklist.aspx.cs プロジェクト: huchao007/bbsmax
        private void Add()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            m_UsernameToAdd = _Request.Get("username", Method.Post, string.Empty, false);

            try
            {
                using (ErrorScope es = new ErrorScope())
                {
                    bool sucess = FriendBO.Instance.AddUserToBlacklist(MyUserID, m_UsernameToAdd);
                    if (sucess == false || es.HasError)
                    {
                        es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error.Message);
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }
        }
コード例 #51
0
        private void DeleteCategory()
        {
            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();

                bool isDeleteArticle = _Request.Get <bool>("witharticle", Method.Post, false);

                try
                {
                    success = BlogBO.Instance.DeleteBlogCategory(MyUserID, categoryID.Value, isDeleteArticle, true);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
            {
                Return("id", categoryID.Value);
            }
        }
コード例 #52
0
ファイル: Service_Friend.cs プロジェクト: zhangbo27/bbsmax
        public APIResult Friend_UpdateFriendHot(int userID, int hotType, int friendUserID)
        {
            if (!CheckClient())
            {
                return(null);
            }
            APIResult result = new APIResult();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    result.IsSuccess = FriendBO.Instance.Server_UpdateFriendHot(userID, (MaxLabs.bbsMax.Enums.HotType)hotType, friendUserID);
                    if (result.IsSuccess == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            result.AddError(error.TatgetName, error.Message);
                        });
                    }
                }
                catch (Exception ex)
                {
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                    result.ErrorCode = Consts.ExceptionCode;
                }
            }
            return(result);
        }
コード例 #53
0
        private void Delete()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    success = FriendBO.Instance.DeleteFromBlacklist(MyUserID, m_UserIDToRemove);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
                Return("removedUserID", m_UserIDToRemove);
        }
コード例 #54
0
ファイル: Service_Friend.cs プロジェクト: zhangbo27/bbsmax
        public APIResult Friend_DeleteFromBlacklist(int userID, int userIDInBlacklist)
        {
            if (!CheckClient())
            {
                return(null);
            }
            APIResult result = new APIResult();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    result.IsSuccess = FriendBO.Instance.Server_DeleteFromBlacklist(userID, userIDInBlacklist);
                    if (result.IsSuccess == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            result.AddError(error.TatgetName, error.Message);
                        });
                    }
                }
                catch (Exception ex)
                {
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                    result.ErrorCode = Consts.ExceptionCode;
                }
            }
            return(result);
        }
コード例 #55
0
ファイル: album-delete.aspx.cs プロジェクト: huchao007/bbsmax
        private void DeleteAlbum()
        {
            bool success = false;
            using (ErrorScope es = new ErrorScope())
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();

                try
                {
                    success = AlbumBO.Instance.DeleteAlbum(MyUserID, albumID.Value, true);

                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }
                if (success == false)
                {
                    es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
                Return("albumID", albumID.Value);
        }
コード例 #56
0
ファイル: Service_Friend.cs プロジェクト: zhangbo27/bbsmax
        public APIResult Friend_AcceptAddFriend(int operatorID, int notifyID, int groupIDToAdd)
        {
            if (!CheckClient())
            {
                return(null);
            }
            APIResult result = new APIResult();

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    result.IsSuccess = FriendBO.Instance.Server_AcceptAddFriend(operatorID, notifyID, groupIDToAdd);
                    if (result.IsSuccess == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            result.AddError(error.TatgetName, error.Message);
                        });
                    }
                }
                catch (Exception ex)
                {
                    result.ErrorCode = Consts.ExceptionCode;
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                }
            }

            return(result);
        }
コード例 #57
0
ファイル: club-create.aspx.cs プロジェクト: zhangbo27/bbsmax
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ClubName       = _Request.Get("ClubName", MaxLabs.WebEngine.Method.Post);
        m_ClubCategoryID = _Request.Get <int>("ClubCategoryID", MaxLabs.WebEngine.Method.Post, 0);

        if (_Request.IsClick("step2"))
        {
            MessageDisplay md = CreateMessageDisplay();

            using (ErrorScope es = new ErrorScope())
            {
                int newClubID = 0;

                if (ClubBO.Instance.CreateClub(MyUserID, m_ClubCategoryID, m_ClubName, out newClubID))
                {
                    BbsRouter.JumpTo("club/" + newClubID + "/setting");
                }
                else
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error) {
                        md.AddError(error);
                    });

                    m_HasError = true;
                }
            }
        }

        m_ClubCategoryList = ClubBO.Instance.GetClubCategories();
    }
コード例 #58
0
ファイル: Service_Friend.cs プロジェクト: zhangbo27/bbsmax
        public APIResult Friend_CreateFriendGroup(int userID, string groupName, out FriendGroupProxy friendGroup)
        {
            friendGroup = null;
            if (!CheckClient())
            {
                return(null);
            }
            APIResult   result   = new APIResult();
            FriendGroup newGroup = null;
            int         errorCode;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    result.IsSuccess = FriendBO.Instance.Server_AddFriendGroup(userID, groupName, out newGroup, out errorCode);
                    if (result.IsSuccess == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            result.AddError(error.TatgetName, error.Message);
                        });
                    }
                    result.ErrorCode = errorCode;
                }
                catch (Exception ex)
                {
                    result.AddError(ex.Message);
                    result.IsSuccess = false;
                    result.ErrorCode = Consts.ExceptionCode;
                }
                friendGroup = ProxyConverter.GetFriendGroupProxy(newGroup);
            }
            return(result);
        }
コード例 #59
0
ファイル: blog-view.aspx.cs プロジェクト: huchao007/bbsmax
		protected override void OnLoadComplete(EventArgs e)
		{
			using (ErrorScope es = new ErrorScope())
			{
				int? articleID = _Request.Get<int>("id");
				int pageNumber = _Request.Get<int>("page", 1);

				string password = _Request.Get("password");

				m_CommentListPageSize = Consts.DefaultPageSize;

				if (articleID.HasValue)
				{
					m_Article = BlogBO.Instance.GetBlogArticleForVisit(MyUserID, articleID.Value, password);

					if (m_Article != null)
					{
						m_ArticleTagList = m_Article.Tags;

						m_ArticleVisitorList = m_Article.LastVisitors;

						m_CommentTargetID = m_Article.ArticleID;

						if (_Request.IsClick("addcomment"))
							AddComment("space/" + SpaceOwnerID + "/blog/article-" + articleID,"#comment");

						if (m_ArticleVisitorList != null)
							UserBO.Instance.WaitForFillSimpleUsers<BlogArticleVisitor>(m_ArticleVisitorList);

						m_CommentList = CommentBO.Instance.GetComments(articleID.Value, CommentType.Blog, pageNumber, m_CommentListPageSize, true, out m_TotalCommentCount);

						if (m_CommentList != null)
							UserBO.Instance.WaitForFillSimpleUsers<Comment>(m_CommentList);

						m_ArticleSimilarList = BlogBO.Instance.GetSimilarArticles(MyUserID, m_Article.UserID, articleID.Value, 10);
					}
					else
					{
						es.CatchError<NoPermissionVisitBlogArticleBeacuseNeedPasswordError>(
							delegate(NoPermissionVisitBlogArticleBeacuseNeedPasswordError error)
							{

								m_DisplayPasswordForm = true;
							}
						);

						if(m_DisplayPasswordForm == false)
							ShowError("所访问的日志不存在。");
					}
				}
				else
				{
					ShowError("所访问的日志不存在。");
				}
			}

			base.OnLoadComplete(e);
		}
コード例 #60
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int? typeid = _Request.Get<int>("tid", Method.Get);

            if (typeid != null)
            {
                AdminImpressionRecordFilter filter = AdminImpressionRecordFilter.GetFromForm();

                filter.TypeID = typeid.Value;

                UrlScheme scheme = BbsRouter.GetCurrentUrlScheme();

                scheme.RemoveQuery("tid");
                scheme.AttachQuery("filter", filter.ToString());
                scheme.AttachQuery("page", "1");

                HttpContext.Current.Response.Redirect(scheme.ToString());
            }

            m_AdminForm = AdminImpressionRecordFilter.GetFromFilter("filter");

			if (_Request.IsClick("advancedsearch"))
			{
				SearchTypes();
			}
			else if (_Request.IsClick("deletechecked"))
			{
				DeleteChecked();
			}
			else if (_Request.IsClick("deletesearched"))
			{
				DeleteSearch();
			}

			using (ErrorScope es = new ErrorScope())
			{
				int pageNumber = _Request.Get<int>("page", 0);

				m_RecordListPageSize = m_AdminForm.PageSize;

                m_RecordList = ImpressionBO.Instance.GetImpressionRecordsForAdmin(My, m_AdminForm, pageNumber);

				if (m_RecordList != null)
				{
					m_TotalRecordCount = m_RecordList.TotalRecords;
				}

				if (es.HasUnCatchedError)
				{
					es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
					{
						ShowError(error);
					});
				}

                UserBO.Instance.WaitForFillSimpleUsers<ImpressionRecord>(m_RecordList, 0);
			}
		}