private void UpdatePractitioner() { try { rowsAffected = PractitionerDB.updatePractitioner(SelectedPractitioner); int delete = AvailabilityDB.deleteAvailDays(SelectedPractitioner.practitionerID); foreach (Days d in Days) { if (d.isChecked == true) { rowsAffected = AvailabilityDB.insertAvailDays(SelectedPractitioner.practitionerID, d.dayID); } } //Practitioners.Clear(); //DisplayAllPractitioner(); if (rowsAffected != 0) { MessageBox.Show("Practitioner Updated"); } else { MessageBox.Show("Update Failed"); } } catch (Exception e) { throw e; } }
private void insertDays(Practitioner practitioner) { int lastRow = Practitioners.Count; for (int i = 0; i <= lastRow; i++) { if (i == lastRow) { foreach (Days d in Days) { if (d.isChecked == true) { rowsAffected = AvailabilityDB.insertAvailDays(practitioner.practitionerID, d.dayID); } } } } }