예제 #1
0
 public List<VisitBDO> GetAllVisits()
 {
     List<VisitBDO> Visits = null;
     VisitBDO VisitBDO = null;
     using (var PHEntities = new PublicHospitalEntities())
     {
         var listInDb = (from d in PHEntities.Visit
                         select d).ToList();
         if (listInDb != null)
         {
             Visits = new List<VisitBDO>();
             VisitBDO = new VisitBDO();
             foreach (Visit VisitObj in listInDb)
             {
                 if (VisitObj != null)
                 {
                     VisitBDO = new VisitBDO()
                     {
                         id = VisitObj.Ap_Id,
                         patientProblem = VisitObj.patientProblem,
                         symptom = VisitObj.symptom,
                         advice = VisitObj.advice,
                         rowVersion = VisitObj.rowVersion
                     };
                     Visits.Add(VisitBDO);
                 }
             }
         }
     }
     return Visits;
 }
예제 #2
0
 public AppointmentBDO(int id, DateTime time, string serviceType,
 PatientBDO patient, DoctorBDO doctor, VisitBDO visit)
 {
     this.id = id;
     this.time = time;
     this.serviceType = serviceType;
     this.patient = patient;
     this.doctor = doctor;
     this.visit = visit;
 }
예제 #3
0
 public VisitBDO GetVisit(int id)
 {
     VisitBDO VisitBDO = null;
     using (var PHEntities = new PublicHospitalEntities())
     {
         var VisitObj = (from v in PHEntities.Visit
                               where v.Ap_Id == id
                               select v).FirstOrDefault();
         if (VisitObj != null)
             VisitBDO = new VisitBDO()
             {
                 id = VisitObj.Ap_Id,
                 patientProblem = VisitObj.patientProblem,
                 symptom = VisitObj.symptom,
                 advice = VisitObj.advice,
                 rowVersion = VisitObj.rowVersion
             };
     }
     return VisitBDO;
 }
예제 #4
0
 public bool InsertVisit(ref VisitBDO VisitBDO,
     ref string massage)
 {
     massage = "Visit inserted successfully";
     var ret = true;
     using (var PHEntities = new PublicHospitalEntities())
     {
         PHEntities.Visit.Add(new Visit
         {
             Ap_Id = VisitBDO.id,
             advice = VisitBDO.advice,
             symptom = VisitBDO.symptom,
             patientProblem = VisitBDO.patientProblem,
             rowVersion = VisitBDO.rowVersion
         });
         var num = PHEntities.SaveChanges();
         if (num != 1)
         {
             ret = false;
             massage = "Visit was not inserted";
         }
     }
     return ret;
 }
예제 #5
0
 public bool UpdateVisit(ref VisitBDO VisitBDO)
 {
     var ret = true;
     using (var PHEntites = new PublicHospitalEntities())
     {
         var VisitId = VisitBDO.id;
         var VisitInDb = (from a
                          in PHEntites.Visit
                                where a.Ap_Id == VisitId
                                select a).FirstOrDefault();
         if (VisitInDb == null)
         {
             throw new Exception("No Visit with id " +
                                 VisitBDO.id);
         }
         VisitInDb.Ap_Id = VisitBDO.id;
         VisitInDb.advice = VisitBDO.advice;
         VisitInDb.symptom = VisitBDO.symptom;
         VisitInDb.patientProblem = VisitBDO.patientProblem;
         VisitInDb.rowVersion = VisitBDO.rowVersion;
         //without username and pass
         PHEntites.Visit.Attach(VisitInDb);
         PHEntites.Entry(VisitInDb).State = System.Data.Entity.EntityState.Modified;
         var num = PHEntites.SaveChanges();
         VisitBDO.rowVersion = VisitInDb.rowVersion;
         if (num != 1)
         {
             ret = false;
         }
     }
     return ret;
 }