public int medicinePerPeriod(string medicine, DateTime startDate, DateTime endDate) { IDal dal = new PrescriptionDAL.DalImplement(); int medicineId = dal.getAllMedicines().FirstOrDefault(m => m.Name == medicine).Id; return(dal.getAllPrescriptions().Count(prescription => prescription.StartDate >= startDate && prescription.StartDate <= endDate && prescription.medicine == medicineId)); }
public void updateDoctor(Doctor doctor) { try { IDal dal = new PrescriptionDAL.DalImplement(); dal.updateDoctor(doctor); } catch (Exception ex) { throw ex; } }
public void updateAdministrator(Administrator administrator) { try { IDal dal = new PrescriptionDAL.DalImplement(); dal.updateAdministrator(administrator); } catch (Exception ex) { throw ex; } }
public void deleteSpecialty(Specialty specialty) { try { IDal dal = new PrescriptionDAL.DalImplement(); dal.deleteSpecialty(specialty); } catch (Exception ex) { throw ex; } }
public void updatePatient(Patient patient) { try { IDal dal = new PrescriptionDAL.DalImplement(); dal.updatePatient(patient); } catch (Exception ex) { throw ex; } }
public void updateMedicine(Medicine medicine) { try { IDal dal = new PrescriptionDAL.DalImplement(); dal.updateMedicine(medicine); } catch (Exception ex) { throw ex; } }
public string getMedicinePicture(int medicinId) { try { IDal dal = new PrescriptionDAL.DalImplement(); //return dal.getMedicinePicture(medicinId); return(Path.Combine("~/GoogleDriveFiles", Path.GetFileName(dal.getMedicinePicture(medicinId)))); } catch (Exception ex) { throw ex; } }
public void updateMedicinePicture(int medicineId, HttpPostedFileBase file) { try { string filePath = Path.Combine(HttpContext.Current.Server.MapPath("~/GoogleDriveFiles"), Path.GetFileName(file.FileName)); file.SaveAs(filePath); if (!validMedicinePicture(filePath)) { throw new Exception("the picture does not contain a medicine"); } IDal dal = new PrescriptionDAL.DalImplement(); dal.updateMedicinePicture(medicineId, file); } catch (Exception ex) { throw ex; } }
//------------ Prescriptions --------------- public void addPrescription(Prescription prescription) { IDal dal = new PrescriptionDAL.DalImplement(); //Checks if the doctor's license is valid if (dal.getAllDoctors().ToList().Find(d => d.DoctorId == prescription.Doctor).LicenseExpirationDate >= DateTime.Today) { try { dal.addPrescription(prescription); } catch (Exception ex) { throw ex; } } else { throw new Exception("The the doctor's license is not valid "); } }
public IEnumerable <Administrator> getAllAdministrators() { IDal dal = new PrescriptionDAL.DalImplement(); return(dal.getAllAdministrators()); }
/* public int medicinePerPeriod(string medicine, DateTime startDate, DateTime endDate) * { * IDal dal = new PrescriptionDAL.DalImplement(); * int medicineId = dal.getAllMedicines().FirstOrDefault(m => m.Name == medicine).Id; * return dal.getAllPrescriptions().Count(prescription => prescription.StartDate >= startDate && prescription.StartDate <= endDate && prescription.medicine.Exists(m => m == medicineId)); * }*/ public bool isAdministrator(string username, string password) { IDal dal = new PrescriptionDAL.DalImplement(); return(dal.getAllAdministrators().ToList().Exists(admin => admin.Password == password && admin.UserName == username)); }
public IEnumerable <Specialty> getAllSpecialties() { IDal dal = new PrescriptionDAL.DalImplement(); return(dal.getAllSpecialties()); }
public IEnumerable <Prescription> allPrescriptionFromPatient(Patient patient) { IDal dal = new PrescriptionDAL.DalImplement(); return(dal.getAllPrescriptions().Where(prescription => prescription.Patient == patient.PatientId)); }
public IEnumerable <Prescription> getAllPrescriptions() { IDal dal = new PrescriptionDAL.DalImplement(); return(dal.getAllPrescriptions()); }
public IEnumerable <Medicine> getAllMedicines() { IDal dal = new PrescriptionDAL.DalImplement(); return(dal.getAllMedicines()); }
public IEnumerable <Prescription> allPrescriptionByDoctor(Doctor doctor) { IDal dal = new PrescriptionDAL.DalImplement(); return(dal.getAllPrescriptions().Where(prescription => prescription.Doctor == doctor.DoctorId)); }