Exemple #1
0
        /// <summary>
        /// 检测数据
        /// </summary>
        /// <returns></returns>
        private bool CheckData()
        {
            if (string.IsNullOrEmpty(txtUserName.Text.Trim()))
            {
                hidInfo.Value = "请输入姓名!";
                return(false);
            }


            if (!string.IsNullOrEmpty(txtEmail.Text.Trim()))
            {
                if (!NDHelperDataCheck.IsEmail(txtEmail.Text.Trim()))
                {
                    hidInfo.Value = "电子邮件格式错误!";
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(txtMobilePhone.Text.Trim()))
            {
                if (!CommonHelp.PhoneNumberCheck(txtMobilePhone.Text.Trim()))
                {
                    hidInfo.Value = "手机号码格式错误!";
                    return(false);
                }
            }


            if (!string.IsNullOrEmpty(txtMobilePhone.Text.Trim()))
            {
                if (!UserQuery.CheckMobilePhone(txtMobilePhone.Text.Trim(), SessionState.UserID, (int)CommonEnum.OperationEnum.UPDATE))
                {
                    hidInfo.Value = "该手机号码已经使用,请重新输入手机号码!";
                    return(false);
                }
            }
            return(true);
        }
        /// <summary>
        /// 检测数据
        /// </summary>
        /// <returns></returns>
        private bool CheckData()
        {
            if (string.IsNullOrEmpty(txtUserName.Text.Trim()))
            {
                hidInfo.Value = "请输入姓名!";
                return(false);
            }

            if (drpOUList.SelectedIndex == 0)
            {
                hidInfo.Value = "请选择部门!";
                return(false);
            }
            if (string.IsNullOrEmpty(txtAccount.Text.Trim()))
            {
                hidInfo.Value = "请输入用户帐号!";
                return(false);
            }

            if (!UserQuery.CheckAccount(txtAccount.Text.Trim(), this.UserID, this.CurOperation))
            {
                hidInfo.Value = "该帐号已经使用,请重新输入帐号!";
                return(false);
            }

            if (this.CurOperation == (int)OperationEnum.UPDATE)
            {
                if (!string.IsNullOrEmpty(txtPassword1.Text.Trim()) || !string.IsNullOrEmpty(txtPassword2.Text.Trim()))
                {
                    if (!string.IsNullOrEmpty(txtPassword1.Text.Trim()))
                    {
                        string[] str = txtPassword1.Text.Split(' ');
                        if (str.Length > 1)
                        {
                            hidInfo.Value = "密码中不能带空格!";
                            return(false);
                        }
                    }

                    if (!string.IsNullOrEmpty(txtPassword2.Text.Trim()))
                    {
                        string[] str = txtPassword2.Text.Split(' ');
                        if (str.Length > 1)
                        {
                            hidInfo.Value = "重复密码中不能带空格!";
                            return(false);
                        }
                    }

                    if (txtPassword1.Text.Trim() != txtPassword2.Text.Trim())
                    {
                        hidInfo.Value = "密码输入不一致,请重新输入!";
                        return(false);
                    }
                }
            }
            else
            {
                if (string.IsNullOrEmpty(txtPassword1.Text.Trim()))
                {
                    hidInfo.Value = "请输入密码!";
                    return(false);
                }
                else
                {
                    string[] str = txtPassword1.Text.Split(' ');
                    if (str.Length > 1)
                    {
                        hidInfo.Value = "密码中不能带空格!";
                        return(false);
                    }
                }

                if (string.IsNullOrEmpty(txtPassword2.Text.Trim()))
                {
                    hidInfo.Value = "请输入重复确认密码!";
                    return(false);
                }
                else
                {
                    string[] str = txtPassword2.Text.Split(' ');
                    if (str.Length > 1)
                    {
                        hidInfo.Value = "重复密码中不能带空格!";
                        return(false);
                    }
                }

                if (txtPassword1.Text.Trim() != txtPassword2.Text.Trim())
                {
                    hidInfo.Value = "密码输入不一致,请重新输入!";
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(txtEmail.Text.Trim()))
            {
                if (!NDHelperDataCheck.IsEmail(txtEmail.Text.Trim()))
                {
                    hidInfo.Value = "电子邮件格式错误!";
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(txtMobilePhone.Text.Trim()))
            {
                if (!CommonHelp.PhoneNumberCheck(txtMobilePhone.Text.Trim()))
                {
                    hidInfo.Value = "手机号码格式错误!";
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(txtMobilePhone.Text.Trim()))
            {
                if (!UserQuery.CheckMobilePhone(txtMobilePhone.Text.Trim(), SessionState.UserID, (int)CommonEnum.OperationEnum.UPDATE))
                {
                    hidInfo.Value = "该手机号码已经使用,请重新输入手机号码!";
                    return(false);
                }
            }
            return(true);
        }