Exemple #1
0
 public List <PrescriptionMedicine> GetMedicinesList()
 {
     using (var ctx = new PatientDATA())
     {
         return(ctx.PrescriptionMedicine.ToList());
     }
 }
Exemple #2
0
 public List <Patient> GetList()
 {
     using (var ctx = new PatientDATA())
     {
         return(ctx.Patient.ToList());
     }
 }
Exemple #3
0
 public Patient GetPatientByTZ(long tz)
 {
     using (var ctx = new PatientDATA())
     {
         var Patient = ctx.Patient.Where(s => s.TZ == tz).FirstOrDefault();
         return(Patient);
     }
 }
Exemple #4
0
 public Patient GetPatientByID(int id)
 {
     using (var ctx = new PatientDATA())
     {
         var Patient = ctx.Patient.Where(s => s.ID == id).FirstOrDefault();
         return(Patient);
     }
 }
Exemple #5
0
 public void Add(Patient Patient)
 {
     using (var ctx = new PatientDATA())
     {
         ctx.Patient.Add(Patient);
         ctx.SaveChanges();
     }
 }
Exemple #6
0
 public void Delete(int id)
 {
     using (var ctx = new PatientDATA())
     {
         var patient = ctx.Patient.Where(s => s.ID == id).FirstOrDefault();
         ctx.Patient.Remove(patient); // פונקציות של הדאטה בייס
         ctx.SaveChanges();           // שמירת שינויים
     }
 }
Exemple #7
0
 public List <PrescriptionMedicine> GetPatientMedicines(Patient patient)
 {
     using (PatientDATA ctx = new PatientDATA())
     {
         List <PrescriptionMedicine> medicines = new List <PrescriptionMedicine>(
             ctx.PrescriptionMedicine.Where(medicine => medicine.PatientTZ == patient.TZ));
         return(medicines);
     }
 }
Exemple #8
0
 public void Edit(Patient patient)
 {
     using (var ctx = new PatientDATA())
     {
         var p = ctx.Patient.FirstOrDefault(x => x.ID == patient.ID);
         ctx.Patient.Remove(p);
         ctx.Patient.Add(patient);
         ctx.SaveChanges();
     }
 }
Exemple #9
0
 public void AddMedicines(List <MedicineTimes> medicines, Prescription prescription)
 {
     using (var ctx = new PatientDATA())
     {
         foreach (var item in medicines)
         {
             PrescriptionMedicine medicine = new PrescriptionMedicine(prescription.PatientTZ, item.MyMedicine.ProprietaryName, item.StartTime, item.EndTime);
             ctx.PrescriptionMedicine.Add(medicine);
             ctx.SaveChanges();
         }
     }
 }
Exemple #10
0
 public List <string> GetTZ()
 {
     using (var ctx = new PatientDATA())
     {
         List <string> TZ = new List <string>();
         foreach (var item in ctx.Patient)
         {
             TZ.Add(item.TZ.ToString());
         }
         return(TZ);
     }
 }