Пример #1
0
 public static bool Them_KH(KhachHang k)
 {
     bool ban = false;
     if (isConnect())
     {
         SqlCommand com = new SqlCommand();
         com.CommandText = "Them_KH";
         com.CommandType = CommandType.StoredProcedure;
         com.Parameters.AddWithValue("@ten", k.HoTen);
         com.Parameters.AddWithValue("@cmnd", k.CMND);
         com.Parameters.AddWithValue("@diachi", k.DiaChi);
         com.Parameters.AddWithValue("@nlv", k.NoiLamViec);
         com.Parameters.AddWithValue("@ns", k.NS);
         com.Parameters.AddWithValue("@sdt", k.SDT);
         com.Connection = con;
         int i = com.ExecuteNonQuery();
         ban = i > 0 ? true : false;
     }
     return ban;
 }
Пример #2
0
 private void QLKH_but_OK_Click(object sender, EventArgs e)
 {
     if (txtCmnd.Text != "" && txtdc.Text != "" && txtdt.Text != "" && txtnct.Text != "" && txtten.Text != "")
     {
         KhachHang k = new KhachHang();
         k.CMND = txtCmnd.Text;
         k.HoTen = txtten.Text;
         k.SDT = txtdt.Text;
         k.DiaChi = txtdc.Text;
         k.NoiLamViec = txtnct.Text;
         k.NS = QLKH_dateNS.Value;
         bool kt = connect.Them_KH(k);
         if (kt)
             MessageBox.Show("Them khach hang thanh cong");
         else
             MessageBox.Show("Them khach hang that bai");
     }
     else
         MessageBox.Show("Nhap du thong tin");
 }