Beispiel #1
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if (CheckInput() && BLLDB.YHB.CheckPassword(LoginForm.username, oldPassword.Text) &&
         CheckConfirmPassword())
     {
         YHB model = new YHB()
         {
             username = LoginForm.username,
             password = newPassowrd.Text
         };
         if (BLLDB.YHB.Update(model) == true)
         {
             MessageBox.Show("成功更改,请重新登录");
             Form      frm = Program.Context.MainForm;
             LoginForm log = new LoginForm();
             Program.Context.MainForm = log;
             log.Show();
             frm.Close();
         }
         else
         {
             MessageBox.Show("更改失败");
         }
     }
     else
     {
         MessageBox.Show("你的输入有误");
     }
 }
Beispiel #2
0
        private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvData.SelectedRows.Count == 1)
            {
                YHB model = (YHB)dgvData.SelectedRows[0].DataBoundItem;
                txtUser.Text = model.username;

                btnDelete.Enabled = true;
                btnCZ.Enabled     = true;
                btnAdd.Enabled    = false;
            }
        }
Beispiel #3
0
        public bool CheckPassword(string username, string password)
        {
            YHB model = this.GetModel(username);

            if (model.password == password)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        public bool CheckUser(string username, string password)
        {
            YHB model = this.GetModel(username);

            if (model == null || model.password != password)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #5
0
 private void btnCZ_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要重置账户密码吗?", "删除提示",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         YHB model = new YHB()
         {
             username = txtUser.Text,
             password = "******"
         };
         if (txtUser.Text == LoginForm.username)
         {
             if (BLLDB.YHB.Update(model) == true)
             {
                 MessageBox.Show("重置当前账户密码成功,密码为666,请重新登录");
                 Form      frm = Program.Context.MainForm;
                 LoginForm log = new LoginForm();
                 Program.Context.MainForm = log;
                 log.Show();
                 frm.Close();
             }
             else
             {
                 MessageBox.Show("重置密码失败");
             }
         }
         else
         {
             if (BLLDB.YHB.Update(model) == true)
             {
                 MessageBox.Show("重置密码成功,密码为666,");
             }
             else
             {
                 MessageBox.Show("重置密码失败");
             }
         }
     }
 }
Beispiel #6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (CheckModelExist() && !BLLDB.YHB.CheckYserExist(txtUser.Text))
            {
                string pd = Interaction.InputBox("请输入密码", "输入密码", "", -1, -1);

                YHB model = new YHB()
                {
                    username = txtUser.Text,
                    password = pd
                };
                if (BLLDB.YHB.Add(model) == true)
                {
                    MessageBox.Show("添加成功");
                    BindData();
                    ClearInput();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
        }