private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1. Columns[e.ColumnIndex]. HeaderText. ToLower() == "delete") { if (MessageBox.Show ("Are you sure you want to delete this allergy?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) { //int customerId = // Convert.ToInt32(dgvCustomers. // Rows[e.RowIndex]. // Cells[0]. // Value); clinicHistory_Alergie objCustomer = (clinicHistory_Alergie)dataGridView1. Rows[e.RowIndex]. DataBoundItem; this.clinic_allergyService.deleteClinicHistoryAllergy(objCustomer.id); this.load(); } } }
public void CreateClinicHistory_Allergy(clinicHistory_Alergie objDoctor_Speciality) { using (var dataContext = new FinalAppWebEntities()) { dataContext.clinicHistory_Alergie.Add(objDoctor_Speciality); dataContext.SaveChanges(); } }
private void btnAddAlergi_Click(object sender, EventArgs e) { //creaicon historia clincia - alergia clinicHistory_Alergie clinicHsitoryAlergy = new clinicHistory_Alergie(); clinicHsitoryAlergy.AlergieId = Convert.ToInt32(cbAllergies.SelectedValue); clinicHsitoryAlergy.clinicHistoryId = idPClinicHsitory; clinic_allergyService.CreateClinicHistory_Allergy(clinicHsitoryAlergy); this.load(); }
clinicHistory_Alergie IClinicHistory_AlergieRepository.GetClinicHistory_Allergy(int id) { using (var dataContext = new FinalAppWebEntities()) { var custs = from c in dataContext.clinicHistory_Alergie where c.id == id select c; clinicHistory_Alergie objDoctor_Speciality = custs.FirstOrDefault(); return(objDoctor_Speciality); } }
public void deleteClinicHistoryAllergy(int id) { using (var dataContext = new FinalAppWebEntities()) { //Load customer object var cust = from c in dataContext.clinicHistory_Alergie where c.id == id select c; clinicHistory_Alergie objCustomer = cust.FirstOrDefault(); //Remove dataContext.clinicHistory_Alergie.Remove(objCustomer); //Save dataContext.SaveChanges(); } }
public void CreateClinicHistory_Allergy(clinicHistory_Alergie objDoctor_Speciality) { IClinicHistory_AlergieRepository repo = new ClinicHistory_AlergieRepository(); repo.CreateClinicHistory_Allergy(objDoctor_Speciality); }