Exemplo n.º 1
0
 private void btn_ok_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.txt_LoginName.Text == string.Empty)
         {
             ShowMessageBox.ShowInformation("请输入登录名称!");
             return;
         }
         if (this.txt_Answer.Text == string.Empty)
         {
             ShowMessageBox.ShowInformation("请输入提示问题的答案!");
             return;
         }
         int            QuestionID  = ((UComboItem)this.dll_QuestionID.SelectedItem).ValueIndex;
         UM_UserInfoBLL UserInfoBLL = new UM_UserInfoBLL();
         UM_UserInfo    UserInfo    = UserInfoBLL.SeekForPassword(this.txt_LoginName.Text, this.txt_Answer.Text, QuestionID);
         if (UserInfo == null)
         {
             ShowMessageBox.ShowInformation("验证失败,请重新输入!");
             return;
         }
         ShowMessageBox.ShowInformation(string.Format("你的登录密码为:{0}", UtilityClass.DesDecrypt(UserInfo.Password.ToString(), string.Empty)));
     }
     catch (Exception)
     {
         return;
     }
 }
 /// <summary>
 /// 确定按钮事件 btn_OK_Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_OK_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.txt_LoginName.Text == string.Empty)
         {
             ShowMessageBox.ShowInformation("登陆名称不能为空!");
             return;
         }
         if (this.txt_PassWord.Text == string.Empty)
         {
             ShowMessageBox.ShowInformation("密码不能为空!");
             return;
         }
         UM_UserInfoBLL UserInfoBLL = new UM_UserInfoBLL();
         UM_UserInfo    UserInfo    = UserInfoBLL.ManagerLoginConfirm(this.txt_LoginName.Text, UtilityClass.DesEncrypt(this.txt_PassWord.Text, string.Empty),
                                                                      (int)Types.AddTpyeEnum.BackManager);
         if (UserInfo != null)
         {
             ParameterSetting.Mananger = UserInfo;
             DialogResult = DialogResult.OK;
             this.Close();
         }
         else
         {
             ShowMessageBox.ShowInformation("用户名或密码错误,请重新输入!");
         }
     }
     catch (Exception ex)
     {
         ShowMessageBox.ShowInformation(ex.Message.ToString());
         return;
     }
     this.txt_LoginName.Focus();
 }
Exemplo n.º 3
0
        /// <summary>
        /// 确定按纽
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_ok_Click(object sender, EventArgs e)
        {
            try
            {
                ManagementCenter.BLL.UM_UserInfoBLL UserInfoBLL = new UM_UserInfoBLL();

                if (this.m_EditType == 1)
                {
                    if (CheckUserInfo())
                    {
                        if (UserInfoBLL.ManagerAdd(m_userInfo, m_rightGroupID))
                        {
                            ShowMessageBox.ShowInformation("添加成功!");
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("添加失败!");
                        }
                    }
                }
                else
                {
                    if (this.m_userInfo.AddType == (int)ManagementCenter.Model.CommonClass.Types.AddTpyeEnum.FrontManager)
                    {
                        ShowMessageBox.ShowInformation("此用户为前台管理员,不允许修改!");
                        return;
                    }
                    if (CheckUserInfo())
                    {
                        if (UserInfoBLL.ManagerUpdate(m_userInfo, m_rightGroupID))
                        {
                            if (ispersonedit)
                            {
                                CommonClass.ParameterSetting.Mananger = UserInfo;
                            }
                            ShowMessageBox.ShowInformation("修改成功!");
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("修改失败!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-1023";
                string      errMsg    = "确定事件异常!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
            }
        }
        private void Btn_Del_Click(object sender, EventArgs e)
        {
            try
            {
                if (ShowMessageBox.ShowQuestion("确认删除吗?") == DialogResult.No)
                {
                    return;
                }
                if (this.ViewCounter != null && this.ViewCounter.FocusedRowHandle >= 0)
                {
                    m_cutRow = this.ViewCounter.FocusedRowHandle;
                    DataRow dw       = ViewCounter.GetDataRow(m_cutRow);
                    int     CouterID = int.Parse(dw["CouterID"].ToString());

                    {
                        //检测该柜台下是否存在用户
                        UM_UserInfoBLL     UserInfoBLL = new UM_UserInfoBLL();
                        List <UM_UserInfo> l           = UserInfoBLL.GetListArray(string.Format("CouterID={0}", CouterID));
                        if (l != null && l.Count > 0)
                        {
                            ShowMessageBox.ShowInformation("该柜台下存在交易员,不允许删除此柜台!");
                            return;
                        }
                    }
                    CounterBLL.Delete(CouterID);
                    ShowMessageBox.ShowInformation("删除成功!");
                    InitCounterList();
                }
                else
                {
                    ShowMessageBox.ShowInformation("请选中记录行!");
                }
            }
            catch (Exception ex)
            {
                ShowMessageBox.ShowInformation("删除失败!");
                string      errCode   = "GL-3004";
                string      errMsg    = "删除失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
            }
        }
        /// <summary>
        /// 加载用户列表
        /// </summary>
        private void LoadUser()
        {
            try
            {
                ManagementCenter.BLL.UM_UserInfoBLL UserInfoBLL = new UM_UserInfoBLL();
                DataSet ds = UserInfoBLL.GetPagingUser(QueryUserInfo, this.m_pageNo, this.m_pageSize,
                                                       out this.m_rowCount);
                DataTable allUser;
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    allUser = new DataTable();
                    if (!isFirstInit)
                    {
                        ShowMessageBox.ShowInformation("不存在记录!");
                    }
                }
                else
                {
                    allUser = ds.Tables[0];
                }
                this.gridUserInfo.DataSource = allUser;

                if (ViewUserInfo.RowCount > 0)
                {
                    int userid = int.Parse(ViewUserInfo.GetDataRow(0)["UserID"].ToString());
                    InitAccountListByUserID(userid, 0);
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-0353";
                string      errMsg    = "读取交易员列表失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), ex);
            }
            isFirstInit = false;
        }
Exemplo n.º 6
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);
            }
        }