public void IsInvalid_Time() { var now = DateTime.Now; var item = new AppointmentDto() { EndTime = now, StartTime = now.AddHours(4), Subject = Guid.NewGuid().ToString(), }; Assert.IsFalse(item.IsValid()); }
public void IsInvalid_Subject() { var now = DateTime.Now; var item = new AppointmentDto() { EndTime = now.AddHours(4), StartTime = now, Subject = string.Empty, }; Assert.IsFalse(item.IsValid()); }
public void IsValid() { var now = DateTime.Now; var item = new AppointmentDto() { EndTime = now.AddHours(4), StartTime = now, Subject = Guid.NewGuid().ToString(), Tag = new TagDto(TagCategory.Appointment) { Id = 14 }, }; Assert.IsTrue(item.IsValid()); }
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); }
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); }
public void Remove(AppointmentDto meeting, LightPatientDto patient) { new Remover(this.Session).Remove(meeting, patient); }
/// <summary> /// Creates the specified appointment and use create it in Google Calendar if the binding is active. /// </summary> /// <param name="appointment">The appointment.</param> /// <param name="patient">The patient.</param> /// <param name="config">The config.</param> public void Create(AppointmentDto appointment, LightPatientDto patient, GoogleConfiguration config) { var patientEntity = this.Session.Get<Patient>(patient.Id); var meetingEntity = Mapper.Map<AppointmentDto, Appointment>(appointment); meetingEntity.GoogleSynchronisationId = (config.IsActive) ? Guid.NewGuid() //This id allows to find Google appointments : new Guid(); //Empty Guid indicates this appointments is not binded with Google Calendar meetingEntity.User = this.Session.Get<User>(meetingEntity.User.Id); patientEntity.Appointments.Add(meetingEntity); this.Session.SaveOrUpdate(patientEntity); if (config.IsActive) { new GoogleService(config).AddAppointment(meetingEntity); } }
/// <summary> /// Creates the specified meeting. /// </summary> /// <param name="appointment">The meeting.</param> /// <param name="patient">The patient.</param> public void Create(AppointmentDto appointment, LightPatientDto patient) { var patientEntity = this.Session.Get<Patient>(patient.Id); var meetingEntity = Mapper.Map<AppointmentDto, Appointment>(appointment); patientEntity.Appointments.Add(meetingEntity); this.Session.SaveOrUpdate(patientEntity); }
private void AddAppointment() { try { var appointment = new AppointmentDto() { StartTime = this.SelectedSlot.StartTime, EndTime = this.SelectedSlot.EndTime, Subject = string.Format("{0} - {1}", this.SelectedAppointmentTag.Name, this.SelectedPatient.DisplayedName), User = PluginContext.Host.ConnectedUser, Tag = this.SelectedAppointmentTag, }; this.Component.Create(appointment, this.SelectedPatient, new PluginSettings().GetGoogleConfiguration()); PluginContext.Host.WriteStatus(StatusType.Info, Messages.Msg_AppointmentAdded); this.Close(); } catch (Exception ex) { this.Handle.Error(ex); } }