Exemplo n.º 1
0
        private void btnKhoiPhucKH_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Khôi phục khách hàng " + dgvKH["Tên khách hàng", dgvKH.CurrentRow.Index].Value.ToString() + "?",
                                                  "THÔNG BÁO!",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                int      rowIndex = dgvKH.CurrentRow.Index;
                string   ma       = dgvKH["Mã khách hàng", rowIndex].Value.ToString();
                string   ten      = dgvKH["Tên khách hàng", rowIndex].Value.ToString();
                DateTime ngaysinh = (DateTime)dgvKH["Ngày sinh", rowIndex].Value;
                string   sdt      = dgvKH["Số điện thoại", rowIndex].Value.ToString();
                string   diaChi   = dgvKH["Địa chỉ", rowIndex].Value.ToString();

                if (dgvKH["Action", rowIndex].Value.ToString().Trim() == "D")
                {
                    khbll.KhoiPhuc(ma, ten, ngaysinh, sdt, diaChi);
                    MessageBox.Show("Ðã khôi phục khách hàng " + ten, "THÔNG BÁO!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (dgvKH["Action", rowIndex].Value.ToString().Trim() == "U")
                {
                    khbll.KhachHang_Update(ma, ten, ngaysinh, sdt, diaChi);
                    MessageBox.Show("Ðã khôi phục khách hàng " + ten, "THÔNG BÁO!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemplo n.º 2
0
 private void btnSuaKH_Click(object sender, EventArgs e)
 {
     try
     {
         dgvKH.DataSource = khbll.KhachHang_Update(tbxMaKH.Text, tbxTenKH.Text, dtpNgaySinhKH.Value, tbxSdtKH.Text, tbxDiaChiKH.Text);
         MessageBox.Show("Cập Nhật Thành công!");
     }
     catch (Exception LOI)
     {
         MessageBox.Show(LOI.Message, "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     HienThiKH();
 }
Exemplo n.º 3
0
 private void butsua_Click(object sender, EventArgs e)
 {
     KhachHang_BLL.KhachHang_Update(txtmakh.Text, txttenhh.Text, txtctkh.Text, txtdiachi.Text, txtmst.Text);
     butshow_Click(sender, e);
 }