• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ErrorScope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ErrorScope的典型用法代码示例。如果您正苦于以下问题:C# ErrorScope类的具体用法?C# ErrorScope怎么用?C# ErrorScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ErrorScope类属于命名空间,在下文中一共展示了ErrorScope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: EmailBind

        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);
                    });
                }
            }

        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:33,代码来源:loginemailbind.aspx.cs


示例2: Page_Load

        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;
                    });
                }
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:26,代码来源:friend-move.aspx.cs


示例3: DeleteCategory

        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);
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:32,代码来源:blog-blogcategory-delete.aspx.cs


示例4: Page_Load

        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();
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:28,代码来源:friendgroup-delete.aspx.cs


示例5: DeleteMedals

        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);
                }
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:31,代码来源:medal-users.aspx.cs


示例6: Page_Load

        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());
                    }
                }
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:30,代码来源:album-create.aspx.cs


示例7: CreatePassportClient

        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);
                    });
                }
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:28,代码来源:passport-editclient.aspx.cs


示例8: Friend_AcceptAddFriend

        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;
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:27,代码来源:Service_Friend.cs


示例9: Page_Load

        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;
                    });
                }
            }

        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:27,代码来源:friend-shield.aspx.cs


示例10: Page_Load

        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服务!");
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:35,代码来源:passport-test.aspx.cs


示例11: Delete

        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);
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:29,代码来源:doing-delete.aspx.cs


示例12: ChangePassword

        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);
                        });
                    }
                }
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:28,代码来源:changepassword.aspx.cs


示例13: OnLoadComplete

		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);
			}
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:26,代码来源:album-list.aspx.cs


示例14: CreateDirectory

        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);
                    });
                }
            }

        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:31,代码来源:disk-createdirectory.aspx.cs


示例15: Page_Load

        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);
					});
				}
			}
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:34,代码来源:doing-list.aspx.cs


示例16: Delete

        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);
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:31,代码来源:comment-delete.aspx.cs


示例17: DeleteChatSession

        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);
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:31,代码来源:chat-admindelete-session.aspx.cs


示例18: DeletePhotos

        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("您所在的用户组没有权限删除该相片");
                }
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:32,代码来源:album-deletephotos.aspx.cs


示例19: RecoverPassword

        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);
                    }
                }
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:30,代码来源:recoverpassword.aspx.cs


示例20: SendEmail

        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("邀请邮件发送成功!");
            }
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:34,代码来源:user-sendinviteemail.aspx.cs



注:本文中的ErrorScope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ErrorSet类代码示例发布时间:2022-05-24
下一篇:
C# ErrorReporter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap