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); }); } } }
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; }); } } }
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("您所在的用户组没有权限删除该相片"); } } }
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(); } }
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("您所在的用户组没有权限删除该相片"); } } }
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); }); } } }
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); } }
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); } }
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; }
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); } }
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); } }
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); }
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); }); } } }
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); }); } } } }
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); }); } } }
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); }); } } }
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); }
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); }
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; }); } } }
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(); } }
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); }); } }
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("邀请邮件发送成功!"); } }
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()); } } } }
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); } }
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); } }
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; }); } } }
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服务!"); }
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); }); } } }
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); }); } } }
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()); } } } }
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); }
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); } } }
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); }
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"); } } }
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; }); } } }
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); } } } }
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(); }
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); }
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); }); } } }
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); } }
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); } }
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); } }
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("邀请邮件发送成功!"); } }
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); }
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); }
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); }); } } }
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); } } }
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); } } } }
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); }); } } }
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); } }
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); } }
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); }
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); }
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); }
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); }
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); }
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(); }
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); }
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); }
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); } }