示例#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();
        }
示例#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;
            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);
        }
示例#3
0
 /// <summary>
 /// 验证项目名称
 /// </summary>
 private void VerifyName()
 {
     this.txtName.Focus();
     this.IsVerify = false;
     this.txtDescName.Foreground = Codes.ToBrush.StrToBrush("#C80000");
     if (!ValidHelper.ChsIsChineseOrEngOrNum(this.txtName.Text))
     {
         this.txtDescName.Text = "项目名称输入不正确,只能由中文、字母、数字构成";
     }
     else if (this.txtName.Text.Length > 300)
     {
         this.txtDescName.Text = "项目名称输入长度超限,不能大于300个字符";
     }
     else
     {
         this.IsVerify = true;
         this.InitDescName();
     }
 }
示例#4
0
 /// <summary>
 /// 验证项目描述
 /// </summary>
 private void VerifyDescription()
 {
     if (!string.IsNullOrEmpty(this.txtDescription.Text))
     {
         this.txtDescription.Focus();
         this.IsVerify = false;
         this.txtDescDescription.Foreground = Codes.ToBrush.StrToBrush("#C80000");
         if (!ValidHelper.ChsIsChineseOrEngOrNum(this.txtDescription.Text))
         {
             this.txtDescDescription.Text = "项目描述输入不正确,只能由中文、字母、数字构成";
         }
         else if (this.txtDescription.Text.Length > 2000)
         {
             this.txtDescDescription.Text = "项目描述输入长度超限,不能大于2000个字符";
         }
         else
         {
             this.IsVerify = true;
             this.InitDescDescription();
         }
     }
 }
示例#5
0
        /// <summary>
        /// 权限扩展获取同步数据
        /// <para>数据检测</para>
        /// </summary>
        /// <param name="form">数据表单</param>
        /// <param name="stateInfo">状态消息</param>
        /// <returns>执行结果</returns>
        private bool GetSyncDataByCheck(FormCollection form, out string stateInfo)
        {
            stateInfo = GeneralHandler.StateSuccess;
            //扩展设定:扩展编码
            string txtSetCode = form["txtSetCode"] as string;

            if ((txtSetCode.Length > 0 && !ValidHelper.EngIsEngAndNum(txtSetCode)) || txtSetCode.Length > 100)
            {
                stateInfo = "您输入的[扩展设定:扩展编码]不正确!(只能由字母和数字组成,且不大于100个字)";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtSetCode))
            {
                stateInfo = "您输入的[扩展设定:扩展编码]存在安全问题,请检查后重试!";
                return(false);
            }
            //扩展设定:编码名称
            string txtSetName = form["txtSetName"] as string;

            if (string.IsNullOrEmpty(txtSetName) || txtSetName.Length < 2 || txtSetName.Length > 200)
            {
                stateInfo = "[扩展设定:编码名称]不能为空或小于2个或大于200个字符!";
                return(false);
            }
            if (!ValidHelper.ChsIsChineseOrEngOrNum(txtSetName))
            {
                stateInfo = "您输入的[扩展设定:编码名称]不正确!(只能由汉字、字母、数字组成)";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtSetName))
            {
                stateInfo = "您输入的[扩展设定:编码名称]存在安全问题,请检查后重试!";
                return(false);
            }
            //字段名称:数据表名
            string txtFieldTable = form["txtFieldTable"] as string;

            if (string.IsNullOrWhiteSpace(txtFieldTable))
            {
                stateInfo = "[字段名称:数据表名]不能为空!";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtFieldTable))
            {
                stateInfo = "您输入的[字段名称:数据表名]存在安全问题,请检查后重试!";
                return(false);
            }
            //字段名称:扩展标识
            string txtFieldMark = form["txtFieldMark"] as string;

            if (string.IsNullOrWhiteSpace(txtFieldMark))
            {
                stateInfo = "[字段名称:扩展标识]不能为空!";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtFieldMark))
            {
                stateInfo = "您输入的[字段名称:扩展标识]存在安全问题,请检查后重试!";
                return(false);
            }
            //字段名称:标识名称
            string txtFieldName = form["txtFieldName"] as string;

            if (string.IsNullOrWhiteSpace(txtFieldName))
            {
                stateInfo = "[字段名称:标识名称]不能为空!";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtFieldName))
            {
                stateInfo = "您输入的[字段名称:标识名称]存在安全问题,请检查后重试!";
                return(false);
            }
            //字段名称:扩展备注
            string txtFieldMemo = form["txtFieldMemo"] as string;

            if (string.IsNullOrWhiteSpace(txtFieldMemo))
            {
                stateInfo = "[字段名称:扩展备注]不能为空!";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtFieldMemo))
            {
                stateInfo = "您输入的[字段名称:扩展备注]存在安全问题,请检查后重试!";
                return(false);
            }
            //字段名称:查询条件
            string txtFieldWhere = form["txtFieldWhere"] as string;

            if (string.IsNullOrWhiteSpace(txtFieldWhere))
            {
                stateInfo = "[字段名称:查询条件]不能为空!";
                return(false);
            }
            if (ValidHelper.IsSqlInjectionOfString(txtFieldWhere) || ValidHelper.IsSqlInjectionOfType(txtFieldWhere))
            {
                stateInfo = "您输入的[字段名称:查询条件]存在安全问题,请检查后重试!";
                return(false);
            }
            //连接属性:数据源
            string txtConnSource = form["txtConnSource"] as string;

            if (string.IsNullOrWhiteSpace(txtConnSource))
            {
                stateInfo = "[连接属性:数据源]不能为空!";
                return(false);
            }
            if (txtConnSource != "(local)" && ValidHelper.IsSqlFilter(txtConnSource))
            {
                stateInfo = "您输入的[连接属性:数据源]存在安全问题,请检查后重试!";
                return(false);
            }
            //连接属性:数据库名
            string txtConnData = form["txtConnData"] as string;

            if (string.IsNullOrWhiteSpace(txtConnData))
            {
                stateInfo = "[连接属性:数据库名]不能为空!";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtConnData))
            {
                stateInfo = "您输入的[连接属性:数据库名]存在安全问题,请检查后重试!";
                return(false);
            }
            //连接属性:用户名称
            string txtConnUser = form["txtConnUser"] as string;

            if (string.IsNullOrWhiteSpace(txtConnUser))
            {
                stateInfo = "[连接属性:用户名称]不能为空!";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtConnUser))
            {
                stateInfo = "您输入的[连接属性:用户名称]存在安全问题,请检查后重试!";
                return(false);
            }
            //连接属性:用户密码
            string txtConnPwd = form["txtConnPwd"] as string;

            if (string.IsNullOrWhiteSpace(txtConnPwd))
            {
                stateInfo = "[连接属性:用户密码]不能为空!";
                return(false);
            }
            if (ValidHelper.IsSqlFilter(txtConnPwd))
            {
                stateInfo = "您输入的[连接属性:用户密码]存在安全问题,请检查后重试!";
                return(false);
            }
            return(true);
        }