Пример #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     dataGridPHONG.DataSource     = Phongcontrol.getdatap();
     dataGridView2.DataSource     = Khachhangcontrol.getdataK();
     dataGridView3.DataSource     = Dichvucontrol.getdatadv();
     datDOAN.DataSource           = Doancontrol.getdatadoan();
     dataNCP.DataSource           = NgCPcontrol.getdataNCP();
     dataNV.DataSource            = Nhanviencontrol.getdatanv();
     datap_thue.DataSource        = P_Thuecontrol.getdatap_thue();
     datachitietp_thue.DataSource = Chitietp_Thuecontrol.getdatactThue();
     dathoadon.DataSource         = Hoadoncontrol.getdatahd();
 }
Пример #2
0
 //xóa khách hàng
 private void btnxoaKH_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult dg = new DialogResult();
         dg = MessageBox.Show("Bạn có muốn xóa không", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dg == DialogResult.Yes)
         {
             Khachhangobject kh = new Khachhangobject();
             kh.Makh = txtMAKH.Text;
             Khachhangcontrol.Deletekhachhang(kh);
             dataGridView2.DataSource = Khachhangcontrol.getdataK();
         }
     }
     catch { }
 }
Пример #3
0
 //sửa khách hàng
 private void btnsuaKH_Click(object sender, EventArgs e)
 {
     try
     {
         Khachhangobject kh = new Khachhangobject();
         kh.Makh  = txtMAKH.Text;
         kh.Tenkh = txtTENKH.Text;
         kh.Cmt   = txtCMT.Text;
         kh.Sdt   = txtSDT.Text;
         if (this.radioGT.Checked == true)
         {
             kh.Gt = radioGT.Text;
         }
         else
         {
             kh.Gt = radioButton2.Text;
         }
         kh.Madoan = txtmadoan.Text;
         kh.Diachi = txtdiachi.Text;
         Khachhangcontrol.Updatekhachhang(kh);
         dataGridView2.DataSource = Khachhangcontrol.getdataK();
     }
     catch { }
 }
Пример #4
0
 private void button3_Click(object sender, EventArgs e)
 {
     dataGridView2.DataSource = Khachhangcontrol.getdataK();
 }
Пример #5
0
 private void btntimkh_Click(object sender, EventArgs e)
 {
     if (txttimkhach.Text.Trim() == "")
     {
         DataTable dttatca = Khachhangcontrol.getdataK();
         if (radtatca.Checked == true)
         {
             dataGridView1.DataSource = dttatca;
         }
         else
         {
             MessageBox.Show("Bạn chưa nhập thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
     }
     else
     {
         //THEO tên khách hàng
         DataTable dttenkh = Khachhangcontrol.getdatabyTenkh(txttimkhach.Text.Trim());
         if (dttenkh.Rows.Count > 0 && radtenkh.Checked == true)
         {
             dataGridView1.DataSource = dttenkh;
         }
         else
         {
             DataTable dtmadoan = Khachhangcontrol.getdatabyDOAN(txttimkhach.Text.Trim());
             if (dtmadoan.Rows.Count > 0 && radmadoan.Checked == true)
             {
                 dataGridView1.DataSource = dtmadoan; //theo madoan
             }
             else
             {
                 DataTable dttendoan = Khachhangcontrol.getdatabyTENDOAN(txttimkhach.Text.Trim());
                 if (dttendoan.Rows.Count > 0 && radtendoan.Checked == true)
                 {
                     dataGridView1.DataSource = dttendoan;//theo ten doan
                 }
                 else
                 {
                     DataTable dtmakhach = Khachhangcontrol.getdatabyMAKH(txttimkhach.Text.Trim());
                     if (dtmakhach.Rows.Count > 0 && radioButton1.Checked == true)
                     {
                         dataGridView1.DataSource = dtmakhach;//theo ma khach
                     }
                     else
                     {
                         //THEO CMT
                         DataTable dtcmt = Khachhangcontrol.getdatabyCMT(txttimkhach.Text.Trim());
                         if (dtcmt.Rows.Count > 0 && radCMT.Checked == true)
                         {
                             dataGridView1.DataSource = dtcmt;
                         }
                         else
                         {
                             //THEO SDT
                             DataTable dtsdt = Khachhangcontrol.getdatabySDT(txttimkhach.Text.Trim());
                             if (dtsdt.Rows.Count > 0 && radSDT.Checked == true)
                             {
                                 dataGridView1.DataSource = dtsdt;
                             }
                             else
                             {
                                 MessageBox.Show("Không đúng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                             }
                         }
                     }
                 }
             }
         }
     }
 }