/// <summary>
 /// Get all providers.
 /// </summary>
 /// <returns>List<Provider></returns>
 public List<Provider> GetAllProviders()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Providers.ToList();
     }
 }
 public List<MedicationStregth> GetAllMedicationStrengths()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.MedicationStregths.ToList();
     }
 }
 public void UpdateProcedure(int procedureId, Procedure procedure)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var procedureToUpdate = GetProcedureById(procedure.PatientId, procedureId);
             if (procedureToUpdate != null)
             {
                 procedureToUpdate.Date                = procedure.Date;
                 procedureToUpdate.Notes               = procedure.Notes;
                 procedureToUpdate.PrimaryProviderId   = procedure.PrimaryProviderId;
                 procedureToUpdate.ProcedureName       = procedure.ProcedureName;
                 procedureToUpdate.SecondaryProviderId = procedure.SecondaryProviderId;
                 dataContext.Procedures.Attach(procedureToUpdate);
                 dataContext.Entry(procedureToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#4
0
 public void UpdateCondition(int patientNoteId, Condition condition)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var conditionToUpdate = GetConditionById(condition.PatientId, patientNoteId);
             if (conditionToUpdate != null)
             {
                 conditionToUpdate.Name      = condition.Name;
                 conditionToUpdate.Notes     = condition.Notes;
                 conditionToUpdate.Recovered = condition.Recovered;
                 conditionToUpdate.StartDate = condition.StartDate;
                 conditionToUpdate.EndDate   = condition.EndDate;
                 conditionToUpdate.Status    = condition.Status;
                 dataContext.Conditions.Attach(conditionToUpdate);
                 dataContext.Entry(conditionToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#5
0
 public List <BloodPressure> GetAllBloodPressureData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.BloodPressures.Where(i => i.PatientId == patientID && i.UniqueIdentifier == uniqueGuid).OrderBy(e => e.When).ToList());
     }
 }
示例#6
0
 public void UpdateBloodPressure(int patientNoteId, BloodPressure bloodPressure)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var bloodPressureToUpdate = GetBloodPressureById(bloodPressure.PatientId, patientNoteId);
             if (bloodPressureToUpdate != null)
             {
                 bloodPressureToUpdate.Systolic           = bloodPressure.Systolic;
                 bloodPressureToUpdate.Diastolic          = bloodPressure.Diastolic;
                 bloodPressureToUpdate.IrregularHeartbeat = bloodPressure.IrregularHeartbeat;
                 bloodPressureToUpdate.Pulse = bloodPressure.Pulse;
                 bloodPressureToUpdate.When  = bloodPressure.When;
                 dataContext.BloodPressures.Attach(bloodPressureToUpdate);
                 dataContext.Entry(bloodPressureToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void UpdateWeight(int weightId, Weight weight)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var weightToUpdate = GetWeightById(weight.PatientId, weightId);
             if (weightToUpdate != null)
             {
                 weightToUpdate.Date = weight.Date;
                 weightToUpdate.Weight1 = weight.Weight1;
                 weightToUpdate.WeightGoal = weight.WeightGoal;
                 dataContext.Weights.Attach(weightToUpdate);
                 dataContext.Entry(weightToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 /// <summary>
 /// Get all providers.
 /// </summary>
 /// <returns>List<Provider></returns>
 public List <Provider> GetAllProviders()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Providers.ToList());
     }
 }
示例#9
0
 public void UpdateHeight(int heightId, Height height)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var heightToUpdate = GetHeightById(height.PatientId, heightId);
             if (heightToUpdate != null)
             {
                 heightToUpdate.Date       = height.Date;
                 heightToUpdate.HeightFeet = height.HeightFeet;
                 heightToUpdate.HeightInch = height.HeightInch;
                 dataContext.Heights.Attach(heightToUpdate);
                 dataContext.Entry(heightToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public List<Insurance> GetAllInsuranceData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Insurances.Where(i => i.PatientId == patientID && i.UniqueIdentifier == uniqueGuid).OrderBy(e => e.ExpirationDate).ToList();
     }
 }
 public void UpdateBloodPressure(int patientNoteId, BloodPressure bloodPressure)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var bloodPressureToUpdate = GetBloodPressureById(bloodPressure.PatientId, patientNoteId);
             if (bloodPressureToUpdate != null)
             {
                 bloodPressureToUpdate.Systolic = bloodPressure.Systolic;
                 bloodPressureToUpdate.Diastolic = bloodPressure.Diastolic;
                 bloodPressureToUpdate.IrregularHeartbeat = bloodPressure.IrregularHeartbeat;
                 bloodPressureToUpdate.Pulse = bloodPressure.Pulse;
                 bloodPressureToUpdate.When = bloodPressure.When;
                 dataContext.BloodPressures.Attach(bloodPressureToUpdate);
                 dataContext.Entry(bloodPressureToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public List<MedicationTaken> GetAllMedicationTakens()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.MedicationTakens.ToList();
     }
 }
 public List <Patient> GetAllPatients()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Patients.ToList());
     }
 }
 public List<Medication> GetAllMedicationData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Medications.Where(i => i.PatientId == patientID).OrderBy(e => e.StartDate).ToList();
     }
 }
 public List<BloodPressure> GetAllBloodPressureData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.BloodPressures.Where(i => i.PatientId == patientID && i.UniqueIdentifier == uniqueGuid).OrderBy(e => e.When).ToList();
     }
 }
 public void UpdateContact(int contactId, Contact contact)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var contactToUpdate = GetContactById(contact.PatientId, contactId);
             if (contactToUpdate != null)
             {
                 contactToUpdate.City = contact.City;
                 contactToUpdate.Country = contact.Country;
                 contactToUpdate.EmailAddress = contact.EmailAddress;
                 contactToUpdate.IsPrimary = contact.IsPrimary;
                 contactToUpdate.Phone = contact.Phone;
                 contactToUpdate.PhoneType = contact.PhoneType;
                 contactToUpdate.StateOrProvince = contact.StateOrProvince;
                 contactToUpdate.StreetAddress1 = contact.StreetAddress1;
                 contactToUpdate.StreetAddress2 = contact.StreetAddress2;
                 contactToUpdate.StreetAddress3 = contact.StreetAddress3;
                 dataContext.Contacts.Attach(contactToUpdate);
                 dataContext.Entry(contactToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#17
0
 public List <Contact> GetAllContacts(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Contacts.Where(i => i.PatientId == patientID && i.UniqueIdentifier == uniqueGuid).ToList());
     }
 }
示例#18
0
 public void UpdateContact(int contactId, Contact contact)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var contactToUpdate = GetContactById(contact.PatientId, contactId);
             if (contactToUpdate != null)
             {
                 contactToUpdate.City            = contact.City;
                 contactToUpdate.Country         = contact.Country;
                 contactToUpdate.EmailAddress    = contact.EmailAddress;
                 contactToUpdate.IsPrimary       = contact.IsPrimary;
                 contactToUpdate.Phone           = contact.Phone;
                 contactToUpdate.PhoneType       = contact.PhoneType;
                 contactToUpdate.StateOrProvince = contact.StateOrProvince;
                 contactToUpdate.StreetAddress1  = contact.StreetAddress1;
                 contactToUpdate.StreetAddress2  = contact.StreetAddress2;
                 contactToUpdate.StreetAddress3  = contact.StreetAddress3;
                 dataContext.Contacts.Attach(contactToUpdate);
                 dataContext.Entry(contactToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#19
0
 public List <MedicationTaken> GetAllMedicationTakens()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.MedicationTakens.ToList());
     }
 }
示例#20
0
 public List <Medication> GetAllMedicationData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Medications.Where(i => i.PatientId == patientID).OrderBy(e => e.StartDate).ToList());
     }
 }
示例#21
0
 public List <MedicationStregth> GetAllMedicationStrengths()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.MedicationStregths.ToList());
     }
 }
示例#22
0
 public void UpdateDietaryIntake(int dietaryIntakeId, DietaryIntake dietaryIntake)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var dietaryIntakeToUpdate = GetDietaryIntakesById(dietaryIntake.PatientId, dietaryIntakeId);
             if (dietaryIntakeToUpdate != null)
             {
                 dietaryIntakeToUpdate.Calories = dietaryIntake.Calories;
                 dietaryIntakeToUpdate.Date     = dietaryIntake.Date;
                 dietaryIntakeToUpdate.Meal     = dietaryIntake.Meal;
                 dietaryIntakeToUpdate.Name     = dietaryIntake.Name;
                 dietaryIntakeToUpdate.Notes    = dietaryIntake.Notes;
                 dataContext.DietaryIntakes.Attach(dietaryIntakeToUpdate);
                 dataContext.Entry(dietaryIntakeToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void UpdateProcedure(int procedureId, Procedure procedure)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var procedureToUpdate = GetProcedureById(procedure.PatientId, procedureId);
             if (procedureToUpdate != null)
             {
                 procedureToUpdate.Date = procedure.Date;
                 procedureToUpdate.Notes = procedure.Notes;
                 procedureToUpdate.PrimaryProviderId = procedure.PrimaryProviderId;
                 procedureToUpdate.ProcedureName = procedure.ProcedureName;
                 procedureToUpdate.SecondaryProviderId = procedure.SecondaryProviderId;
                 dataContext.Procedures.Attach(procedureToUpdate);
                 dataContext.Entry(procedureToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public List<Patient> GetAllPatients()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Patients.ToList();
     }
 }
 public void UpdateInsurance(int insuranceId, Insurance insurance)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var insuranceToUpdate = GetInsuranceById(insurance.PatientId, insuranceId);
             if (insuranceToUpdate != null)
             {
                 insuranceToUpdate.PlanName = insurance.PlanName;
                 insuranceToUpdate.CoverageType = insurance.CoverageType;
                 insuranceToUpdate.IsPrimary = insurance.IsPrimary;
                 insuranceToUpdate.GroupNumber = insurance.GroupNumber;
                 insuranceToUpdate.SubscriberID = insurance.SubscriberID;
                 insuranceToUpdate.SubscriberDOB = insurance.SubscriberDOB;
                 insuranceToUpdate.SubscriberDate = insurance.SubscriberDate;
                 insuranceToUpdate.ExpirationDate = insurance.ExpirationDate;
                 dataContext.Insurances.Attach(insuranceToUpdate);
                 dataContext.Entry(insuranceToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public List<PatientNote> GetAllNotes(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.PatientNotes.Where(i => i.PatientId == patientID && i.UniqueIdentifier == uniqueGuid).ToList();
     }
 }
        /// <summary>
        /// Save Provider Record
        /// </summary>
        /// <param name="patient"></param>
        public void SaveProviderRecord(Provider provider)
        {
            using (var dataContext = new eHealthCareEntities())
            {
                try
                {
                    var patientFound = dataContext.Providers.FirstOrDefault(p => p.UserName == provider.UserName);
                    if (patientFound != null)
                    {
                        throw new Exception("User already exists!");
                    }

                    dataContext.Providers.Add(provider);
                    dataContext.SaveChanges();
                }
                catch (DbEntityValidationException ex)
                {
                    throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
                }
                catch
                {
                    throw;
                }
            }
        }
示例#28
0
 public List <Insurance> GetAllInsuranceData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Insurances.Where(i => i.PatientId == patientID && i.UniqueIdentifier == uniqueGuid).OrderBy(e => e.ExpirationDate).ToList());
     }
 }
 public void UpdatePatientNotes(int patientNoteId, PatientNote patientNote)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var patientNoteToUpdate = GetPatientNoteById(patientNote.PatientId, patientNoteId);
             if (patientNoteToUpdate != null)
             {
                 patientNoteToUpdate.Notes   = patientNote.Notes;
                 patientNoteToUpdate.Date    = patientNote.Date;
                 patientNoteToUpdate.Subject = patientNote.Subject;
                 dataContext.PatientNotes.Attach(patientNoteToUpdate);
                 dataContext.Entry(patientNoteToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void UpdateDietaryIntake(int dietaryIntakeId, DietaryIntake dietaryIntake)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var dietaryIntakeToUpdate = GetDietaryIntakesById(dietaryIntake.PatientId, dietaryIntakeId);
             if (dietaryIntakeToUpdate != null)
             {
                 dietaryIntakeToUpdate.Calories = dietaryIntake.Calories;
                 dietaryIntakeToUpdate.Date = dietaryIntake.Date;
                 dietaryIntakeToUpdate.Meal = dietaryIntake.Meal;
                 dietaryIntakeToUpdate.Name = dietaryIntake.Name;
                 dietaryIntakeToUpdate.Notes = dietaryIntake.Notes;
                 dataContext.DietaryIntakes.Attach(dietaryIntakeToUpdate);
                 dataContext.Entry(dietaryIntakeToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#31
0
 public List <Specialty> GetAllSpecialties()
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Specialties.ToList());
     }
 }
示例#32
0
 public void UpdateAppointment(int appointmentId, Appointment appointment)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var appoinmentToUpdate = GetAppointmentById(appointment.PatientId, appointmentId);
             if (appoinmentToUpdate != null)
             {
                 appoinmentToUpdate.ProviderId  = appointment.ProviderId;
                 appoinmentToUpdate.Purpose     = appointment.Purpose;
                 appoinmentToUpdate.SpecialtyId = appointment.SpecialtyId;
                 appoinmentToUpdate.StartDate   = appointment.StartDate;
                 appoinmentToUpdate.Type        = appointment.Type;
                 appoinmentToUpdate.EndDate     = appointment.EndDate;
                 dataContext.Entry(appoinmentToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#33
0
 public void UpdateStep(int stepId, Step step)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var stepToUpdate = GetStepById(step.PatientId, stepId);
             if (stepToUpdate != null)
             {
                 stepToUpdate.Date  = step.Date;
                 stepToUpdate.Steps = step.Steps;
                 dataContext.Steps.Attach(stepToUpdate);
                 dataContext.Entry(stepToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#34
0
 public void UpdateInsurance(int insuranceId, Insurance insurance)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var insuranceToUpdate = GetInsuranceById(insurance.PatientId, insuranceId);
             if (insuranceToUpdate != null)
             {
                 insuranceToUpdate.PlanName       = insurance.PlanName;
                 insuranceToUpdate.CoverageType   = insurance.CoverageType;
                 insuranceToUpdate.IsPrimary      = insurance.IsPrimary;
                 insuranceToUpdate.GroupNumber    = insurance.GroupNumber;
                 insuranceToUpdate.SubscriberID   = insurance.SubscriberID;
                 insuranceToUpdate.SubscriberDOB  = insurance.SubscriberDOB;
                 insuranceToUpdate.SubscriberDate = insurance.SubscriberDate;
                 insuranceToUpdate.ExpirationDate = insurance.ExpirationDate;
                 dataContext.Insurances.Attach(insuranceToUpdate);
                 dataContext.Entry(insuranceToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void UpdateHeight(int heightId, Height height)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var heightToUpdate = GetHeightById(height.PatientId, heightId);
             if (heightToUpdate != null)
             {
                 heightToUpdate.Date = height.Date;
                 heightToUpdate.HeightFeet = height.HeightFeet;
                 heightToUpdate.HeightInch = height.HeightInch;
                 dataContext.Heights.Attach(heightToUpdate);
                 dataContext.Entry(heightToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#36
0
 public List <Step> GetAllStepsData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Steps.Where(i => i.PatientId == patientID && i.UniqueIdentifier == uniqueGuid).OrderBy(e => e.Date).ToList());
     }
 }
 public void UpdateCondition(int patientNoteId, Condition condition)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var conditionToUpdate = GetConditionById(condition.PatientId, patientNoteId);
             if (conditionToUpdate != null)
             {
                 conditionToUpdate.Name = condition.Name;
                 conditionToUpdate.Notes = condition.Notes;
                 conditionToUpdate.Recovered = condition.Recovered;
                 conditionToUpdate.StartDate = condition.StartDate;
                 conditionToUpdate.EndDate = condition.EndDate;
                 conditionToUpdate.Status = condition.Status;
                 dataContext.Conditions.Attach(conditionToUpdate);
                 dataContext.Entry(conditionToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
示例#38
0
 public void UpdateWeight(int weightId, Weight weight)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var weightToUpdate = GetWeightById(weight.PatientId, weightId);
             if (weightToUpdate != null)
             {
                 weightToUpdate.Date       = weight.Date;
                 weightToUpdate.Weight1    = weight.Weight1;
                 weightToUpdate.WeightGoal = weight.WeightGoal;
                 dataContext.Weights.Attach(weightToUpdate);
                 dataContext.Entry(weightToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public List<Height> GetAllHeightData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Heights.Where(i => i.PatientId == patientID &&
             i.UniqueIdentifier == uniqueGuid).OrderBy(e => e.Date).ToList();
     }
 }
示例#40
0
 public Appointment GetAppointmentById(int patientID, int appointmentId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Appointments.Where(i => i.Id == appointmentId && i.PatientId == patientID &&
                                               i.UniqueIdentifier == uniqueGuid).FirstOrDefault());
     }
 }
示例#41
0
 public string GetSpecialtiyName(int specialtyId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         var specialty = dataContext.Specialties.FirstOrDefault(s => s.Id == specialtyId);
         return(specialty == null ? "" : specialty.SpecialityName);
     }
 }
示例#42
0
 public Guid GetPatientUniqueIdentifier(int patientId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         var appointment = dataContext.Appointments.FirstOrDefault(a => a.PatientId == patientId);
         return(appointment == null ? Guid.Empty : appointment.UniqueIdentifier);
     }
 }
示例#43
0
 public Insurance GetInsuranceById(int patientID, int insuranceId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Insurances.Where(i => i.Id == insuranceId && i.PatientId == patientID &&
                                             i.UniqueIdentifier == uniqueGuid).FirstOrDefault());
     }
 }
示例#44
0
 public Step GetStepById(int patientID, int stepId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Steps.Where(i => i.Id == stepId && i.PatientId == patientID &&
                                        i.UniqueIdentifier == uniqueGuid).FirstOrDefault());
     }
 }
 public BloodPressure GetBloodPressureById(int patientID, int bloodPressureId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.BloodPressures.Where(i => i.Id == bloodPressureId && i.PatientId == patientID &&
             i.UniqueIdentifier == uniqueGuid).FirstOrDefault();
     }
 }
 /// <summary>
 /// Get Provider Username, Password
 /// </summary>
 /// <param name="username">UserName</param>
 /// <param name="password">Password</param>
 /// <returns></returns>
 public Provider GetProviderByUserNamePassword(string username, string password)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         var provider = dataContext.Providers.FirstOrDefault(p => p.UserName == username && p.Password == password);
         return provider;
     }
 }
 public Condition GetConditionById(int patientID, int conditionId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Conditions.Where(i => i.Id == conditionId && i.PatientId == patientID &&
             i.UniqueIdentifier == uniqueGuid).FirstOrDefault();
     }
 }
 /// <summary>
 /// Get Patient Username, Password
 /// </summary>
 /// <param name="username">UserName</param>
 /// <param name="password">Password</param>
 /// <returns></returns>
 public Patient GetPatientByUserNamePassword(string username, string password)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         var patient = dataContext.Patients.FirstOrDefault(p => p.UserName == username && p.Password == password);
         return patient;
     }
 }
 public Insurance GetInsuranceById(int patientID, int insuranceId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Insurances.Where(i => i.Id == insuranceId && i.PatientId == patientID &&
             i.UniqueIdentifier == uniqueGuid).FirstOrDefault();
     }
 }
 public Height GetHeightById(int patientID, int heightId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Heights.Where(i => i.Id == heightId && i.PatientId == patientID &&
             i.UniqueIdentifier == uniqueGuid).FirstOrDefault();
     }
 }
 public Guid GetPatientUniqueIdentifier(int patientId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         var patient = dataContext.Patients.FirstOrDefault(a => a.PatientId == patientId);
         return patient == null ? Guid.Empty : patient.UniqueIdentifier;
     }
 }
 public Dicom GetDicomById(int patientID, int Id)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return dataContext.Dicoms.Where(i => i.Id == Id && i.PatientId == patientID &&
             i.UniqueIdentifier == uniqueGuid).FirstOrDefault();
     }
 }
 /// <summary>
 /// Get Provider By Id
 /// </summary>
 /// <param name="username">UserName</param>
 /// <param name="password">Password</param>
 /// <returns></returns>
 public string GetProviderById(int providerId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         var provider = dataContext.Providers.FirstOrDefault(p => p.Id == providerId);
         return provider.FirstName + " " + provider.LastName;
     }
 }
 /// <summary>
 /// Get Provider By Id
 /// </summary>
 /// <param name="username">UserName</param>
 /// <param name="password">Password</param>
 /// <returns></returns>
 public string GetProviderById(int providerId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         var provider = dataContext.Providers.FirstOrDefault(p => p.Id == providerId);
         return(provider.FirstName + " " + provider.LastName);
     }
 }
 /// <summary>
 /// Get Provider Username, Password
 /// </summary>
 /// <param name="username">UserName</param>
 /// <param name="password">Password</param>
 /// <returns></returns>
 public Provider GetProviderByUserNamePassword(string username, string password)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         var provider = dataContext.Providers.FirstOrDefault(p => p.UserName == username && p.Password == password);
         return(provider);
     }
 }
示例#56
0
 public Weight GetWeightById(int patientID, int weightId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return(dataContext.Weights.Where(i => i.Id == weightId && i.PatientId == patientID &&
                                          i.UniqueIdentifier == uniqueGuid).FirstOrDefault());
     }
 }
 public List<Weight> GetAllWeightData(int patientID)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         return (from w in dataContext.Weights
                 where w.PatientId == patientID && w.UniqueIdentifier == uniqueGuid
                 orderby w.Date descending
                 select w).ToList();
     }
 }
        /// <summary>
        /// Save Patient Record
        /// </summary>
        /// <param name="patient"></param>
        public void SavePatientRecord(Patient  patient)
        {
            using (var dataContext = new eHealthCareEntities())
            {
                var patientFound = dataContext.Patients.FirstOrDefault(p => p.UserName == patient.UserName);
                if (patientFound != null)
                    throw new Exception("User already exists!");

                dataContext.Patients.Add(patient);
                dataContext.SaveChanges();
            }
        }
 public void SavePatientNotes(PatientNote patientNotes)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.PatientNotes.Add(patientNotes);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void SaveHeight(Height height)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.Heights.Add(height);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }