Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //先校验密码是否为空
                if (txtOldPassword.Text.TrimEnd() == "")
                {
                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("【旧密码】不能为空!");
                    return;
                }

                //校验密码是否为空
                if (this.txtNewPassword.Text.TrimEnd() == "")
                {
                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("【新密码】不能为空!");
                    return;
                }

                if (this.txtConfirmPassword.Text.TrimEnd() != this.txtNewPassword.Text.TrimEnd())
                {
                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("【新密码】与【确认密码】不一致,请确认两次输入的密码一样!");
                    return;
                }

                string strNewPassword = this.txtConfirmPassword.Text.TrimEnd();

                //校验旧密码是否正确
                bool bolVerifyPass = LoginInfo.VerifyPassword(LoginInfo.UserID, txtOldPassword.Text.TrimEnd());
                if (bolVerifyPass)//校验成功
                {
                    //修改密码
                    DataTable dtSP = new DataTable();
                    dtSP.Columns.Add("UserID", typeof(int));
                    dtSP.Columns.Add("UserPassword", typeof(string));
                    DataRow drNew = dtSP.NewRow();
                    drNew["UserID"]       = LoginInfo.UserID;
                    drNew["UserPassword"] = LoginInfo.EncryptPassword(strNewPassword);
                    dtSP.Rows.Add(drNew);
                    dtSP.AcceptChanges();

                    DataSet   dsReturn;
                    DataTable dtOut;
                    LB.WinFunction.ExecuteSQL.CallSP(10003, dtSP, out dsReturn, out dtOut);

                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("密码修改成功!");
                    this.Close();
                }
                else
                {
                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("旧密码不正确!");
                }
            }
            catch (Exception ex)
            {
                LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Exemplo n.º 2
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     try
     {
         this.Close();
     }
     catch (Exception ex)
     {
         LBCommonHelper.DealWithErrorMessage(ex);
     }
 }
Exemplo n.º 3
0
 private void txtPassword_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Enter)
         {
             this.btnLoginIn.PerformClick();
         }
     }
     catch (Exception ex)
     {
         LBCommonHelper.DealWithErrorMessage(ex);
     }
 }
Exemplo n.º 4
0
        private void btnLoginIn_Click(object sender, EventArgs e)
        {
            try
            {
                VerisyIsEmpty();

                string strLoginName = this.txtLoginName.Text.TrimEnd();
                string strPassword  = this.txtPassword.Text.TrimEnd();

                bool bolPass = LoginInfo.VerifyLogin(strLoginName, strPassword);
                if (bolPass)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Exemplo n.º 5
0
        private void btnLoginIn_Click(object sender, EventArgs e)
        {
            try
            {
                //校验权限
                LBRegisterPermission.VerifyPermission();
                //bool IsRegister;
                //DateTime DeadLine;
                //int ProductType;
                //string RegisterInfoJson;
                //ExecuteSQL.ReadRegister(out IsRegister, out ProductType, out RegisterInfoJson, out DeadLine);
                if (LBRegisterPermission.ProductType != 0 || !LBRegisterPermission.IsRegister)
                {
                    throw new Exception("该系统未注册,请与供应商联系!");
                }
                else if (LBRegisterPermission.DeadLine.Subtract(DateTime.Now).TotalHours <= 0)
                {
                    throw new Exception("该系统注册已过期,请与供应商联系!");
                }

                VerisyIsEmpty();

                string strLoginName = this.txtLoginName.Text.TrimEnd();
                string strPassword  = this.txtPassword.Text.TrimEnd();
                bool   bolPass      = LoginInfo.VerifyLogin(strLoginName, strPassword);

                if (bolPass)
                {
                    IsLogin = true;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Exemplo n.º 6
0
        private void btnLoginIn_Click(object sender, EventArgs e)
        {
            try
            {
                //校验权限
                bool     IsRegister;
                DateTime DeadLine;
                string   RegisterInfoJson;
                ExecuteSQL.ReadRegister(out IsRegister, out ProductType, out RegisterInfoJson, out DeadLine);
                if ((ProductType != 1 && ProductType != 2) || !IsRegister)
                {
                    throw new Exception("该系统未注册,请与供应商联系!");
                }
                else if (DeadLine.Subtract(DateTime.Now).TotalHours <= 0)
                {
                    throw new Exception("该系统注册已过期,请与供应商联系!");
                }

                VerisyIsEmpty();

                string strLoginName = this.txtLoginName.Text.TrimEnd();
                string strPassword  = this.txtPassword.Text.TrimEnd();
                //Thread.Sleep(2000);
                //throw new Exception("无法连接服务器,请检查网络是否畅通!");
                bool bolPass = LoginInfo.VerifyLogin(strLoginName, strPassword);

                if (bolPass)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Exemplo n.º 7
0
        private void btnLoginIn_Click(object sender, EventArgs e)
        {
            try
            {
                //校验注册码
                LBEncrypt.Decrypt();

                if (LBEncrypt.ProductType != 3 || !LBEncrypt.IsRegister)
                {
                    if (LBCommonHelper.ConfirmMessage("当前电脑客户端未注册,是否现在注册?", "注册提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        frmDisk frm = new frmDisk();
                        frm.ShowDialog();
                        Application.Exit();
                    }
                    else
                    {
                        return;
                    }
                }
                if (LBEncrypt.ProductType == 3 && LBEncrypt.IsRegister && LBEncrypt.DeadLine.Subtract(DateTime.Now).TotalDays < 0)
                {
                    if (LBCommonHelper.ConfirmMessage("当前电脑客户端注册码已过期,是否现在注册?", "注册提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        frmDisk frm = new frmDisk();
                        frm.ShowDialog();
                        Application.Exit();
                    }
                    else
                    {
                        return;
                    }
                }
                //校验权限
                LBRegisterPermission.VerifyPermission();
                //bool IsRegister;
                //DateTime DeadLine;
                //int ProductType;
                //string RegisterInfoJson;
                //ExecuteSQL.ReadRegister(out IsRegister,out ProductType, out RegisterInfoJson, out DeadLine);
                if (LBRegisterPermission.ProductType != 0 || !LBRegisterPermission.IsRegister)
                {
                    throw new Exception("该系统未注册,请与供应商联系!");
                }
                else if (LBRegisterPermission.DeadLine.Subtract(DateTime.Now).TotalHours <= 0)
                {
                    throw new Exception("该系统注册已过期,请与供应商联系!");
                }

                VerisyIsEmpty();

                string strLoginName = this.txtLoginName.Text.TrimEnd();
                string strPassword  = this.txtPassword.Text.TrimEnd();
                //Thread.Sleep(2000);
                //throw new Exception("无法连接服务器,请检查网络是否畅通!");
                bool bolPass = LoginInfo.VerifyLogin(strLoginName, strPassword);

                if (bolPass)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                LBCommonHelper.DealWithErrorMessage(ex);
            }
        }