Exemplo n.º 1
0
 public Patient GetPatient(string patientId)
 {
     using (var db = new DrConsoleDB())
     {
         return((from p in db.PatientsDB where p.ID.Equals(patientId) select p).FirstOrDefault());
     }
 }
Exemplo n.º 2
0
 public List <Prescription> GetAllPrescriptions()
 {
     using (var db = new DrConsoleDB())
     {
         return((from p in db.PrescriptionDB select p).ToList());
     }
 }
Exemplo n.º 3
0
 public List <Doctor> GetAllDoctors()
 {
     using (var db = new DrConsoleDB())
     {
         return((from d in db.DoctorsDB select d).ToList());
     }
 }
Exemplo n.º 4
0
 public List <ActiveIngredient> GetAllActiveIngredients()
 {
     using (var db = new DrConsoleDB())
     {
         return((from a in db.ActiveIngredientsDB select a).ToList());
     }
 }
Exemplo n.º 5
0
 public List <Patient> GetAllPatients()
 {
     using (var db = new DrConsoleDB())
     {
         return((from p in db.PatientsDB select p).ToList());
     }
 }
Exemplo n.º 6
0
 public Doctor GetDoctor(string doctorId)
 {
     using (var db = new DrConsoleDB())
     {
         return((from d in db.DoctorsDB where d.ID.Equals(doctorId) select d).FirstOrDefault());
     }
 }
Exemplo n.º 7
0
 public List <Drug> GetAllDrugs()
 {
     using (var db = new DrConsoleDB())
     {
         return((from d in db.DrugsDB select d).ToList());
     }
 }
Exemplo n.º 8
0
 public List <Admin> GetAllAdmins()
 {
     using (var db = new DrConsoleDB())
     {
         return((from a in db.AdminsDB select a).ToList());
     }
 }
Exemplo n.º 9
0
 public Drug GetDrug(string drugName)
 {
     using (var db = new DrConsoleDB())
     {
         return((from d in db.DrugsDB where d.DrugName.Equals(drugName) select d).FirstOrDefault());
     }
 }
Exemplo n.º 10
0
 public void DeleteDoctor(Doctor doctor)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(doctor).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Exemplo n.º 11
0
 public void AddDoctor(Doctor doctor)
 {
     using (var db = new DrConsoleDB())
     {
         db.DoctorsDB.Add(doctor);
         db.SaveChanges();
     }
 }
Exemplo n.º 12
0
 public void DeletePatient(Patient patient)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(patient).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Exemplo n.º 13
0
 public void DeleteAdmin(Admin admin)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(admin).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Exemplo n.º 14
0
 public void DeleteActiveIngredient(ActiveIngredient active)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(active).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Exemplo n.º 15
0
 public void AddActiveIngredient(ActiveIngredient active)
 {
     using (var db = new DrConsoleDB())
     {
         db.ActiveIngredientsDB.Add(active);
         db.SaveChanges();
     }
 }
Exemplo n.º 16
0
 public void AddPrescription(Prescription prescription)
 {
     using (var db = new DrConsoleDB())
     {
         db.PrescriptionDB.Add(prescription);
         db.SaveChanges();
     }
 }
Exemplo n.º 17
0
 public void AddPatient(Patient patient)
 {
     using (var db = new DrConsoleDB())
     {
         db.PatientsDB.Add(patient);
         db.SaveChanges();
     }
 }
Exemplo n.º 18
0
 public void UpdateDrug(Drug d)
 {
     using (var db = new DrConsoleDB())
     {
         db.DrugsDB.AddOrUpdate(d);
         db.SaveChanges();
     }
 }
Exemplo n.º 19
0
 public void AddAdmin(Admin admin)
 {
     using (var db = new DrConsoleDB())
     {
         db.AdminsDB.Add(admin);
         db.SaveChanges();
     }
 }
Exemplo n.º 20
0
 public void UpdatePatient(Patient p)
 {
     using (var db = new DrConsoleDB())
     {
         db.PatientsDB.AddOrUpdate(p);
         db.SaveChanges();
     }
 }
Exemplo n.º 21
0
 public void UpdateDoctor(Doctor d)
 {
     using (var db = new DrConsoleDB())
     {
         db.DoctorsDB.AddOrUpdate(d);
         db.SaveChanges();
     }
 }
Exemplo n.º 22
0
 public void UpdateAdmin(Admin a)
 {
     using (var db = new DrConsoleDB())
     {
         db.AdminsDB.AddOrUpdate(a);
         db.SaveChanges();
     }
 }
Exemplo n.º 23
0
 public void DeleteDrug(Drug drug)
 {
     try
     {
         System.IO.File.Delete(drug.ImgSrc);
     }
     catch { }
     using (var db = new DrConsoleDB())
     {
         db.Entry(drug).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Exemplo n.º 24
0
        public void AddDrug(Drug drug)
        {
            string newImagePath = @"..\..\Global\Images\DrugImages\" + drug.DrugName + RandomString() + @".jpg";

            (System.IO.File.Create(newImagePath)).Close();
            System.IO.File.Copy(drug.ImgSrc, newImagePath, true);

            drug.ImgSrc = newImagePath;
            using (var db = new DrConsoleDB())
            {
                db.DrugsDB.Add(drug);
                db.SaveChanges();
            }
        }