コード例 #1
0
ファイル: frmUsersDetail.cs プロジェクト: tangaoxiang/ERM
        /// <summary>
        /// 保存数据
        /// </summary>
        private void  SaveData()
        {
            if (!ValidatorData())
            {
                return;
            }

            if (this.OpType == "Add")//添加
            {
                BLL.T_Users_BLL     userBLL  = new T_Users_BLL();
                IList <MDL.T_Users> userList = userBLL.FindBylogin(txtLogin.Text);
                if (userList.Count <= 0)
                {
                    MDL.T_Users userMDL = GetData();
                    userBLL.Add(userMDL);
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    TXMessageBoxExtensions.Info("用户名已经存在!");
                    this.txtLogin.Focus();
                    return;
                }
            }
            else//编辑
            {
                MDL.T_Users userMDL = GetData();
                userMDL.userid = userid;
                BLL.T_Users_BLL userBLL = new T_Users_BLL();
                userBLL.Update(userMDL);
                this.DialogResult = DialogResult.OK;
            }
        }
コード例 #2
0
ファイル: frmUsersDetail.cs プロジェクト: tangaoxiang/ERM
 /// <summary>
 /// 给控件赋值
 /// </summary>
 private void SetData()
 {
     BLL.T_Users_BLL userBLL = new T_Users_BLL();
     MDL.T_Users     users   = userBLL.Find(this.userid);
     this.txtLogin.Text     = users.login;
     this.txtpasswd.Text    = HandlePwd.Decrypt(users.password);
     this.txtpasswd2.Text   = HandlePwd.Decrypt(users.password);
     this.txtFullname.Text  = users.fullname;
     this.txtTitle.Text     = users.title;
     this.txtphone.Text     = users.phone;
     this.cmbUnits.Text     = users.units;
     this.cmbUnitsType.Text = users.unitstype;
 }
コード例 #3
0
 /// <summary>
 /// 保存数据
 /// </summary>
 private void SaveData()
 {
     if (!ValidatorData())
     {
         return;
     }
     else
     {
         string          confrmpw = HandlePwd.Encrypt(txtConfrmPasswd.Text.Trim());
         BLL.T_Users_BLL userBLL  = new ERM.BLL.T_Users_BLL();
         MDL.T_Users     UsersMDL = userBLL.Find(Globals.UserID);
         UsersMDL.password = confrmpw;
         userBLL.Update(UsersMDL);
         this.Close();
     }
 }
コード例 #4
0
 /// <summary>
 /// 验证数据必填项
 /// </summary>
 /// <returns></returns>
 private bool ValidatorData()
 {
     if (this.txtUserLogin.Text.Trim() == "")
     {
         TXMessageBoxExtensions.Info(SystemTips.MSG_USERID_NOTNULL, SystemTips.MSG_TITLE);//用户ID不能为空
         this.txtUserLogin.Focus();
         return(false);
     }
     if (this.txtOldPasswd.Text.Trim() == "")
     {
         TXMessageBoxExtensions.Info(SystemTips.MSG_USERPWD_NOTNULL, SystemTips.MSG_TITLE);//用户名不能为空
         this.txtOldPasswd.Focus();
         return(false);
     }
     if (this.txtNewPasswd.Text.Trim() == "")
     {
         TXMessageBoxExtensions.Info("新密码不能为空", SystemTips.MSG_TITLE);//用户全名不能为空
         this.txtNewPasswd.Focus();
         return(false);
     }
     if (this.txtNewPasswd.Text.Trim() != txtConfrmPasswd.Text.Trim())
     {
         TXMessageBoxExtensions.Info("确认密码与新密码不相符,请重新输入确认密码", SystemTips.MSG_TITLE);//请选择用户风格
         this.txtConfrmPasswd.Focus();
         return(false);
     }
     BLL.T_Users_BLL bll1 = new ERM.BLL.T_Users_BLL();
     MDL.T_Users     mdl1 = bll1.Find(Globals.UserID);
     if (HandlePwd.Decrypt(mdl1.password) != this.txtOldPasswd.Text.Trim())
     {
         TXMessageBoxExtensions.Info("原密码错误,不可以修改!", SystemTips.MSG_TITLE);//请选择用户风格
         this.txtConfrmPasswd.Focus();
         return(false);
     }
     return(true);
 }
コード例 #5
0
ファイル: frmLogin.cs プロジェクト: tangaoxiang/ERM
 /// <summary>
 /// 登录时触发的事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (MyCommon.IsCheckFD())
     {
         #region KEY 验证操作
         //USBKey usbkey = new USBKey();
         //if (!usbkey.CheckUSB())
         //{
         //    TXMessageBoxExtensions.Info("UKey校验失败,请插入加密锁后,再进行操作! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】", "信息提示",
         //        MessageBoxButtons.OK, MessageBoxIcon.Error);
         //    return;
         //}
         string DoResult = ERM.UI.WriteDog.DoReader();
         if (DoResult != "")
         {
             USBKey usbkey = new USBKey();
             if (!usbkey.CheckUSB())
             {
                 //if (!ERM.UI.FDKey.CheckUserKey())
                 //{
                 TXMessageBoxExtensions.Info("UKey校验失败,请插入加密锁后,再进行操作! \n  【温馨提示:如有疑问请与我们联系,0755-83995038】", "信息提示");
                 return;
                 //}
             }
         }
         #endregion
     }
     if (cboLogin.SelectedValue == null || txtPasswd.Text == null ||
         cboLogin.SelectedValue.ToString().Trim() == "" ||
         txtPasswd.Text.Trim() == "")//不能为空的处理
     {
         TXMessageBoxExtensions.Info("用户名或密码不能为空,请重新输入!");
         txtPasswd.Focus();
         return;
     }
     else//验证密码
     {
         int         userid = Convert.ToInt32(this.cboLogin.SelectedValue.ToString());
         string      pwd    = this.txtPasswd.Text.Trim();
         int         i111   = (new BLL.T_Users_BLL()).GetCount();
         MDL.T_Users users  = (new BLL.T_Users_BLL()).Find(userid);
         if (pwd == HandlePwd.Decrypt(users.password))//解密之后 进行密码较验
         {
             Globals.UserID       = userid;
             Globals.SH           = users.sh;
             Globals.Theme        = users.theme;
             Globals.Password     = users.password;//加密的密码 用户修改密码用到
             Globals.LoginUser    = users.login;
             Globals.Fullname     = users.fullname;
             Globals.CompanyTitle = users.units;
             this.DialogResult    = DialogResult.OK;
         }
         else
         {
             TXMessageBoxExtensions.Info("密码错误,请重新输入!");
             txtPasswd.Text = "";
             txtPasswd.Focus();
             return;
         }
     }
 }