示例#1
0
        private void btnQuanLyNguoiDung_ThemMoi_Click(object sender, EventArgs e)
        {
            int ketQua = 0; // 0: Thêm thất bại

            // 1: Thêm thành công
            //-1: Đã tồn tại người dùng đó
            if (txtTenDangNhap.TextLength > 0 && txtMatKhau.TextLength > 0 && txtEmail.TextLength > 0)
            {
                ketQua = NguoiDungBUS.themNguoiDung(new NguoiDungDTO(txtTenDangNhap.Text, txtMatKhau.Text, txtEmail.Text));
                if (ketQua == 1)
                {
                    MessageBox.Show("Thêm người dùng mới thành công", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    dgvQuanLyNguoiDung_DanhSachNguoiDung.DataSource = NguoiDungBUS.hienThiTatCaNguoiDung();
                    txtTenDangNhap.Text = txtMatKhau.Text = txtEmail.Text = "";
                }
                else if (ketQua == 0)
                {
                    MessageBox.Show("Thêm người dùng mới thất bại", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Đã tồn tại tên đăng nhập đó\nVui lòng nhập tên khác", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Vui lòng điền tên đầy đủ thông tin", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#2
0
        private void btnQuanLyNguoiDung_Sua_Click(object sender, EventArgs e)
        {
            string tenDangNhap = dgvQuanLyNguoiDung_DanhSachNguoiDung.SelectedRows[0].Cells[0].Value.ToString();

            if (txtTenDangNhap.TextLength > 0 && txtEmail.TextLength > 0 && txtMatKhau.TextLength > 0)
            {
                bool ketQua = NguoiDungBUS.suaNguoiDung(new NguoiDungDTO(tenDangNhap, txtMatKhau.Text, txtEmail.Text));

                if (ketQua)
                {
                    MessageBox.Show("Sửa người dùng thành công", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    dgvQuanLyNguoiDung_DanhSachNguoiDung.DataSource = NguoiDungBUS.hienThiTatCaNguoiDung();
                    txtTenDangNhap.Text     = txtMatKhau.Text = txtEmail.Text = "";
                    txtTenDangNhap.ReadOnly = false;
                }
                else
                {
                    MessageBox.Show("Sửa người dùng thất bại", "Loi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Vui lòng click chọn bảng bên dưới để sửa\nVà điền đầy đủ thông tin", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#3
0
 private void btn_QuanLyChung_Click(object sender, EventArgs e)
 {
     panelQuanLyPhong.Visible  = false;
     panelChoThuePhong.Visible = false;
     panelThongKe.Visible      = false;
     panelTraCuu.Visible       = false;
     panelQuanLyChung.Visible  = true;
     dgvQuanLyNguoiDung_DanhSachNguoiDung.DataSource = NguoiDungBUS.hienThiTatCaNguoiDung();
 }