Example #1
0
        /// <summary>
        /// 角色信息添加数据检测
        /// </summary>
        /// <param name="form">数据表单</param>
        /// <param name="stateInfo">状态消息</param>
        /// <returns>执行结果</returns>
        private bool AddedByCheck(FormCollection form, out string stateInfo)
        {
            stateInfo = GeneralHandler.StateSuccess;
            string txtName = form["txtName"] as string;

            if (string.IsNullOrEmpty(txtName) || txtName.Length < 2 || txtName.Length > 50)
            {
                stateInfo = "名称不能为空或小于2个或大于50个字符!";
                return(false);
            }
            if (!ValidHelper.ChsIsChineseOrEngOrNums(txtName))
            {
                stateInfo = "您输入的名称不正确!(只能由汉字、字母、数字组成)";
                return(false);
            }
            string txtCode = form["txtCode"] as string;

            if ((txtCode.Length > 0 && !ValidHelper.EngIsEngAndNums(txtCode)) || txtCode.Length > 50)
            {
                stateInfo = "您输入的编码不正确!(只能由字母和数字组成,且不大于50个字)";
                return(false);
            }
            string txtDesc = form["txtDesc"] as string;

            if ((txtDesc.Length > 0 && !ValidHelper.ChsIsMemos(txtDesc)) || txtDesc.Length > 300)
            {
                stateInfo = "您输入的描述不正确!(只能由汉字、字母、数字组成,且不大于300个字)";
                return(false);
            }
            return(true);
        }
Example #2
0
        /// <summary>
        /// 模块信息添加数据检测
        /// </summary>
        /// <param name="form">数据表单</param>
        /// <param name="stateInfo">状态消息</param>
        /// <returns>执行结果</returns>
        private bool AddedByCheck(FormCollection form, out string stateInfo)
        {
            stateInfo = GeneralHandler.StateSuccess;
            int father = TypeHelper.TypeToInt32(form["ddlFather"], -1);

            if (father == 0 || father < -1)
            {
                stateInfo = "模块标识不正确!";
                return(false);
            }
            string txtName = form["txtName"] as string;

            if (string.IsNullOrEmpty(txtName) || txtName.Length < 2 || txtName.Length > 50)
            {
                stateInfo = "名称不能为空或小于2个或大于50个字符!";
                return(false);
            }
            if (!ValidHelper.ChsIsChineseOrEngOrNums(txtName))
            {
                stateInfo = "您输入的名称不正确!(只能由汉字、字母、数字组成)";
                return(false);
            }
            string txtCode = form["txtCode"] as string;

            if ((txtCode.Length > 0 && !ValidHelper.EngIsEngAndNums(txtCode)) || txtCode.Length > 50)
            {
                stateInfo = "您输入的编码不正确!(只能由字母和数字组成,且不大于50个字)";
                return(false);
            }
            string txtIdent = form["txtIdent"] as string;

            if (!ValidHelper.NumIsInteger(txtIdent))
            {
                stateInfo = "您输入的识别码不正确!(只能由数字组成,介于1-65535为佳)";
                return(false);
            }
            string txtRank = form["txtRank"] as string;

            if ((txtRank.Length > 0 && !ValidHelper.NumIsIntegralBySignless(txtRank)) || int.Parse(txtRank) < 1 || int.Parse(txtRank) > 65535)
            {
                stateInfo = "您输入的序列不正确!(只能由数字组成,且不小于1及大于65535)";
                return(false);
            }
            string txtDesc = form["txtDesc"] as string;

            if ((txtDesc.Length > 0 && !ValidHelper.ChsIsMemos(txtDesc)) || txtDesc.Length > 300)
            {
                stateInfo = "您输入的描述不正确!(只能由汉字、字母、数字组成,且不大于300个字)";
                return(false);
            }
            return(true);
        }
Example #3
0
        /// <summary>
        /// 管理员信息编辑数据检测
        /// </summary>
        /// <param name="form">数据表单</param>
        /// <param name="stateInfo">状态消息</param>
        /// <returns>执行结果</returns>
        private bool EditoredByCheck(FormCollection form, out string stateInfo)
        {
            stateInfo = GeneralHandler.StateSuccess;
            int sltDepart = TypeHelper.TypeToInt32(form["sltDepart"], -1);

            if (sltDepart < 1)
            {
                stateInfo = "隶属部门不正确!";
                return(false);
            }
            int ddlGrade = TypeHelper.TypeToInt32(form["ddlGrade"], -1);

            if (ddlGrade < 1 || ddlGrade > 3)
            {
                stateInfo = "管理级别不正确!";
                return(false);
            }
            string txtSurname = form["txtSurname"] as string;

            if (string.IsNullOrEmpty(txtSurname) || txtSurname.Length < 2 || txtSurname.Length > 10)
            {
                stateInfo = "姓名不能为空或小于2个或大于10个汉字!";
                return(false);
            }
            if (!ValidHelper.ChsIsChinese(txtSurname))
            {
                stateInfo = "您输入的姓名不正确!(只能由汉字组成)";
                return(false);
            }
            string txtMobile = form["txtMobile"] as string;

            if (string.IsNullOrEmpty(txtMobile) || txtMobile.Length > 15 || !ValidHelper.TelIsMobile(txtMobile))
            {
                stateInfo = "您输入的手机号码为空或不正确!";
                return(false);
            }
            string txtEmail = form["txtEmail"] as string;

            if (string.IsNullOrEmpty(txtEmail) || txtEmail.Length > 50 || !ValidHelper.IsEmail(txtEmail))
            {
                stateInfo = "您输入的电子邮件为空或不正确!";
                return(false);
            }
            string txtDesc = form["txtDesc"] as string;

            if ((txtDesc.Length > 0 && !ValidHelper.ChsIsMemos(txtDesc)) || txtDesc.Length > 300)
            {
                stateInfo = "您输入的描述不正确!(只能由汉字、字母、数字组成,且不大于300个字)";
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 权限扩展添加数据检测
        /// </summary>
        /// <param name="form">数据表单</param>
        /// <param name="stateInfo">状态消息</param>
        /// <returns>执行结果</returns>
        private bool AddedByCheck(FormCollection form, out string stateInfo)
        {
            stateInfo = GeneralHandler.StateSuccess;
            string txtCode = form["txtCode"] as string;

            if ((txtCode.Length > 0 && !ValidHelper.EngIsEngAndNum(txtCode)) || txtCode.Length > 100)
            {
                stateInfo = "您输入的编码不正确!(只能由字母和数字组成,且不大于100个字)";
                return(false);
            }
            string txtCodeName = form["txtCodeName"] as string;

            if (string.IsNullOrEmpty(txtCodeName) || txtCodeName.Length < 2 || txtCodeName.Length > 200)
            {
                stateInfo = "编码名称不能为空或小于2个或大于200个字符!";
                return(false);
            }
            if (!ValidHelper.ChsIsChineseOrEngOrNum(txtCodeName))
            {
                stateInfo = "您输入的编码名称不正确!(只能由汉字、字母、数字组成)";
                return(false);
            }
            string txtMark = form["txtMark"] as string;

            if ((txtMark.Length > 0 && !ValidHelper.EngIsEngAndNum(txtMark)) || txtMark.Length > 100)
            {
                stateInfo = "您输入的标识不正确!(只能由字母和数字组成,且不大于100个字)";
                return(false);
            }
            string txtMarkName = form["txtMarkName"] as string;

            if (string.IsNullOrEmpty(txtMarkName) || txtMarkName.Length < 2 || txtMarkName.Length > 200)
            {
                stateInfo = "标识名称不能为空或小于2个或大于200个字符!";
                return(false);
            }
            if (!ValidHelper.ChsIsChineseOrEngOrNum(txtMarkName))
            {
                stateInfo = "您输入的标识名称不正确!(只能由汉字、字母、数字组成)";
                return(false);
            }
            string txtMemo = form["txtMemo"] as string;

            if ((txtMemo.Length > 0 && !ValidHelper.ChsIsMemos(txtMemo)) || txtMemo.Length > 500)
            {
                stateInfo = "您输入的扩展备注不正确!(只能由汉字、字母、数字组成,且不大于500个字)";
                return(false);
            }
            return(true);
        }
Example #5
0
        /// <summary>
        /// 状态机制添加数据检测
        /// </summary>
        /// <param name="form">数据表单</param>
        /// <param name="stateInfo">状态消息</param>
        /// <returns>执行结果</returns>
        private bool AddedByCheck(FormCollection form, out string stateInfo)
        {
            stateInfo = GeneralHandler.StateSuccess;
            int Function = TypeHelper.TypeToInt32(form["ddlModule"], -1);

            if (Function == 0 || Function < -1)
            {
                stateInfo = "模块标识不正确!";
                return(false);
            }
            string txtName = form["txtName"] as string;

            if (string.IsNullOrEmpty(txtName) || txtName.Length < 2 || txtName.Length > 50)
            {
                stateInfo = "名称不能为空或小于2个或大于50个字符!";
                return(false);
            }
            if (!ValidHelper.ChsIsChineseOrEngOrNums(txtName))
            {
                stateInfo = "您输入的名称不正确!(只能由汉字、字母、数字组成)";
                return(false);
            }
            string txtCode = form["txtCode"] as string;

            if ((txtCode.Length > 0 && !ValidHelper.EngIsEngAndNums(txtCode)) || txtCode.Length > 50)
            {
                stateInfo = "您输入的编码不正确!(只能由字母和数字组成,且不大于50个字)";
                return(false);
            }
            string txtMark = form["txtMark"];

            if (!ValidHelper.NumIsInteger(txtMark))
            {
                stateInfo = "您输入的状态标识不正确!(只能由数字组成)";
                return(false);
            }
            string txtDesc = form["txtDesc"] as string;

            if ((txtDesc.Length > 0 && !ValidHelper.ChsIsMemos(txtDesc)) || txtDesc.Length > 300)
            {
                stateInfo = "您输入的描述不正确!(只能由汉字、字母、数字组成,且不大于300个字)";
                return(false);
            }
            return(true);
        }
Example #6
0
        /// <summary>
        /// 管理员信息添加数据检测
        /// </summary>
        /// <param name="form">数据表单</param>
        /// <param name="stateInfo">状态消息</param>
        /// <returns>执行结果</returns>
        private bool AddedByCheck(FormCollection form, out string stateInfo)
        {
            stateInfo = GeneralHandler.StateSuccess;
            int sltDepart = TypeHelper.TypeToInt32(form["sltDepart"], -1);

            if (sltDepart < 1)
            {
                stateInfo = "隶属部门不正确!";
                return(false);
            }
            int ddlGrade = TypeHelper.TypeToInt32(form["ddlGrade"], -1);

            if (ddlGrade < 1 || ddlGrade > 3)
            {
                stateInfo = "管理级别不正确!";
                return(false);
            }
            string txtSurname = form["txtSurname"] as string;

            if (string.IsNullOrEmpty(txtSurname) || txtSurname.Length < 2 || txtSurname.Length > 10)
            {
                stateInfo = "姓名不能为空或小于2个或大于10个汉字!";
                return(false);
            }
            if (!ValidHelper.ChsIsChinese(txtSurname))
            {
                stateInfo = "您输入的姓名不正确!(只能由汉字组成)";
                return(false);
            }
            string txtName = form["txtName"] as string;

            if (string.IsNullOrEmpty(txtName) || txtName.Length < 4 || txtName.Length > 16)
            {
                stateInfo = "账号名称不能为空或小于4个或大于16个字符!";
                return(false);
            }
            if (!ValidHelper.EngIsEngAndNums(txtName))
            {
                stateInfo = "您输入的账号名称不正确!(只能由字母、数字组成)";
                return(false);
            }
            string txtPwd = form["txtPwd"] as string;

            if (string.IsNullOrEmpty(txtPwd) || txtPwd.Length < 6 || txtPwd.Length > 16)
            {
                stateInfo = "账号密码不能为空或不小于6个或大于16个字符!";
                return(false);
            }
            if (!ValidHelper.EngIsPassword(txtPwd))
            {
                stateInfo = "您输入的密码不正确!(字母开头的任意字符)";
                return(false);
            }
            string txtPwds = form["txtPwds"] as string;

            if (txtPwd != txtPwds)
            {
                stateInfo = "你输入的密码与确认密码不一致!";
                return(false);
            }
            string txtMobile = form["txtMobile"] as string;

            if (string.IsNullOrEmpty(txtMobile) || txtMobile.Length > 15 || !ValidHelper.TelIsMobile(txtMobile))
            {
                stateInfo = "您输入的手机号码为空或不正确!";
                return(false);
            }
            string txtEmail = form["txtEmail"] as string;

            if (string.IsNullOrEmpty(txtEmail) || txtEmail.Length > 50 || !ValidHelper.IsEmail(txtEmail))
            {
                stateInfo = "您输入的电子邮件为空或不正确!";
                return(false);
            }
            string txtDesc = form["txtDesc"] as string;

            if ((txtDesc.Length > 0 && !ValidHelper.ChsIsMemos(txtDesc)) || txtDesc.Length > 300)
            {
                stateInfo = "您输入的描述不正确!(只能由汉字、字母、数字组成,且不大于300个字)";
                return(false);
            }
            return(true);
        }