Exemplo n.º 1
0
 private void FormDanhSachDatLich_Load(object sender, EventArgs e)
 {
     if (SoCMND == null)
     {
         LoadingTable ld = new LoadingTable(); // tạo đối tượng loadingtable (file class trong Cotroller -> dataGridView -> LoadingTable.cs
         dataGridView1.DataSource = ld.datlichkham();
     }
     else
     {
         LoadingTable ld = new LoadingTable(); // tạo đối tượng loadingtable (file class trong Cotroller -> dataGridView -> LoadingTable.cs
         dataGridView1.DataSource = ld.datlichkham();
         dataGridView1.DataSource = filter.searchRow(dataGridView1, "Số CMND", SoCMND);
     }
 }
Exemplo n.º 2
0
 private void guna2Button1_Click_1(object sender, EventArgs e)
 {
     using (var context = new YTeDbContext())
     {
         var people = context.ConNguois.Where(s => s.SoDienThoai == c).FirstOrDefault();
         if (people == null)
         {
             MessageBox.Show("Không tìm thấy bệnh nhân!");
         }
         else
         {
             MessageBox.Show("ID bệnh nhân đã xóa: " + people.ID_Nguoi.ToString(), "Thông báo!");
         }
         var people1 = context.DatLichKhams.Where(s => s.ID_Nguoi == people.ID_Nguoi).FirstOrDefault();
         context.DatLichKhams.Remove(people1);
         context.SaveChanges();
         LoadingTable ld = new LoadingTable();
         dataGridView1.DataSource = ld.datlichkham();
     }
 }
Exemplo n.º 3
0
 private void guna2Button2_Click(object sender, EventArgs e)
 {
     using (var context = new YTeDbContext())
     {
         var oldconnguoi = context.ConNguois.Where(s => s.SoDienThoai == c).FirstOrDefault();
         var oldpeople   = context.DatLichKhams.Where(s => s.ID_Nguoi == oldconnguoi.ID_Nguoi).FirstOrDefault();
         {
             oldpeople.LyDoKham = textboxLyDoKham.Text;
             // oldpeople.ThoiGianHenKham = guna2DateTimePicker1.Value.ToString();
             oldconnguoi.HoTen       = textboxHoTen.Text;
             oldconnguoi.SoCMND      = textboxCMND.Text;
             oldconnguoi.SoDienThoai = textboxSDT.Text;
             oldconnguoi.DiaChi      = textboxDiaChi.Text;
             oldconnguoi.Email       = textboxEmail.Text;
         }
         context.SaveChanges();
         LoadingTable ld = new LoadingTable();
         dataGridView1.DataSource = ld.datlichkham();
         MessageBox.Show(oldconnguoi.DiaChi);
         MessageBox.Show(oldpeople.LyDoKham);
         MessageBox.Show(oldpeople.ID_Nguoi + "  " + oldconnguoi.ID_Nguoi);
     }
 }