Beispiel #1
0
 public void AddPatient(Patient patient)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             db.Patients.Add(patient);
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }
Beispiel #2
0
 public void AddManager(Manager manager)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             db.Managers.Add(manager);
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }
Beispiel #3
0
 public void DeletePatient(int id)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             Patient patient = db.Patients.First(d => d.Id == id);
             db.Patients.Remove(patient);
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }
Beispiel #4
0
 public void UpdateMedicine(Medicine medicine, string NDCId)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             var tmp = db.Medicines.First(m => m.NDCId == NDCId);
             tmp.ImagePath = medicine.ImagePath;
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }
Beispiel #5
0
 public void DeleteManager(int id)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             Manager manager = db.Managers.First(d => d.Id == id);
             db.Managers.Remove(manager);
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }
Beispiel #6
0
 public void DeleteDoctor(int id)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             Doctor doctor = db.Doctors.First(d => d.Id == id);
             db.Doctors.Remove(doctor);
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }
Beispiel #7
0
 public void AddDoctor(Doctor doctor)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             db.Doctors.Add(doctor);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #8
0
 public void AddPrescription(Prescription prescription)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             db.Prescriptions.Add(prescription);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #9
0
 public void AddMedicine(Medicine medicine)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             db.Medicines.Add(medicine);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #10
0
 public void UpdateManager(Manager manager, int Id)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             var tmp = db.Managers.First(m => m.Id == Id);
             tmp.Birthday = manager.Birthday;
             tmp.Mail     = manager.Mail;
             tmp.Password = manager.Password;
             tmp.Phone    = manager.Phone;
             tmp.UserName = manager.UserName;
             tmp.UserType = manager.UserType;
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }
Beispiel #11
0
 public void UpdatePatient(Patient patient, int Id)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             var tmp = db.Patients.First(p => p.Id == Id);
             tmp.Background = patient.Background;
             tmp.Birthday   = patient.Birthday;
             tmp.BloodType  = patient.BloodType;
             tmp.UserName   = patient.UserName;
             tmp.Mail       = patient.Mail;
             tmp.Phone      = patient.Phone;
             tmp.Password   = patient.Password;
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }
Beispiel #12
0
 public void UpdateDoctor(Doctor doctor, int Id)
 {
     try
     {
         using (var db = new MediKalDB())
         {
             var tmp = db.Doctors.First(d => d.Id == Id);
             tmp.Birthday   = doctor.Birthday;
             tmp.Mail       = doctor.Mail;
             tmp.Password   = doctor.Password;
             tmp.Phone      = doctor.Phone;
             tmp.UserName   = doctor.UserName;
             tmp.UserType   = doctor.UserType;
             tmp.LicenseNum = doctor.LicenseNum;
             tmp.Specialty  = doctor.Specialty;
             tmp.Password   = doctor.Password;
             db.SaveChanges();
         }
     }
     catch (Exception e) { throw new Exception(e.Message); }
 }