Example #1
0
        /// <summary>
        /// 中文汉字
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChinese_Click(object sender, EventArgs e)
        {
            string strValue  = this.cboxChinese.SelectedItem as string;
            bool   checkFlag = false;

            switch (strValue)
            {
            case "中文汉字":
                checkFlag = ValidHelper.ChsIsChinese(this.txtChinese.Text);
                break;

            case "中字母数":
                checkFlag = ValidHelper.ChsIsChineseOrEngOrNum(this.txtChinese.Text);
                break;

            case "真实姓名":
                checkFlag = ValidHelper.ChsIsTname(this.txtChinese.Text);
                break;

            case "半角转换":
                this.lblResultChinese.Text = string.Format(" {0}", ValidHelper.ChsToDBC(this.txtChinese.Text));
                break;

            default:
                break;
            }
            this.lblResultChinese.Text = checkFlag.ToString();
        }
Example #2
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);
        }
Example #3
0
 /// <summary>
 /// 验证成员关系
 /// </summary>
 private void VerifyRelation()
 {
     this.txtRelation.Focus();
     this.IsVerify = false;
     this.txtDescRelation.Foreground = Codes.ToBrush.StrToBrush("#C80000");
     if (!ValidHelper.ChsIsChinese(this.txtRelation.Text))
     {
         this.txtDescRelation.Text = "成员关系输入不正确,只能由中文构成";
     }
     else if (this.txtRelation.Text.Length > 50)
     {
         this.txtDescRelation.Text = "成员关系输入长度超限,不能大于50个字符";
     }
     else
     {
         this.IsVerify = true;
         this.InitDescRelation();
     }
 }
Example #4
0
 /// <summary>
 /// 验证成员名称
 /// </summary>
 private void VerifyName()
 {
     this.txtName.Focus();
     this.IsVerify = false;
     this.txtDescName.Foreground = Codes.ToBrush.StrToBrush("#C80000");
     if (!ValidHelper.ChsIsChinese(this.txtName.Text))
     {
         this.txtDescName.Text = "成员名称输入不正确,只能由中文构成";
     }
     else if (this.txtName.Text.Length > 10)
     {
         this.txtDescName.Text = "成员名称输入长度超限,不能大于10个字符";
     }
     else
     {
         this.IsVerify = true;
         this.InitDescName();
     }
 }
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 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);
        }