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);
            }
        }
Exemple #2
0
        private void SaveAppFeedFilters()
        {
            int userID = UserBO.Instance.GetCurrentUserID();

            string feedFilterIDString = _Request.Get("appFeedFilterIDs", Method.Post);

            MessageDisplay msgDisplay = CreateMessageDisplay();

            if (!string.IsNullOrEmpty(feedFilterIDString))
            {
                string[]   ids           = feedFilterIDString.Split(',');
                List <int> feedFilterIDs = new List <int>();
                foreach (string id in ids)
                {
                    feedFilterIDs.Add(int.Parse(id));
                }

                if (feedFilterIDs.Count > 0)
                {
                    try
                    {
                        FeedBO.Instance.DeleteFeedFilters(userID, feedFilterIDs);
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddException(ex);
                    }
                }
            }
        }
Exemple #3
0
        private void AddDoing()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("doingContent");

            int    userID   = MyUserID;
            string content  = _Request.Get("doingContent", Method.Post);//TOTO:文本过虑
            string createIP = _Request.IpAddress;

            try
            {
                using (new ErrorScope())
                {
                    bool success = DoingBO.Instance.CreateDoing(userID, createIP, content);
                    if (success == false)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    //else
                    //    msgDisplay.ShowInfo(this);
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
        private void MoveForum()
        {
            bool success = false;

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

                int parentID = _Request.Get <int>("parentForum", Method.Post, 0);

                try
                {
                    success = ForumBO.Instance.MoveFourm(Forum.ForumID, parentID);
                    if (success == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }
            }

            if (success)
            {
                Return(true);
            }
        }
        private void Delete()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            bool success = false;

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

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

            if (success)
            {
                Return("targetUserIds", m_FriendUserIds);
            }
        }
Exemple #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);
            }
        }
Exemple #8
0
        private void DeleteForum()
        {
            //using (new ErrorScope())
            //{
            bool beginTask = false;

            MessageDisplay msgDisplay = CreateMessageDisplay();

            try
            {
                int parentID = _Request.Get <int>("parentForum", Method.Post, 0);
                foreach (Forum forum in Forum.AllSubForums)
                {
                    ForumBO.Instance.MoveFourm(forum.ForumID, parentID);
                }

                beginTask = TaskManager.BeginTask(MyUserID, new DeleteForumTask(), Forum.ForumID.ToString());
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }
            //}
            if (beginTask)
            {
                Return(true);
            }
        }
Exemple #9
0
        /// <summary>
        /// 够买邀请码
        /// </summary>
        private void BuySerial()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();
            int            buyCount;

            buyCount = _Request.Get <int>("buyCount", MaxLabs.WebEngine.Method.Post, 0);
            try
            {
                InviteBO.Instance.BuyInviteSerial(My, buyCount);

                if (HasUnCatchedError)
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        if (error is UserPointOverMinValueError || error is UserPointOverMaxValueError)
                        {
                            UserPointOverMinValueError tempError = (UserPointOverMinValueError)error;
                            ErrorInfo pointError = new BuyInviteSerialPointError(tempError.UserPoint.Name, tempError.GetType());
                            msgDisplay.AddError(pointError.Message);
                        }
                        else
                        {
                            msgDisplay.AddError(error);
                        }
                    });
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }
        }
        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);
            }
        }
Exemple #11
0
        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 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);
            }
        }
Exemple #13
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);
            }
        }
        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);
            }
        }
Exemple #15
0
        private bool SaveSpacePrivacy()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("spaceprivacy");

            SpacePrivacyType blogPrivacy        = _Request.Get <SpacePrivacyType>("BlogPrivacy", SpacePrivacyType.All);
            SpacePrivacyType boardPrivacy       = _Request.Get <SpacePrivacyType>("BoardPrivacy", SpacePrivacyType.All);
            SpacePrivacyType albumPrivacy       = _Request.Get <SpacePrivacyType>("AlbumPrivacy", SpacePrivacyType.All);
            SpacePrivacyType doingPrivacy       = _Request.Get <SpacePrivacyType>("DoingPrivacy", SpacePrivacyType.All);
            SpacePrivacyType feedPrivacy        = _Request.Get <SpacePrivacyType>("FeedPrivacy", SpacePrivacyType.All);
            SpacePrivacyType friendListPrivacy  = _Request.Get <SpacePrivacyType>("FriendListPrivacy", SpacePrivacyType.Self);
            SpacePrivacyType informationPrivacy = _Request.Get <SpacePrivacyType>("InformationPrivacy", SpacePrivacyType.All);
            SpacePrivacyType spacePrivacy       = _Request.Get <SpacePrivacyType>("SpacePrivacy", SpacePrivacyType.All);
            SpacePrivacyType sharePrivacy       = _Request.Get <SpacePrivacyType>("SharePrivacy", SpacePrivacyType.All);

            try
            {
                SpaceBO.Instance.ModifySpacePrivacy(MyUserID, blogPrivacy, feedPrivacy, boardPrivacy, doingPrivacy, albumPrivacy, spacePrivacy, sharePrivacy, friendListPrivacy, informationPrivacy);
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
                return(false);
            }

            return(true);
        }
Exemple #16
0
        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("CreateImpression"))
            {
                MessageDisplay msgDisplay = CreateMessageDisplayForForm("ImpressionForum");
                string         text       = _Request.Get("Text", Method.Post, string.Empty);

                bool success;

                using (ErrorScope es = new ErrorScope())
                {
                    try
                    {
                        success = ImpressionBO.Instance.CreateImpression(My, User, text);
                        if (success == false)
                        {
                            es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                            {
                                msgDisplay.AddError(error);
                            });
                        }
                        else
                        {
                            m_IsShowImpressionInput = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddException(ex);
                    }

                    if (msgDisplay.HasAnyError())
                    {
                        m_IsShowImpressionInput = true;
                    }
                }
            }
            else if (_Request.Get <int>("typeid", Method.Get, 0) > 0)
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();
                int            typeID     = _Request.Get <int>("TypeID", Method.Get, 0);
                using (ErrorScope es = new ErrorScope())
                {
                    try
                    {
                        ImpressionBO.Instance.DeleteImpressionTypeForUser(My, typeID);
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddError(ex.Message);
                    }
                }
            }

            WaitForFillSimpleUsers <ImpressionRecord>(ImpressionRecordList, 0);
            WaitForFillSimpleUsers <Impression>(ImpressionList);
        }
Exemple #18
0
        private void Verify()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            int groupID  = _Request.Get <int>("ToFriendGroupID", Method.Post, 0);
            int notifyID = _Request.Get <int>("notifyid", Method.Get, 0);

            if (CreateGroup)
            {
                string groupName = _Request.Get("newgroup", Method.Post);
                groupID = FriendBO.Instance.AddFriendGroup(MyUserID, groupName);

                if (HasUnCatchedError)
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                    return;
                }
            }

            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    if (IsMyFriend)
                    {
                        success = FriendBO.Instance.MoveFriends(MyUserID, new int[] { TryAddUser.UserID }, groupID);
                        NotifyBO.Instance.DeleteNotify(My, notifyID);
                    }
                    else
                    {
                        success = FriendBO.Instance.AcceptAddFriend(My, notifyID, groupID);
                    }
                    //NotifyBO.Instance.DeleteNotify(My, notifyID);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

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


            if (success)
            {
                Return(notifyID);
            }
        }
Exemple #19
0
        private void Move()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            int friendGroupID = _Request.Get <int>("groupid", Method.Post, 0);

            //int[] ids = StringUtil.Split<int>(friendUserIDs, ',');

            if (CreateGroup)
            {
                string groupName = _Request.Get("newgroup", Method.Post);
                friendGroupID = FriendBO.Instance.AddFriendGroup(MyUserID, groupName);

                if (HasUnCatchedError)
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                    return;
                }
            }


            bool success = false;

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

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

            //成功就返回
            if (success)
            {
                JsonBuilder json = new JsonBuilder();
                json.Set("newGroupID", friendGroupID);
                json.Set("userIds", m_FriendUserIds);
                Return(json);
                //msgDisplay.ShowInfo(this);
            }
        }
        private void ExchangePoint()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("password", "pointvalue", "pointtype", "targetpointtype");

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

            string valueString = _Request.Get("pointvalue", Method.Post, string.Empty);

            int pointValue;

            if (!int.TryParse(valueString, out pointValue))
            {
                msgDisplay.AddError("pointvalue", Lang_Error.User_UserPointExechangePointValueError);
            }

            valueString = _Request.Get("pointtype", Method.Post, string.Empty);
            if (string.Empty == valueString)
            {
                msgDisplay.AddError("pointtype", Lang_Error.User_UserPointEmptyExchangePointTypeError);
            }

            UserPointType pointType = StringUtil.TryParse <UserPointType>(valueString, UserPointType.Point1);

            valueString = _Request.Get("targetpointtype", Method.Post, string.Empty);
            if (string.Empty == valueString)
            {
                msgDisplay.AddError("targetpointtype", Lang_Error.User_UserPointEmptyExchangeTargetPointTypeError);
            }


            UserPointType targetPointType = StringUtil.TryParse <UserPointType>(valueString, UserPointType.Point1);

            if (msgDisplay.HasAnyError())
            {
                return;
            }

            try
            {
                if (!UserBO.Instance.ExechangePoint(My, password, pointType, targetPointType, pointValue))
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    _Request.Clear(Method.Post);
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }
        }
Exemple #21
0
        private void Edit()
        {
            string      content = _Request.Get("Content", Method.Post, string.Empty, false);
            CommentType type    = _Request.Get <CommentType>("type", Method.Get, CommentType.All);


            string         newContent     = null;
            MessageDisplay msgDisplay     = CreateMessageDisplay();
            bool           success        = false;
            string         warningMessage = null;

            try
            {
                using (ErrorScope es = new ErrorScope())
                {
                    success = CommentBO.Instance.ModifyComment(MyUserID, commentID.Value, content, type, out newContent);

                    if (success == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            if (error is UnapprovedError)
                            {
                                warningMessage = error.Message;
                                //AlertWarning(error.Message);
                                //ShowWarning(error.Message);
                            }
                            else
                            {
                                msgDisplay.AddError(error);
                            }
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }

            if (success)
            {
                Return("content", newContent);
            }
            else if (warningMessage != null)
            {
                JsonBuilder jb = new JsonBuilder();
                jb.Set("iswarning", true);
                jb.Set("message", warningMessage);
                Return(jb);
            }
        }
Exemple #22
0
        private void Delete()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            bool deleteFriends = _Request.Get <int>("deleteFriends", Method.Post, 1) == 1;

            int friendGroupID = _Request.Get <int>("ToFriendGroupID", Method.Post, -1);

            if (deleteFriends == false && friendGroupID == -1)
            {
                msgDisplay.AddError("请选择要移动到的好友分组");
                return;
            }
            bool success = false;

            try
            {
                using (ErrorScope es = new ErrorScope())
                {
                    if (deleteFriends == false)
                    {
                        FriendCollection friends = FriendBO.Instance.GetFriends(MyUserID, Group.GroupID);
                        success = FriendBO.Instance.MoveFriends(MyUserID, friends.GetKeys(), friendGroupID);
                        if (success)
                        {
                            success = FriendBO.Instance.DeleteFriendGroup(MyUserID, m_GroupID, deleteFriends);
                        }
                    }
                    else
                    {
                        success = FriendBO.Instance.DeleteFriendGroup(MyUserID, m_GroupID, deleteFriends);
                    }

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

            if (success)
            {
                Return("deletedGroupID", m_GroupID);
            }
        }
Exemple #23
0
        private void DeleteAttachment()
        {
            int?atttachmentID = _Request.Get <int>("attachmentID", Method.Post);
            int?forumID       = _Request.Get <int>("forumID", Method.Post);

            bool success = false;

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


                if (atttachmentID == null)
                {
                    msgDisplay.AddError(new InvalidParamError("atttachmentID").Message);
                }

                if (forumID == null)
                {
                    msgDisplay.AddError(new InvalidParamError("forumID").Message);
                }

                if (msgDisplay.HasAnyError())
                {
                    return;
                }

                try
                {
                    success = PostBOV5.Instance.DeleteAttachments(My, forumID.Value, new int[] { atttachmentID.Value });
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

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

            if (success)
            {
                Return(atttachmentID.Value);
            }
        }
Exemple #24
0
        private void Hail()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay(GetValidateCodeInputName(validateActionName));

            int    HailID  = _Request.Get <int>("HailID", Method.Post, 0);
            string note    = _Request.Get("Note");
            string IP      = _Request.IpAddress;
            bool   success = false;

            using (ErrorScope es = new ErrorScope())
            {
                ValidateCodeManager.CreateValidateCodeActionRecode(validateActionName);

                if (this.TheNotify == null && !CheckValidateCode(validateActionName, msgDisplay))
                {
                    return;
                }
                else
                {
                    try
                    {
                        Notify notify = new HailNotify(MyUserID, HailID, note);
                        notify.UserID = UserID;
                        NotifyBO.Instance.AddNotify(My, notify);
                        NotifyBO.Instance.DeleteNotify(My, NotifyID);
                        success = true;
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddException(ex);
                        return;
                    }
                }

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

            if (success)
            {
                ShowSuccess("已成功送出了您的问候!", 1);
                return;
            }
        }
Exemple #25
0
        protected void UserPay()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();
            string         orderNo    = System.DateTime.Now.ToString("yyyyMMddHHmmssfffff");

            UserPointType?type = _Request.Get <UserPointType>("currentPointType", Method.Post);

            if (type == null)
            {
                msgDisplay.AddError("请选择要充值的积分类型");
                return;
            }

            //byte payType = _Request.Get<byte>("paytypename", Method.Post,1);
            byte payment  = _Request.Get <byte>("payment", Method.Post, 1);
            int  payValue = _Request.Get <int>("payvalue", Method.Post, 0);
            //decimal orderAmount = 0.01M;
            string submitIp = _Request.IpAddress;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    PayUrl = PayBO.Instance.CreateUserPay(My, orderNo, payment, type.Value, payValue, submitIp);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                    return;
                }

                if (!string.IsNullOrEmpty(PayUrl))
                {
                    //Response.Redirect(PayUrl);
                    Response.Write("<script type=\"text/javascript\">opener.showMask();location.href='" + PayUrl + "';</script>");
                    Response.End();
                }
                else
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        ShowError(error);
                    });

                    return;
                }
            }
        }
Exemple #26
0
        private void UserLogin()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("username", "password", "noActive", GetValidateCodeInputName(validateActionName));
            string         email      = _Request.Get("email", Method.Post, string.Empty, false);
            string         username   = _Request.Get("username", Method.Post, string.Empty, false);
            string         password   = _Request.Get("password", Method.Post, string.Empty, false);
            bool           autoLogin  = !string.IsNullOrEmpty(_Request.Get("autologin", Method.Post));
            bool           invisible  = _Request.Get("invisible", Method.Post) == "true";

            string account = username == string.Empty ? email : username;

            string ip = _Request.IpAddress;

            //如果全局UserLoginType为Username -或者- 全局UserLoginType为All且用户选择了账号登陆  则为true
            bool IsUsernameLogin = (LoginType == UserLoginType.Username || (LoginType == UserLoginType.All && _Request.Get <int>("logintype", Method.Post, 0) == 0));

            ValidateCodeManager.CreateValidateCodeActionRecode(validateActionName);
            if (!CheckValidateCode(validateActionName, msgDisplay))
            {
                return;
            }

            try
            {
                Success = UserBO.Instance.Login(account, password, ip, autoLogin, IsUsernameLogin);
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
                Success = false;
            }

            if (Success)
            {
#if !Passport
                UpdateOnlineStatus(OnlineAction.OtherAction, 0, "");
                OnlineUserPool.Instance.Update(My, invisible);
                ShowSuccess("登录成功", true);
#endif
            }
            else
            {
                CatchError <ErrorInfo>(delegate(ErrorInfo error)
                {
                    msgDisplay.AddError(error);
                });
            }
        }
Exemple #27
0
        private void DeleteFeed()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();
            int            userID     = UserBO.Instance.GetCurrentUserID();
            int?           feedID     = _Request.Get <int>("FeedID", Method.Get);

            if (feedID == null)
            {
                msgDisplay.AddError(new InvalidParamError("FeedID").Message);
                return;
            }

            bool deleteOK = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    if (_Request.Get("feedtype", Method.Get, "") == "0")//管理员删除全站动态
                    {
                        deleteOK = FeedBO.Instance.DeleteAnyFeed(MyUserID, feedID.Value);
                    }
                    else
                    {
                        int targetUserID = _Request.Get <int>("uid", Method.Get, 0);
                        deleteOK = FeedBO.Instance.DeleteFeed(userID, targetUserID, feedID.Value);
                    }
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

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

            if (deleteOK)
            {
                Return("id", feedID);
            }
            ;
        }
Exemple #28
0
        private void AddDoing()
        {
            if (My.Roles.IsInRole(Role.FullSiteBannedUsers))
            {
                ShowError("您已经被整站屏蔽不能发表记录");
            }

            MessageDisplay msgDisplay = CreateMessageDisplayForForm("doingform");//, GetValidateCodeInputName("CreateDoing"));

            //if (CheckValidateCode("CreateDoing", msgDisplay))
            //{
            string content = _Request.Get("content", Method.Post, string.Empty);

            try
            {
                using (new ErrorScope())
                {
                    bool success = DoingBO.Instance.CreateDoing(MyUserID, _Request.IpAddress, content);

                    if (success == false)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        if (IsSpace)
                        {
                            BbsRouter.JumpTo("app/doing/index", "uid=" + AppOwnerUserID);
                        }
                        else
                        {
                            BbsRouter.JumpTo("app/doing/index");
                        }

                        //ValidateCodeManager.CreateValidateCodeActionRecode("CreateDoing");
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }
            //}
        }
Exemple #29
0
        protected void SaveAnnouncement()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("subject", "content");

            string           subject, content;
            DateTime         beginDate, endDate;
            int              sortOrder;
            AnnouncementType announcementType;
            Announcement     ann = null;

            subject          = _Request.Get("subject", Method.Post);
            announcementType = _Request.Get <AnnouncementType>("AnnouncementType", Method.Post, AnnouncementType.Text);
            beginDate        = DateTimeUtil.ParseBeginDateTime(_Request.Get("begindate", Method.Post));
            endDate          = DateTimeUtil.ParseEndDateTime(_Request.Get("enddate", Method.Post));
            sortOrder        = _Request.Get <int>("sortorder", Method.Post, 0);

            content = announcementType == AnnouncementType.Text
                ? _Request.Get("content", Method.Post, "", false)
                : _Request.Get("url", Method.Post, "", false);

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    ann = AnnouncementBO.Instance.SaveAnnouncement(MyUserID, Announcement.AnnouncementID, subject
                                                                   , content, beginDate, endDate, announcementType, sortOrder);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (ann == null)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    Return(ann, true);
                }
            }
        }
Exemple #30
0
        private void Shield()
        {
            bool isShield = _Request.Get <bool>("isShield", Method.Post, false) ? false : true;

            MessageDisplay msgDisplay = CreateMessageDisplay();

            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    if (isShield)
                    {
                        success = FeedBO.Instance.FiltrateFeed(MyUserID, m_FriendUserID);
                    }
                    else
                    {
                        success = FeedBO.Instance.UnFiltrateFeed(m_FriendUserID);
                    }
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

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

            if (success)
            {
                JsonBuilder json = new JsonBuilder();
                json.Set("targetUserID", m_FriendUserID);
                json.Set("isShield", isShield);
                Return(json);
                //msgDisplay.ShowInfo(this);
            }
        }