Пример #1
0
        /// <summary>
        /// 检测用户信息
        /// </summary>
        /// <returns></returns>
        public bool CheckUserInfo()
        {
            try
            {
                JudgmentMessage = string.Empty;
                if (this.dll_rightgroup.Properties.Items.Count < 1)
                {
                    ShowMessageBox.ShowInformation("请先设置权限组!");
                    return(false);
                }
                m_rightGroupID = ((UComboItem)this.dll_rightgroup.SelectedItem).ValueIndex;

                if (this.txt_LoginName.Text == string.Empty)
                {
                    ShowMessageBox.ShowInformation("管理员帐号不能为空!");//("登录名称不能为空!");
                    return(false);
                }
                else
                {
                    if (!IsSuperLenth(this.txt_LoginName.Text, 20))
                    {
                        ShowMessageBox.ShowInformation("管理员帐号超出有效长度20!");//("登录名称不超出有效长度20!");
                        return(false);
                    }
                    if (!InputTest.LoginTest(this.txt_LoginName.Text))
                    {
                        ShowMessageBox.ShowInformation("管理员帐号包含非法字符(只能包含数字、字母、以及下划线和-)!");//("登录名称包含非法字符(只能包含数字、字母、以及下划线和-)");
                        return(false);
                    }
                    this.m_userInfo.LoginName = this.txt_LoginName.Text.ToString();
                }
                if (EditType == 1)
                {
                    ManagementCenter.BLL.UM_UserInfoBLL UserInfoBLL = new UM_UserInfoBLL();
                    if (!UserInfoBLL.CheckLoginName(this.m_userInfo.LoginName))
                    {
                        MessageBox.Show("管理员帐号已经存在,请重新输入!");//("登录名称已经存在,请重新输入!");
                        return(false);
                    }
                }

                if (this.txt_Name.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Name.Text, 20))
                    {
                        MessageBox.Show("真实姓名超出有效范围长度20!");//("用户姓名超出有效范围长度20!");
                        return(false);
                    }
                    this.m_userInfo.UserName = this.txt_Name.Text.ToString();
                }
                else
                {
                    this.m_userInfo.UserName = null;
                }

                if (this.txt_CertificateNo.Text.ToString() != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_CertificateNo.Text.ToString(), 50))
                    {
                        ShowMessageBox.ShowInformation("证件号码超出有效范围长度50!");
                        return(false);
                    }
                    this.m_userInfo.CertificateNo    = this.txt_CertificateNo.Text.ToString();
                    this.m_userInfo.CertificateStyle = ((UComboItem)this.dll_CertificateStyle.SelectedItem).ValueIndex;
                }
                else
                {
                    this.m_userInfo.CertificateNo    = null;
                    this.m_userInfo.CertificateStyle = null;
                }

                if (this.txt_Postalcode.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Postalcode.Text, 50))
                    {
                        ShowMessageBox.ShowInformation("邮政编码超出有效范围长度50!");
                        return(false);
                    }
                    this.m_userInfo.Postalcode = this.txt_Postalcode.Text.ToString();
                }
                else
                {
                    this.m_userInfo.Postalcode = null;
                }
                if (this.txt_Email.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Email.Text, 50))
                    {
                        ShowMessageBox.ShowInformation("邮箱超出有效范围长度50!");
                        return(false);
                    }
                    if (!InputTest.emailTest(this.txt_Email.Text))
                    {
                        ShowMessageBox.ShowInformation("邮箱格式错误,请输入正确的邮箱!");
                        return(false);
                    }
                    this.m_userInfo.Email = this.txt_Email.Text;
                }
                else
                {
                    this.m_userInfo.Email = null;
                }

                if (this.txt_Telephone.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Telephone.Text, 20))
                    {
                        ShowMessageBox.ShowInformation("电话号码超出有效范围长度20!");
                        return(false);
                    }
                    this.m_userInfo.Telephone = this.txt_Telephone.Text.ToString();
                }
                else
                {
                    this.m_userInfo.Telephone = null;
                }
                if (this.txt_Address.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Address.Text, 50))
                    {
                        ShowMessageBox.ShowInformation("地址超出有效范围长度50!");
                        return(false);
                    }
                    this.m_userInfo.Address = this.txt_Address.Text.ToString();
                }
                else
                {
                    this.m_userInfo.Address = null;
                }

                if (this.txt_Answer.Text.ToString() != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Answer.Text, 200))
                    {
                        ShowMessageBox.ShowInformation("答案超出有效范围长度200!");
                        return(false);
                    }
                    this.m_userInfo.Answer     = this.txt_Answer.Text.ToString();
                    this.m_userInfo.QuestionID = ((UComboItem)this.dll_QuestionID.SelectedItem).ValueIndex;
                }
                else
                {
                    this.m_userInfo.Answer     = null;
                    this.m_userInfo.QuestionID = null;
                }

                this.m_userInfo.RoleID  = (int)ManagementCenter.Model.CommonClass.Types.RoleTypeEnum.Manager;
                this.m_userInfo.AddType = (int)ManagementCenter.Model.CommonClass.Types.AddTpyeEnum.BackManager;

                //登陆密码检测
                if (EditType == 1 || (EditType == 2 && this.che_UpdatePass.Checked == true))
                {
                    if (this.txt_Password.Text.ToString() == string.Empty || this.txt_PassAgain.Text.ToString() == string.Empty)
                    {
                        ShowMessageBox.ShowInformation("密码不能为空!");
                        return(false);
                    }
                    if (!IsSuperLenth(this.txt_Password.Text.ToString(), 12))
                    {
                        MessageBox.Show("密码超出有效范围长度12!");
                        return(false);
                    }
                    if (!InputTest.LoginTest(this.txt_Password.Text.ToString()))
                    {
                        MessageBox.Show("密码中包含非法字符!");
                        return(false);
                    }
                    if (this.txt_Password.Text.ToString() != this.txt_PassAgain.Text.ToString())
                    {
                        MessageBox.Show("两次输入的密码不一致!");
                        return(false);
                    }
                    this.m_userInfo.Password = this.txt_Password.Text.ToString();
                    if ((EditType == 2 && this.che_UpdatePass.Checked == true))
                    {
                        this.m_userInfo.Password =
                            ManagementCenter.Model.CommonClass.UtilityClass.DesEncrypt(
                                this.txt_Password.Text.ToString(), string.Empty);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                ShowMessageBox.ShowInformation("用户输入检测失败!");
                string      errCode   = "GL-1024";
                string      errMsg    = "用户输入检测失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 检测用户信息
        /// </summary>
        /// <returns></returns>
        public bool CheckUserInfo()
        {
            try
            {
                JudgmentMessage = string.Empty;
                if (this.dll_CouterID.Properties.Items.Count < 1)
                {
                    ShowMessageBox.ShowInformation("请先添加柜台信息!");
                    return(false);
                }
                if (this.txt_Name.Text == string.Empty)
                {
                    ShowMessageBox.ShowInformation("请输入交易员(对应真实姓名项)名称!");//("请输入交易员名称!");
                    return(false);
                }
                else
                {
                    if (!IsSuperLenth(this.txt_Name.Text, 20))
                    {
                        ShowMessageBox.ShowInformation("姓名超出有效范围长度20!");
                        return(false);
                    }
                    this.m_currentUser.UserName = this.txt_Name.Text.ToString();
                }
                if (this.txt_CertificateNo.Text.ToString() != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_CertificateNo.Text.ToString(), 50))
                    {
                        ShowMessageBox.ShowInformation("证件号码超出有效范围长度50!");
                        return(false);
                    }
                    if (((UComboItem)this.dll_CertificateStyle.SelectedItem).ValueIndex == (int)ManagementCenter.Model.CommonClass.Types.CertificateStyleEnum.StatusCard)
                    {
                        if (!InputTest.IsStatusCard(this.txt_CertificateNo.Text))
                        {
                            ShowMessageBox.ShowInformation("证件号码是15位或18位的合法格式!");
                            return(false);
                        }
                    }
                    this.m_currentUser.CertificateNo    = this.txt_CertificateNo.Text.ToString();
                    this.m_currentUser.CertificateStyle = ((UComboItem)this.dll_CertificateStyle.SelectedItem).ValueIndex;
                }
                else
                {
                    this.m_currentUser.CertificateNo    = null;
                    this.m_currentUser.CertificateStyle = null;
                }
                if (this.txt_Postalcode.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Postalcode.Text, 50))
                    {
                        ShowMessageBox.ShowInformation("邮政编码超出有效范围长度50!");
                        return(false);
                    }
                    if (!InputTest.IsPostCode(this.txt_Postalcode.Text))
                    {
                        ShowMessageBox.ShowInformation("邮编是6个整数!");
                        return(false);
                    }
                    this.m_currentUser.Postalcode = this.txt_Postalcode.Text.ToString();
                }
                else
                {
                    this.m_currentUser.Postalcode = null;
                }

                if (this.txt_Email.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Email.Text, 50))
                    {
                        ShowMessageBox.ShowInformation("邮箱超出有效范围长度50!");
                        return(false);
                    }
                    if (!InputTest.emailTest(this.txt_Email.Text))
                    {
                        ShowMessageBox.ShowInformation("邮箱格式错误,请输入正确的邮箱!");
                        return(false);
                    }
                    this.m_currentUser.Email = this.txt_Email.Text;
                }
                else
                {
                    this.m_currentUser.Email = null;
                }

                if (this.txt_Telephone.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Telephone.Text, 20))
                    {
                        ShowMessageBox.ShowInformation("电话号码超出有效范围长度20!");
                        return(false);
                    }
                    if (!InputTest.IsMobileOrTelephone(this.txt_Telephone.Text))
                    {
                        ShowMessageBox.ShowInformation("电话号码格式不正确!");
                        return(false);
                    }
                    this.m_currentUser.Telephone = this.txt_Telephone.Text.ToString();
                }
                else
                {
                    this.m_currentUser.Telephone = null;
                }

                if (this.txt_Address.Text != string.Empty)
                {
                    if (!IsSuperLenth(this.txt_Address.Text, 50))
                    {
                        ShowMessageBox.ShowInformation("地址超出有效范围长度50!");
                        return(false);
                    }
                    this.m_currentUser.Address = this.txt_Address.Text.ToString();
                }
                else
                {
                    this.m_currentUser.Address = null;
                }

                this.m_currentUser.CouterID = ((UComboItem)this.dll_CouterID.SelectedItem).ValueIndex;
                this.m_currentUser.RoleID   = (int)ManagementCenter.Model.CommonClass.Types.RoleTypeEnum.Transaction;
                this.m_currentUser.AddType  = (int)ManagementCenter.Model.CommonClass.Types.AddTpyeEnum.BackTaransaction;

                if (EditType == 1)
                {
                    try
                    {
                        string _Money = string.Empty;//输入的金额
                        if (this.txt_RMB.Text != string.Empty)
                        {
                            _Money = this.txt_RMB.Text;
                            string[] _lengthRMB = _Money.Split('.');
                            if (_lengthRMB[0].Length > 12)
                            {
                                ShowMessageBox.ShowInformation("超出存储的范围(整数部分不能大于12位)!");
                                return(false);
                            }
                            if (_lengthRMB.Length > 1)
                            {
                                if (_lengthRMB[1].Length > 3)
                                {
                                    ShowMessageBox.ShowInformation("小数部分不能大于3位!");
                                    return(false);
                                }
                            }
                            if (this.txt_RMB.Text.Length > 16)
                            {
                                ShowMessageBox.ShowInformation("超出存储的范围(不能大于16位)!");
                                return(false);
                            }
                            m_InitFund.RMB = decimal.Parse(this.txt_RMB.Text);
                        }
                        if (this.txt_US.Text != string.Empty)
                        {
                            _Money = this.txt_US.Text;
                            string[] _lengthRMB = _Money.Split('.');
                            if (_lengthRMB[0].Length > 12)
                            {
                                ShowMessageBox.ShowInformation("超出存储的范围(整数部分不能大于12位)!");
                                return(false);
                            }
                            if (_lengthRMB.Length > 1)
                            {
                                if (_lengthRMB[1].Length > 3)
                                {
                                    ShowMessageBox.ShowInformation("小数部分不能大于3位!");
                                    return(false);
                                }
                            }
                            if (this.txt_US.Text.Length > 16)
                            {
                                ShowMessageBox.ShowInformation("超出存储的范围(不能大于16位)!");
                                return(false);
                            }
                            m_InitFund.US = decimal.Parse(this.txt_US.Text);
                        }
                        if (this.txt_HK.Text != string.Empty)
                        {
                            _Money = this.txt_HK.Text;
                            string[] _lengthRMB = _Money.Split('.');
                            if (_lengthRMB[0].Length > 12)
                            {
                                ShowMessageBox.ShowInformation("超出存储的范围(整数部分不能大于12位)!");
                                return(false);
                            }
                            if (_lengthRMB.Length > 1)
                            {
                                if (_lengthRMB[1].Length > 3)
                                {
                                    ShowMessageBox.ShowInformation("小数部分不能大于3位!");
                                    return(false);
                                }
                            }
                            if (this.txt_HK.Text.Length > 16)
                            {
                                ShowMessageBox.ShowInformation("超出存储的范围(不能大于16位)!");
                                return(false);
                            }
                            m_InitFund.HK = decimal.Parse(this.txt_HK.Text);
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowMessageBox.ShowInformation("请输入正确的金额!");
                        LogHelper.WriteError(ex.Message, ex);
                        return(false);
                    }
                }
                //登陆密码检测
                if (EditType == 1 || (EditType == 2 && this.che_UpdatePass.Checked == true))
                {
                    if (this.txt_Password.Text.ToString() == string.Empty || this.txt_PassAgain.Text.ToString() == string.Empty)
                    {
                        ShowMessageBox.ShowInformation("密码不能为空!");
                        return(false);
                    }
                    if (!IsSuperLenth(this.txt_Password.Text.ToString(), 12))
                    {
                        MessageBox.Show("密码超出有效范围长度12!");
                        return(false);
                    }
                    if (!InputTest.LoginTest(this.txt_Password.Text.ToString()))
                    {
                        MessageBox.Show("密码中包含非法字符!");
                        return(false);
                    }
                    if (this.txt_Password.Text.ToString() != this.txt_PassAgain.Text.ToString())
                    {
                        MessageBox.Show("两次输入的密码不一致!");
                        return(false);
                    }
                    this.m_currentUser.Password = this.txt_Password.Text.ToString();
                    if ((EditType == 2 && this.che_UpdatePass.Checked == true))
                    {
                        this.m_currentUser.Password =
                            ManagementCenter.Model.CommonClass.UtilityClass.DesEncrypt(
                                this.txt_Password.Text.ToString(), string.Empty);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                ShowMessageBox.ShowInformation("用户输入检测失败!");
                string      errCode = "GL-0303";
                string      errMsg  = "用户输入检测失败!";
                VTException vte     = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(vte.ToString(), vte.InnerException);
                return(false);
            }
        }