Exemplo n.º 1
0
 private void frmQuanLiNguoiDung_Load(object sender, EventArgs e)
 {
     dgvLogin.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
     dgvLogin.AllowUserToAddRows  = false;
     dgvLogin.ReadOnly            = true;
     dgvLogin.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     dgvLogin.DataSource          = ac.GetAccount();
     groupBox1.Enabled            = false;
 }
 private void btncapnhat_Click(object sender, EventArgs e)
 {
     if (tbxmatkhaucu.Text.Trim() == "" || tbxmatkhaumoi.Text.Trim() == "" || tbxxacnhan.Text.Trim() == "" ||
         tbxhotent2.Text.Trim() == "" || tbxcmndt2.Text.Trim() == "" || tbxgioitinht2.Text.Trim() == "" ||
         tbxdiachit2.Text.Trim() == "" || tbxsdtt2.Text.Trim() == "")
     {
         MessageBox.Show("Vui lòng nhập đầy đủ thông tin!",
                         "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (tbxmatkhaumoi.Text.Trim() != tbxxacnhan.Text.Trim())
     {
         MessageBox.Show("Xác nhận mật khẩu mới không chính xác vui lòng nhập lại!",
                         "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (!blaccout.ChangeInfo(frmQuanLy.Account.User, tbxmatkhaucu.Text.Trim(), tbxmatkhaumoi.Text.Trim(), Convert.ToInt32(tbxid.Text),
                              tbxhotent2.Text.Trim(), tbxgioitinht2.Text.Trim(), tbxcmndt2.Text.Trim(),
                              tbxdiachit2.Text.Trim(), tbxsdtt2.Text.Trim(), dtpkngaysinht2.Value.ToShortDateString(), ref error))
     {
         MessageBox.Show(error, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         MessageBox.Show("Cập nhật thành công!\nHãy ghi nhớ tài khoản và mật khẩu của bạn, nếu quên, hãy liên hệ quản trị viên của bạn!",
                         "Thành công!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         frmQuanLy.Account = blaccout.GetAccount(this.tbxtendangnhapt1.Text.Trim(), this.tbxmatkhaumoi.Text.Trim());
         btnxoa.PerformClick();
         LoadData();
     }
 }
Exemplo n.º 3
0
 private void frmQuanLiNguoiDung_Load(object sender, EventArgs e)
 {
     dgvLogin.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
     dgvLogin.AllowUserToAddRows  = false;
     dgvLogin.ReadOnly            = true;
     dgvLogin.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     dgvLogin.DataSource          = ac.GetAccount();
     Enabletxt(false);
     resettext();
     //// Không cho thao tác trên các nút Lưu / Hủy
     btnUpdate.Enabled = false;
     btnHuy.Enabled    = false;
     //// Cho thao tác trên các nút Thêm / Sửa / Xóa / Thoát
     btnThem.Enabled = true;
     btnEdit.Enabled = true;
     btnDel.Enabled  = true;
     btnExit.Enabled = true;
 }
Exemplo n.º 4
0
 private void btndangnhap_Click(object sender, EventArgs e)
 {
     frmQuanLy.Account = dangnhap.GetAccount(tbxname.Text.Trim(), tbxpass.Text.Trim());
     if (frmQuanLy.Account == null)
     {
         frmQuanLy.isLogin = false;
         MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         frmQuanLy.isLogin = true;
         if (frmQuanLy.Account.IsAdmin == 1)
         {
             frmQuanLy.isAdmin = true;
         }
         else
         {
             frmQuanLy.isAdmin = false;
         }
         MessageBox.Show("Đăng nhập thành công!", "Thành công!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
 }