Пример #1
0
 public void RemoveMedical(int id)
 {
     LoadMedicalsFromDatabase();
     Medical med = new Medical();
     foreach (Medical m in medicalList)
     {
         if (m.Id == id) med = m;
     }
     using (ISession session = NhibernateService.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Delete(med);
             transaction.Commit();
         }
     }
     LoadMedicalsFromDatabase();
     Notify();
 }
Пример #2
0
 public void AddMedical(string description, DateTime date, Prisoner pris)
 {
     LoadMedicalsFromDatabase();
     Medical med = new Medical(description, date, pris);
     using (ISession session = NhibernateService.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Save(med);
             transaction.Commit();
         }
     }
     LoadMedicalsFromDatabase();
     Notify();
 }