示例#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());
     }
 }
示例#2
0
 public List <Prescription> GetAllPrescriptions()
 {
     using (var db = new DrConsoleDB())
     {
         return((from p in db.PrescriptionDB select p).ToList());
     }
 }
示例#3
0
 public List <Doctor> GetAllDoctors()
 {
     using (var db = new DrConsoleDB())
     {
         return((from d in db.DoctorsDB select d).ToList());
     }
 }
示例#4
0
 public List <ActiveIngredient> GetAllActiveIngredients()
 {
     using (var db = new DrConsoleDB())
     {
         return((from a in db.ActiveIngredientsDB select a).ToList());
     }
 }
示例#5
0
 public List <Patient> GetAllPatients()
 {
     using (var db = new DrConsoleDB())
     {
         return((from p in db.PatientsDB select p).ToList());
     }
 }
示例#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());
     }
 }
示例#7
0
 public List <Drug> GetAllDrugs()
 {
     using (var db = new DrConsoleDB())
     {
         return((from d in db.DrugsDB select d).ToList());
     }
 }
示例#8
0
 public List <Admin> GetAllAdmins()
 {
     using (var db = new DrConsoleDB())
     {
         return((from a in db.AdminsDB select a).ToList());
     }
 }
示例#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());
     }
 }
示例#10
0
 public void DeleteDoctor(Doctor doctor)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(doctor).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
示例#11
0
 public void AddDoctor(Doctor doctor)
 {
     using (var db = new DrConsoleDB())
     {
         db.DoctorsDB.Add(doctor);
         db.SaveChanges();
     }
 }
示例#12
0
 public void DeletePatient(Patient patient)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(patient).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
示例#13
0
 public void DeleteAdmin(Admin admin)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(admin).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
示例#14
0
 public void DeleteActiveIngredient(ActiveIngredient active)
 {
     using (var db = new DrConsoleDB())
     {
         db.Entry(active).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
示例#15
0
 public void AddActiveIngredient(ActiveIngredient active)
 {
     using (var db = new DrConsoleDB())
     {
         db.ActiveIngredientsDB.Add(active);
         db.SaveChanges();
     }
 }
示例#16
0
 public void AddPrescription(Prescription prescription)
 {
     using (var db = new DrConsoleDB())
     {
         db.PrescriptionDB.Add(prescription);
         db.SaveChanges();
     }
 }
示例#17
0
 public void AddPatient(Patient patient)
 {
     using (var db = new DrConsoleDB())
     {
         db.PatientsDB.Add(patient);
         db.SaveChanges();
     }
 }
示例#18
0
 public void UpdateDrug(Drug d)
 {
     using (var db = new DrConsoleDB())
     {
         db.DrugsDB.AddOrUpdate(d);
         db.SaveChanges();
     }
 }
示例#19
0
 public void AddAdmin(Admin admin)
 {
     using (var db = new DrConsoleDB())
     {
         db.AdminsDB.Add(admin);
         db.SaveChanges();
     }
 }
示例#20
0
 public void UpdatePatient(Patient p)
 {
     using (var db = new DrConsoleDB())
     {
         db.PatientsDB.AddOrUpdate(p);
         db.SaveChanges();
     }
 }
示例#21
0
 public void UpdateDoctor(Doctor d)
 {
     using (var db = new DrConsoleDB())
     {
         db.DoctorsDB.AddOrUpdate(d);
         db.SaveChanges();
     }
 }
示例#22
0
 public void UpdateAdmin(Admin a)
 {
     using (var db = new DrConsoleDB())
     {
         db.AdminsDB.AddOrUpdate(a);
         db.SaveChanges();
     }
 }
示例#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();
     }
 }
示例#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();
            }
        }