/// <summary> /// Adds the specified doctor to the specified patient. /// </summary> /// <param name="patient">The patient.</param> /// <param name="doctor">The doctor.</param> /// <exception cref="EntityNotFoundException">If there's no link between the doctor and the patient</exception> public void AddDoctorTo(LightPatientDto patient, LightDoctorDto doctor) { var patientEntity = this.Session.Get<Patient>(patient.Id); var doctorEntity = this.Session.Get<Doctor>(doctor.Id); new Updator(this.Session).AddDoctorTo(patientEntity, doctorEntity); }
/// <summary> /// Initializes a new instance of the <see cref="FamilyDto"/> class. /// </summary> /// <param name="current">The current.</param> /// <param name="father">The father.</param> /// <param name="mother">The mother.</param> /// <param name="children">The children.</param> public FamilyDto(LightPatientDto current, LightPatientDto father, LightPatientDto mother, LightPatientDto[] children) { this.Current = current; this.Father = father; this.Mother = mother; this.Children = new ObservableCollection <LightPatientDto>(children); }
/// <summary> /// Initializes a new instance of the <see cref="FamilyDto"/> class. /// </summary> /// <param name="current">The current.</param> /// <param name="father">The father.</param> /// <param name="mother">The mother.</param> /// <param name="children">The children.</param> public FamilyDto(LightPatientDto current, LightPatientDto father, LightPatientDto mother, LightPatientDto[] children) { this.Current = current; this.Father = father; this.Mother = mother; this.Children = new ObservableCollection<LightPatientDto>(children); }
/// <summary> /// Adds the specified tag to the specified patient. /// </summary> /// <param name="patient">The light patient dto.</param> /// <param name="tag">The search tag dto.</param> public void AddTagTo(LightPatientDto patient, SearchTagDto tag) { var entity = (from p in this.Session.Query<Patient>() where p.Id == patient.Id select p).Single(); var eTag = Mapper.Map<SearchTagDto, SearchTag>(tag); entity.SearchTags.Add(eTag); this.Session.Save(entity); }
/// <summary> /// Adds the new child to the specified patient. /// Under the hood, the child will receive the specifed /// patient as a father or a mother depending on the gender /// of the patient. /// </summary> /// <param name="patient">The patient.</param> /// <param name="child">The child.</param> public void AddNewChild(LightPatientDto patient, LightPatientDto child) { if (patient.Id == child.Id) { throw new BusinessLogicException("You try to add a patient as his/her child or parent", Messages.Ex_CirularLinkFamily); } var ePatient = this.Session.Load<Patient>(patient.Id); var eChild = this.Session.Load<Patient>(child.Id); switch (ePatient.Gender) { case Gender.Male: eChild.Father = ePatient; break; case Gender.Female: eChild.Mother = ePatient; break; default: Assert.FailOnEnumeration(eChild.Gender); break; } this.Session.Update(eChild); }
/// <summary> /// Gets all the search tags that are not binded to the specified patient /// </summary> /// <param name="patient">The patient.</param> /// <returns>The tags that are not assigned to the patient</returns> public IEnumerable<SearchTagDto> GetNotAssignedTagsOf(LightPatientDto patient) { var ids = this.Session .Get<Patient>(patient.Id) .SearchTags .Select(e => e.Id) .ToList(); var eTags = (from t in this.Session.Query<SearchTag>() where !ids.Contains(t.Id) select t).ToList(); return Mapper.Map<IEnumerable<SearchTag>, IEnumerable<SearchTagDto>>(eTags); }
private void WriteStatus(LightPatientDto value) { var name = string.Format("{0} {1}", value.FirstName, value.LastName); this.WriteStatus(StatusType.Info, Messages.Msg_SelectPatient.FormatWith(name)); }
/// <summary> /// Gets the doctors (with full data) linked to the specified patient. /// </summary> /// <param name="patient">The patient.</param> /// <returns>A list of doctors</returns> public IEnumerable<DoctorDto> GetFullDoctorOf(LightPatientDto patient) { var entity = this.Session.Get<Patient>(patient.Id); if (entity.Doctors != null) { return Mapper.Map<IList<Doctor>, IList<DoctorDto>>(entity.Doctors); } else { return new List<DoctorDto>(); } }
/// <summary> /// Updates the thumbnail of the specified patient. /// </summary> /// <param name="patientDto">The patient dto.</param> /// <param name="thumbnail">The byte array representing the thumbnail of the patient.</param> public void UpdateThumbnail(LightPatientDto patientDto, byte[] thumbnail) { var entity = (from p in this.Session.Query<Patient>() where p.Id == patientDto.Id select p).Single(); entity.Thumbnail = thumbnail; this.Session.Update(entity); }
public void Remove(AppointmentDto meeting, LightPatientDto patient, GoogleConfiguration config) { var entity = this.Session.Get<Appointment>(meeting.Id); if (config.IsActive) { new GoogleService(config).RemoveAppointment(entity); } this.Remove(meeting, patient); }
/// <summary> /// Gets the search tags of the specified patient. /// </summary> /// <param name="patient">The selected patient.</param> /// <returns> /// An enumeration of search tags /// </returns> public IEnumerable<SearchTagDto> GetSearchTagsOf(LightPatientDto patient) { var entity = this.Session.Get<Patient>(patient.Id); return Mapper.Map<IEnumerable<SearchTag>, IEnumerable<SearchTagDto>>(entity.SearchTags.ToList()); }
/// <summary> /// Removes the link that existed between the specified patient and the specified doctor. /// </summary> /// <exception cref="EntityNotFoundException">If there's no link between the doctor and the patient</exception> /// <param name="patient">The patient.</param> /// <param name="doctor">The doctor.</param> public void RemoveDoctorFor(LightPatientDto patient, LightDoctorDto doctor) { new Remover(this.Session).Remove(doctor, patient); }
/// <summary> /// With this method, I manage exception of the component and let <see cref="AssertionException"/> /// be managed as fatal error /// </summary> private void AddParent(LightPatientDto selectedPatient, LightPatientDto selectedMember) { try { this.Component.AddNewParent(selectedPatient, selectedMember); } catch (Exception ex) { this.Handle.Error(ex); } }
/// <summary> /// Gets the illness history for the specified patient. /// </summary> /// <param name="patient">The patient.</param> /// <returns> /// The history of illness periods /// </returns> public IllnessHistoryDto GetIllnessHistory(LightPatientDto patient) { var illnessHistory = new IllnessHistoryDto() { Patient = patient }; var entity = this.Session.Get<Patient>(patient.Id); var periods = Mapper.Map<IList<IllnessPeriod>, IList<IllnessPeriodDto>>(entity.IllnessHistory); illnessHistory.Periods.Refill(periods); return illnessHistory; }
protected Action(IPatientDataComponent component, LightPatientDto patient) { this.Component = component; this.Patient = patient; }
public AddThumbnailAction(IPatientDataComponent component, LightPatientDto patient, byte[] thumbnail) : base(component, patient) { this.Thumbnail = thumbnail; }
public UnbindDoctorAction(IPatientDataComponent component, LightPatientDto patient, LightDoctorDto doctor) : base(component, patient, doctor) { }
public void Create(AppointmentDto appointment, LightPatientDto patient, GoogleConfiguration config) { new Creator(this.Session).Create(appointment, patient, config); }
public void Create(AppointmentDto meeting, LightPatientDto patient) { new Creator(this.Session).Create(meeting, patient); }
/// <summary> /// Gets the doctors that can be linked to the specified doctor. /// </summary> /// <param name="patient">The patient.</param> /// <param name="criteria">The criteria.</param> /// <param name="on">Indicate where the search should be executed.</param> /// <returns> /// A list of doctor /// </returns> public IEnumerable<LightDoctorDto> GetNotLinkedDoctorsFor(LightPatientDto patient, string criteria, SearchOn searchOn) { var patientEntity = this.Session.Get<Patient>(patient.Id); List<Doctor> result = new List<Doctor>(); if (criteria == "*") { result = this.GetAllDoctors(); } else { switch (searchOn) { case SearchOn.FirstName: result = this.SearchDoctorOnFirstName(criteria); break; case SearchOn.LastName: result = this.SearchDoctorOnLastName(criteria); break; case SearchOn.FirstAndLastName: result = this.SearchDoctorOnFirstNameAndLastName(criteria); break; default: Assert.FailOnEnumeration(searchOn); break; } } result = this.RemoveDoctorsOfPatient(result, patientEntity); return Mapper.Map<IList<Doctor>, IList<LightDoctorDto>>(result); }
/// <summary> /// Gets all the appointments between the specified start and end threshold for the specified patient. /// </summary> /// <param name="patient">The patient.</param> /// <param name="startThreshold">The start threshold.</param> /// <param name="endThreshold">The end threshold.</param> /// <returns></returns> public IList<AppointmentDto> GetAppointments(LightPatientDto patient, DateTime startThreshold, DateTime endThreshold) { var result = this.GetAppointments(patient); return (from r in result where r.StartTime >= startThreshold && r.EndTime <= endThreshold.AddDays(1) select r).ToList(); }
/// <summary> /// Loads all the data of the patient. /// </summary> /// <param name="patient">The patient to load.</param> /// <returns>A DTO with the whole data</returns> /// <exception cref="Probel.NDoctor.Domain.DAL.Exceptions.EntityNotFoundException">If the patient doesn't exist</exception> public PatientDto GetPatient(LightPatientDto patient) { return this.GetPatientById(patient.Id); }
/// <summary> /// Gets all the appointments of the specified patient. /// </summary> /// <param name="patient">The patient.</param> /// <returns></returns> public IList<AppointmentDto> GetAppointments(LightPatientDto patient) { var entity = this.Session.Get<Patient>(patient.Id); return Mapper.Map<IList<Appointment>, IList<AppointmentDto>>(entity.Appointments); }
/// <summary> /// Determines whether the specified patient has the specified doctor. /// </summary> /// <param name="patient">The patient.</param> /// <param name="doctor">The doctor.</param> /// <returns> /// <c>true</c> if the specified patient has the doctor; otherwise, <c>false</c>. /// </returns> public bool HasDoctor(LightPatientDto patient, LightDoctorDto doctor) { var entity = (from p in this.Session.Query<Patient>() where p.Id == patient.Id select p).Single(); return (from d in entity.Doctors where d.Id == doctor.Id select d).Count() > 0; }
/// <summary> /// Removes the specified illness period from the specified patient's /// illness history. /// </summary> /// <param name="illnessPeriod">The illness period.</param> /// <param name="patient">The patient.</param> public void Remove(IllnessPeriodDto illnessPeriod, LightPatientDto patient) { new Remover(this.Session).Remove(illnessPeriod, patient); }
/// <summary> /// Removes the specified tasks for the specified patient. /// </summary> /// <param name="patient">The patient.</param> /// <param name="toRemove">The tasks to remove.</param> public void RemoveTasksFor(LightPatientDto patient, IEnumerable<SearchTagDto> toRemove) { if (toRemove != null) { var ePatient = this.Session.Get<Patient>(patient.Id); var ids = toRemove.Select(e => e.Id); var tags = (from t in ePatient.SearchTags where !ids.Contains(t.Id) select t).ToList(); ePatient.SearchTags = tags; this.Session.Update(ePatient); } else { return; } }
/// <summary> /// Creates the specified illness period for the specified patient. /// </summary> /// <param name="period">The period.</param> /// <param name="patient">The patient.</param> public void Create(IllnessPeriodDto period, LightPatientDto patient) { new Creator(this.Session).Create(period, patient); }
/// <summary> /// Gets the ilness as a chart. That's a X/Y axes chart when X axes is /// </summary> /// <param name="patient">The patient used to create the chart.</param> /// <returns> /// A <see cref="Chart"/> with X axes as pathology name and Y axes /// as <see cref="TimeSpan"/> for the duration of the illness. /// </returns> public Chart<string, double> GetIlnessAsChart(LightPatientDto patient) { var entity = this.Session.Get<Patient>(patient.Id); var result = (from ih in entity.IllnessHistory group ih by new { Id = ih.Pathology.Id, Name = ih.Pathology.Name } into grp select new { Name = grp.Key.Name, TotalDays = grp.Sum(e => e.Duration.TotalDays) }).Take(10); var chart = new Chart<string, double>(); foreach (var item in result) { chart.AddPoint(item.Name, item.TotalDays); } return chart; }
public void Remove(AppointmentDto meeting, LightPatientDto patient) { new Remover(this.Session).Remove(meeting, patient); }
/// <summary> /// Binds the specified tags to the specified patient. /// </summary> /// <param name="patient">The patient.</param> /// <param name="tags">The tags.</param> public void BindTagsTo(LightPatientDto patient, IEnumerable<SearchTagDto> tags) { var ids = tags.Select(e => e.Id).ToList(); var ePatient = this.Session.Get<Patient>(patient.Id); var eTags = (from t in this.Session.Query<SearchTag>() where ids.Contains(t.Id) select t).ToList(); foreach (var t in eTags) { ePatient.SearchTags.Add(t); } this.Session.Update(ePatient); }
/// <summary> /// Removes the specified illness period list from the specified patient's /// illness history. /// </summary> /// <param name="illnessPeriods">The illness periods.</param> /// <param name="patient">The patient.</param> public void Remove(IList<IllnessPeriodDto> illnessPeriods, LightPatientDto patient) { new Remover(this.Session).Remove(illnessPeriods, patient); }