Exemplo n.º 1
0
 private void btn_khoiPhucTK_Click(object sender, EventArgs e)
 {
     if (dgview_khoiPhucTK.SelectedRowsCount == 0)
     {
         XtraMessageBox.Show("Chưa chọn đối tượng để khôi phục", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         DialogResult result = XtraMessageBox.Show("Bạn có muốn khôi phục tài khoản này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (DialogResult.Yes == result)
         {
             int[] selectedRows = dgview_khoiPhucTK.GetSelectedRows();
             foreach (int rowHandle in selectedRows)
             {
                 if (rowHandle >= 0)
                 {
                     string manv        = dgview_khoiPhucTK.GetRowCellValue(rowHandle, cl_manv).ToString();
                     string tenDangNhap = dgview_khoiPhucTK.GetRowCellValue(rowHandle, cl_tenDangNhap).ToString();
                     tkBUS.UpdateNVChuaCoTK(manv);
                     tkBUS.RestoreTK(tenDangNhap);
                 }
                 LoadTKDaXoa();
             }
             XtraMessageBox.Show("Khôi phục thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Exemplo n.º 2
0
        private void btn_luuTaiKhoan_Click(object sender, EventArgs e)
        {
            if (txt_taoTenDangNhap.Text == "" || txt_taoMatKhau.Text == "")

            {
                XtraMessageBox.Show("Chưa điền đầy đủ thông tin!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (tkBUS.CheckUsername(txt_taoTenDangNhap.Text) == 1)
                {
                    XtraMessageBox.Show("Tên đăng nhập đã tồn tại!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (txt_taoMatKhau.Text != txt_nhapLaiMK.Text)
                    {
                        XtraMessageBox.Show("Mật khẩu không khớp!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        if (tkDTO != null)
                        {
                            GetDetail();

                            int kq = tkBUS.AddTK(tkDTO);
                            if (kq == 1)
                            {
                                XtraMessageBox.Show("Tạo tài khoản thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                string manv = txt_manv.Text;
                                tkBUS.UpdateNVChuaCoTK(manv);
                                nvBUS.danhsachNVChuaCoTaiKhoan();
                                frmThemTaiKhoan.LoadDSNVChuaCoTaiKhoan();
                                this.Dispose();
                            }
                            else
                            {
                                XtraMessageBox.Show("Tạo không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                }
            }
        }