Пример #1
0
 public int BenhNhanInsert(BenhNhanEntity bn)
 {
     SqlConnection conn = ConnectionDB.GetConnect();
     int i = 0;
     try
     {
         conn.Open();
         SqlCommand cmd = new SqlCommand("BenhNhanInsert", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@MaBenhNhan", bn.MaBenhNhan));
         cmd.Parameters.Add(new SqlParameter("@TenBenhNhan", bn.TenBenhNhan));
         cmd.Parameters.Add(new SqlParameter("@CMND", bn.CMND));
         cmd.Parameters.Add(new SqlParameter("@NgaySinh", bn.NgaySinh));
         cmd.Parameters.Add(new SqlParameter("@DiaChi", bn.DiaChi));
         cmd.Parameters.Add(new SqlParameter("@SDT", bn.SDT));
         cmd.Parameters.Add(new SqlParameter("@GioiTinh", bn.GioiTinh));
         cmd.Parameters.Add(new SqlParameter("@MaPhongKham", bn.MaPhongKham));
         cmd.ExecuteNonQuery();
         i = 1;
     }
     catch
     {
         i = 0;
         throw;
     }
     finally
     {
         conn.Close();
     }
     return i;
 }
Пример #2
0
 public DataTable BenhNhanSearch1(BenhNhanEntity bn)
 {
     var bnDAL = new BenhNhanDAL();
     var dt = new DataTable();
     dt = bnDAL.BenhNhanSearch1(bn);
     return dt;
 }
Пример #3
0
 public bool BenhNhanUpDate(BenhNhanEntity bn)
 {
     var bnDAL = new BenhNhanDAL();
     var i = bnDAL.BenhNhanUpDate(bn);
     if (i == 1)
         return true;
     else
         return false;
 }
Пример #4
0
 public DataTable BenhNhanSearch1(BenhNhanEntity bn)
 {
     SqlConnection conn = ConnectionDB.GetConnect();
     try
     {
         conn.Open();
         SqlCommand cmd = new SqlCommand("BenhNhanSearch1", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@temp", bn.TenBenhNhan));
         SqlDataAdapter adap = new SqlDataAdapter(cmd);
         DataTable dt = new DataTable();
         adap.Fill(dt);
         return dt;
     }
     catch
     {
         return null;
         throw;
     }
     finally
     {
         conn.Close();
     }
 }
Пример #5
0
 private void txtSearchBN_TextChanged(object sender, EventArgs e)
 {
     BenhNhanEntity obj = new BenhNhanEntity();
     //obj.MaBenhNhan = txtSearchBN.Text;
     obj.TenBenhNhan = txtSearchBN.Text;
     dgvBenhNhan.DataSource = bn.BenhNhanSearch(obj);
 }
Пример #6
0
 private void txtSearchBN1_TextChanged(object sender, EventArgs e)
 {
     BenhNhanEntity obj = new BenhNhanEntity();
     obj.TenBenhNhan = txtSearchBN1.Text;
     dgvBNChuaKham.DataSource = bn.BenhNhanSearch1(obj);
 }
Пример #7
0
 BenhNhanEntity TaoBN()
 {
     BenhNhanEntity obj = new BenhNhanEntity();
     obj.MaBenhNhan = txtMaBN.Text;
     obj.TenBenhNhan = txtTenBN.Text;
     obj.CMND = txtCMND.Text;
     obj.NgaySinh = dtNgaySinh.Value;
     obj.DiaChi = txtDiaChi.Text;
     obj.SDT = txtSDT.Text;
     obj.GioiTinh = txtGioiTinh.Text;
     obj.MaPhongKham = ((PhongKhamEntity)cbbPhongKham.SelectedItem).MaPhongKham;
     return obj;
 }