Beispiel #1
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;
         }
     }
 }
Beispiel #2
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;
         }
     }
 }
 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;
         }
     }
 }
        /// <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;
                }
            }
        }
Beispiel #5
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 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 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;
         }
     }
 }
Beispiel #8
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;
         }
     }
 }
Beispiel #9
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 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 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;
         }
     }
 }
Beispiel #12
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;
         }
     }
 }
Beispiel #13
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;
         }
     }
 }
Beispiel #14
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 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 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;
         }
     }
 }
 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;
         }
     }
 }
Beispiel #18
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;
         }
     }
 }
 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;
         }
     }
 }
        /// <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();
            }
        }
        /// <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();
            }
        }
Beispiel #22
0
 public void SaveMedication(Medication medication)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             medication.UniqueIdentifier = this.uniqueGuid;
             dataContext.Medications.Add(medication);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
     }
 }
Beispiel #23
0
 public void SaveWeight(Weight weight)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.Weights.Add(weight);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void SaveDietaryIntake(DietaryIntake dietaryIntake)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.DietaryIntakes.Add(dietaryIntake);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void SaveInsurance(Insurance insurance)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.Insurances.Add(insurance);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
Beispiel #26
0
 public void SaveDietaryIntake(DietaryIntake dietaryIntake)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.DietaryIntakes.Add(dietaryIntake);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
Beispiel #27
0
 public void SaveSteps(Step step)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.Steps.Add(step);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 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;
         }
     }
 }
 public void SaveCondition(Condition condition)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.Conditions.Add(condition);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 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 SaveProcedure(Procedure procedure)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.Procedures.Add(procedure);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void SaveProcedure(Procedure procedure)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.Procedures.Add(procedure);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
Beispiel #34
0
 public void SaveInsurance(Insurance insurance)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.Insurances.Add(insurance);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
Beispiel #35
0
 public void SaveBloodPressure(BloodPressure bloodPressure)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             bloodPressure.UniqueIdentifier = this.uniqueGuid;
             dataContext.BloodPressures.Add(bloodPressure);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
Beispiel #36
0
 public void SaveDicom(Dicom dicom)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dicom.UniqueIdentifier = uniqueGuid;
             dataContext.Dicoms.Add(dicom);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void SaveDicom(Dicom dicom)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dicom.UniqueIdentifier = uniqueGuid;
             dataContext.Dicoms.Add(dicom);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
Beispiel #38
0
 public void SaveAppointment(Appointment appointment)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             appointment.UniqueIdentifier = uniqueGuid;
             dataContext.Appointments.Add(appointment);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
Beispiel #39
0
 public void Upload(AudioAppointment audioAppointment)
 {
     try
     {
         using (var dataContext = new eHealthCareEntities())
         {
             audioAppointment.UniqueIdentifier = this.uniqueGuid;
             dataContext.AudioAppointments.Add(audioAppointment);
             dataContext.SaveChanges();
         }
     }
     catch (DbEntityValidationException ex)
     {
         throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
     }
     catch
     {
         throw;
     }
 }
 public void SaveBloodPressure(BloodPressure bloodPressure)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             bloodPressure.UniqueIdentifier = this.uniqueGuid;
             dataContext.BloodPressures.Add(bloodPressure);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void DeletePatientNotes(int patientID, int patientNoteId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var patientNoteToDelete = GetPatientNoteById(patientID, patientNoteId);
             dataContext.PatientNotes.Attach(patientNoteToDelete);
             dataContext.PatientNotes.Remove(patientNoteToDelete);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void DeletePatientNotes(int patientID, int patientNoteId)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var patientNoteToDelete = GetPatientNoteById(patientID, patientNoteId);
             dataContext.PatientNotes.Attach(patientNoteToDelete);
             dataContext.PatientNotes.Remove(patientNoteToDelete);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
        /// <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;
                }
            }
        }
Beispiel #44
0
 public void DeleteMedication(int patientID, int medId)
 {
     try
     {
         var medication = GetMedicationById(patientID, medId);
         if (medication != null)
         {
             using (var dataContext = new eHealthCareEntities())
             {
                 dataContext.Medications.Attach(medication);
                 dataContext.Medications.Remove(medication);
                 dataContext.SaveChanges();
             }
         }
     }
     catch (DbEntityValidationException ex)
     {
         throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
     }
     catch
     {
         throw;
     }
 }
 public void DeleteDicom(int patientID, int Id)
 {
     try
     {
         var dicom = GetDicomById(patientID, Id);
         if (dicom != null)
         {
             using (var dataContext = new eHealthCareEntities())
             {
                 dataContext.Dicoms.Attach(dicom);
                 dataContext.Dicoms.Remove(dicom);
                 dataContext.SaveChanges();
             }
         }
     }
     catch (DbEntityValidationException ex)
     {
         throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
     }
     catch
     {
         throw;
     }
 }
Beispiel #46
0
 public void DeleteDicom(int patientID, int Id)
 {
     try
     {
         var dicom = GetDicomById(patientID, Id);
         if (dicom != null)
         {
             using (var dataContext = new eHealthCareEntities())
             {
                 dataContext.Dicoms.Attach(dicom);
                 dataContext.Dicoms.Remove(dicom);
                 dataContext.SaveChanges();
             }
         }
     }
     catch (DbEntityValidationException ex)
     {
         throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
     }
     catch
     {
         throw;
     }
 }
 public void DeleteMedication(int patientID, int medId)
 {
     try
     {
         var medication = GetMedicationById(patientID, medId);
         if (medication != null)
         {
             using (var dataContext = new eHealthCareEntities())
             {
                 dataContext.Medications.Attach(medication);
                 dataContext.Medications.Remove(medication);
                 dataContext.SaveChanges();
             }
         }
     }
     catch (DbEntityValidationException ex)
     {
         throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
     }
     catch
     {
         throw;
     }
 }
Beispiel #48
0
 public void DeleteAppointment(int patientID, int appointmentId)
 {
     try
     {
         var appointment = GetAppointmentById(patientID, appointmentId);
         if (appointment != null)
         {
             using (var dataContext = new eHealthCareEntities())
             {
                 dataContext.Appointments.Attach(appointment);
                 dataContext.Appointments.Remove(appointment);
                 dataContext.SaveChanges();
             }
         }
     }
     catch (DbEntityValidationException ex)
     {
         throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
     }
     catch
     {
         throw;
     }
 }
Beispiel #49
0
 public void UpdateMedication(int medicationId, Medication medication)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var medicationToUpdate = GetMedicationById(medication.PatientId, medicationId);
             if (medicationToUpdate != null)
             {
                 medicationToUpdate.DoseText        = medication.DoseText;
                 medicationToUpdate.DoseUnit        = medication.DoseUnit;
                 medicationToUpdate.HowTaken        = medication.HowTaken;
                 medicationToUpdate.MedicationName  = medication.MedicationName;
                 medicationToUpdate.Notes           = medication.Notes;
                 medicationToUpdate.ReasonForTaking = medication.ReasonForTaking;
                 medicationToUpdate.StrengthText    = medication.StrengthText;
                 medicationToUpdate.StrengthUnit    = medication.StrengthUnit;
                 if (medication.EndDate != null)
                 {
                     medicationToUpdate.EndDate = medication.EndDate;
                 }
                 dataContext.Medications.Attach(medicationToUpdate);
                 dataContext.Entry(medicationToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void DeleteAudioAppointment(int patientID, int appointmentId)
 {
     try
     {
         var appointment = GetAudioAppointment(patientID, appointmentId);
         if (appointment != null)
         {
             using (var dataContext = new eHealthCareEntities())
             {
                 dataContext.AudioAppointments.Attach(appointment);
                 dataContext.AudioAppointments.Remove(appointment);
                 dataContext.SaveChanges();
             }
         }
     }
     catch (DbEntityValidationException ex)
     {
         throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
     }
     catch
     {
         throw;
     }
 }
Beispiel #51
0
 public void UpdateAppointmentStatus(int appointmentId, int patientID, string status)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var appoinmentToUpdate = GetAppointmentById(patientID, appointmentId);
             if (appoinmentToUpdate != null)
             {
                 appoinmentToUpdate.Status = status;
                 dataContext.Entry(appoinmentToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void SaveAppointment(Appointment appointment)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             appointment.UniqueIdentifier = uniqueGuid;
             dataContext.Appointments.Add(appointment);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 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;
         }
     }
 }
 public void UpdateAppointmentStatus(int appointmentId, int patientID, string status)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var appoinmentToUpdate = GetAppointmentById(patientID, appointmentId);
             if (appoinmentToUpdate != null)
             {
                 appoinmentToUpdate.Status = status;
                 dataContext.Entry(appoinmentToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void UpdateMedication(int medicationId, Medication medication)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var medicationToUpdate = GetMedicationById(medication.PatientId, medicationId);
             if (medicationToUpdate != null)
             {
                 medicationToUpdate.DoseText = medication.DoseText;
                 medicationToUpdate.DoseUnit = medication.DoseUnit;
                 medicationToUpdate.HowTaken = medication.HowTaken;
                 medicationToUpdate.MedicationName = medication.MedicationName;
                 medicationToUpdate.Notes = medication.Notes;
                 medicationToUpdate.ReasonForTaking = medication.ReasonForTaking;
                 medicationToUpdate.StrengthText = medication.StrengthText;
                 medicationToUpdate.StrengthUnit = medication.StrengthUnit;
                 if (medication.EndDate != null)
                     medicationToUpdate.EndDate = medication.EndDate;
                 dataContext.Medications.Attach(medicationToUpdate);
                 dataContext.Entry(medicationToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 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 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;
         }
     }
 }
 public void Upload(AudioAppointment audioAppointment)
 {
     try
     {
         using (var dataContext = new eHealthCareEntities())
         {
             audioAppointment.UniqueIdentifier = this.uniqueGuid;
             dataContext.AudioAppointments.Add(audioAppointment);
             dataContext.SaveChanges();
         }
     }
     catch (DbEntityValidationException ex)
     {
         throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
     }
     catch
     {
         throw;
     }
 }
 public void SaveMedication(Medication medication)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             medication.UniqueIdentifier = this.uniqueGuid;
             dataContext.Medications.Add(medication);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
     }
 }