Esempio n. 1
0
 public void UpdatePatient(Patient p)
 {
     using (var db = new DrConsoleDB())
     {
         db.PatientsDB.AddOrUpdate(p);
         db.SaveChanges();
     }
 }
Esempio n. 2
0
 public void UpdateDrug(Drug d)
 {
     using (var db = new DrConsoleDB())
     {
         db.DrugsDB.AddOrUpdate(d);
         db.SaveChanges();
     }
 }
Esempio n. 3
0
 public void UpdateAdmin(Admin a)
 {
     using (var db = new DrConsoleDB())
     {
         db.AdminsDB.AddOrUpdate(a);
         db.SaveChanges();
     }
 }
Esempio n. 4
0
 public void UpdateDoctor(Doctor d)
 {
     using (var db = new DrConsoleDB())
     {
         db.DoctorsDB.AddOrUpdate(d);
         db.SaveChanges();
     }
 }
Esempio n. 5
0
 public void DeleteAdmin(Admin admin)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(admin).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Esempio n. 6
0
 public void DeletePatient(Patient patient)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(patient).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Esempio n. 7
0
 public void DeleteDoctor(Doctor doctor)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(doctor).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Esempio n. 8
0
 public void AddActiveIngredient(ActiveIngredient active)
 {
     using (var db = new DrConsoleDB())
     {
         db.ActiveIngredientsDB.Add(active);
         db.SaveChanges();
     }
 }
Esempio n. 9
0
 public void DeleteActiveIngredient(ActiveIngredient active)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(active).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Esempio n. 10
0
 public void AddPrescription(Prescription prescription)
 {
     using (var db = new DrConsoleDB())
     {
         db.PrescriptionDB.Add(prescription);
         db.SaveChanges();
     }
 }
Esempio n. 11
0
 public void AddPatient(Patient patient)
 {
     using (var db = new DrConsoleDB())
     {
         db.PatientsDB.Add(patient);
         db.SaveChanges();
     }
 }
Esempio n. 12
0
 public void AddDoctor(Doctor doctor)
 {
     using (var db = new DrConsoleDB())
     {
         db.DoctorsDB.Add(doctor);
         db.SaveChanges();
     }
 }
Esempio n. 13
0
 public void AddAdmin(Admin admin)
 {
     using (var db = new DrConsoleDB())
     {
         db.AdminsDB.Add(admin);
         db.SaveChanges();
     }
 }
Esempio n. 14
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();
     }
 }
Esempio n. 15
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();
            }
        }