/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { // The activity will forward the AppointmentId referecned appointment only to not-responding attendees with ReminderText as a forward var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var appointment = AppointmentHelper.GetAppointmentById(service, context.GetValue(AppointmentId)); if (appointment == null) { return; } var toRemind = new List <EmailAddress>(); toRemind.AddRange( appointment .RequiredAttendees .Where(x => x.ResponseType == MeetingResponseType.Unknown || x.ResponseType == MeetingResponseType.NoResponseReceived)); toRemind.AddRange( appointment .OptionalAttendees .Where(x => x.ResponseType == MeetingResponseType.Unknown || x.ResponseType == MeetingResponseType.NoResponseReceived)); // Remind if any if (toRemind.Count > 0) { appointment.Forward(context.GetValue(ReminderText), toRemind); } }
private void AppointmentInformationDialog_Load(object sender, EventArgs e) { this.appointmentTime.DataSource = AppointmentHelper.GetAppointmentTimeslots(); this.appointmentDate.MinDate = DateTime.Now.AddDays(1.0); string time = this.appointmentDTO.AppointmentDateTime.TimeOfDay.ToString(); if (time.Equals("00:00:00")) { time = AppointmentHelper.GetAppointmentTimeslots()[0].Value; } this.firstNameText.Text = this.patient.FirstName; this.lastNameText.Text = this.patient.LastName; this.genderText.Text = this.patient.Gender; this.dobText.Text = this.patient.DateOfBirth.Value.ToShortDateString(); this.appointmentTime.SelectedIndex = AppointmentHelper.GetAppointmentTimeslots().FindIndex(x => x.Value == time); this.appointmentVisitReason.Text = this.appointmentDTO.ReasonForVisit; this.appointmentDate.Value = this.appointmentDTO.AppointmentDateTime.Date; this.selectedAppointmentDateTime = this.appointmentDTO.AppointmentDateTime; if (this.doctor != null) { this.availableDoctors = doctorController.GetAvailableDoctorsOnDate(this.appointmentDTO.AppointmentDateTime); this.availableDoctors.Add(doctor); this.availableDoctorsComboBox.DataSource = this.availableDoctors; this.availableDoctorsComboBox.SelectedIndex = this.availableDoctors.FindIndex(x => x.DoctorId == appointmentDTO.DoctorID); } }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var appointmentData = context.GetValue(Appointment) ?? GetAppointmentFromParameters(context); var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var recurrMeeting = new Appointment(service) { Subject = appointmentData.Subject, Body = new MessageBody(appointmentData.IsBodyHtml ? BodyType.HTML : BodyType.Text, appointmentData.Body), Start = appointmentData.StartTime, End = appointmentData.EndTime, Location = appointmentData.Subject, Recurrence = appointmentData.Recurrence }; var requiredAttendees = context.GetValue(RequiredAttendees); var optionalAttendees = context.GetValue(OptionalAttendees); AppointmentHelper.UpdateAttendees(recurrMeeting, requiredAttendees, optionalAttendees); // This method results in in a CreateItem call to EWS. recurrMeeting.Save(SendInvitationsMode.SendToAllAndSaveCopy); context.SetValue(AppointmentId, recurrMeeting.Id); }
private void AddRemoveAttachments_Load(object sender, EventArgs e) { // btnInsertFileAttachment.Enabled = _AllowAddDeleteAttachments; // btnDeleteFileAttachment.Enabled = _AllowAddDeleteAttachments; AppointmentHelper.LoadFileAttachmentsLv(_Item, ref lvFileAttachments); }
private void AddEventAttendees(IEnumerable <Attendee> recipients, Event googleEvent, bool optional) { IEnumerable <Attendee> recipeintList = recipients as IList <Attendee> ?? recipients.Take(maxAttendees).ToList(); if (!recipeintList.Any() && googleEvent == null) { return; } foreach (var recipient in recipeintList) { //Ignore recipients with invalid Email if (!recipient.Email.IsValidEmailAddress()) { continue; } var eventAttendee = new EventAttendee { DisplayName = recipient.Name, Email = recipient.Email, Optional = optional, ResponseStatus = AppointmentHelper.GetGoogleResponseStatus(recipient.MeetingResponseStatus) }; googleEvent.Attendees.Add(eventAttendee); } }
private void EditNurseDialog_Load(object sender, EventArgs e) { this.stateComboBox.DataSource = AppointmentHelper.GetStates().ToList(); this.genderComboBox.DataSource = AppointmentHelper.GetGenders().ToList(); this.dateOfBirthDateTimePicker.MaxDate = DateTime.Now.AddYears(-18); this.dateOfBirthDateTimePicker.Value = this.nurse.DateOfBirth.Value; this.stateComboBox.SelectedIndex = AppointmentHelper.GetStates().FindIndex(x => x.Value.Equals(nurse.State, StringComparison.InvariantCultureIgnoreCase)); this.genderComboBox.SelectedIndex = AppointmentHelper.GetGenders().FindIndex(x => x.Value.Equals(nurse.Gender, StringComparison.InvariantCultureIgnoreCase)); this.firstNameTextBox.Text = nurse.FirstName; this.lastNameTextBox.Text = nurse.LastName; this.cityTextBox.Text = nurse.City; this.streetTextBox.Text = nurse.Street; this.contactPhoneTextBox.Text = nurse.ContactPhone; this.zipTextBox.Text = nurse.Zip; this.ssnTextBox.Text = nurse.SSN; this.usernameTextBox.Text = nurse.Username; this.passwordTextBox.Text = nurse.Password; this.isActiveCheckbox.Checked = nurse.IsActiveNurse; this.passwordViewer.Visible = false; ssnError.Text = ""; firstnameError.Text = ""; lastNameError.Text = ""; contactPhoneError.Text = ""; streetError.Text = ""; cityError.Text = ""; usernameError.Text = ""; passwordError.Text = ""; zipCodeError.Text = ""; errors = new Dictionary <string, string>(); }
private void AppointmentDate_ValueChanged(object sender, EventArgs e) { this.appointmentTime.DataSource = AppointmentHelper.GetAppointmentTimeslots(); if (appointmentTime.Enabled == false) { appointmentTime.Enabled = true; } }
private void TestPerformedDateTimePicker_ValueChanged(object sender, EventArgs e) { this.testTime.DataSource = AppointmentHelper.GetAppointmentTimeslots(); if (testTime.Enabled == false) { testTime.Enabled = true; } }
private void AddNurse_Load(object sender, EventArgs e) { this.dateOfBirthDateTimePicker.MaxDate = DateTime.Now.AddYears(-18); this.dateOfBirthDateTimePicker.Value = this.dateOfBirthDateTimePicker.MaxDate; this.stateComboBox.DataSource = AppointmentHelper.GetStates().ToList(); this.genderComboBox.DataSource = AppointmentHelper.GetGenders().ToList(); this.stateComboBox.SelectedIndex = 0; this.genderComboBox.SelectedIndex = 0; }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var continueOnError = context.GetValue(ContinueOnError); var attendees = AppointmentHelper.ResolveAttendeeNames(service, context.GetValue(AttendeeNames), continueOnError); context.SetValue(Attendees, attendees.ToArray()); }
public void LoadAppointentByIdTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); DateTime.TryParse("10-Jun-2019", out var start); var meeting = AppointmentHelper.GetAppointmentBySubject(service, "Item1", start); AppointmentHelper.GetAppointmentById(service, meeting.Id.ToString()); Assert.AreEqual(1, 1); }
private void btnAttendeeStatus_Click(object sender, EventArgs e) { string s = AppointmentHelper.GetAttendeeStatusAsInfoString(_Appointment); ShowTextDocument oForm = new ShowTextDocument(); oForm.Text = "Attendee Status"; oForm.txtEntry.Text = s; oForm.ShowDialog(); oForm = null; }
public void LoadAppointentBySubjTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); var subj = "Item1"; DateTime.TryParse("10-Jun-2019", out var start); AppointmentHelper.GetAppointmentBySubject(service, subj, start); Assert.AreEqual(1, 1); }
private void SetTestTime() { this.testTime.DataSource = AppointmentHelper.GetAppointmentTimeslots(); string time = this.selectedLabOrderTestDTO.TestDate.TimeOfDay.ToString(); if (time.Equals("00:00:00")) { time = AppointmentHelper.GetAppointmentTimeslots()[0].Value; } this.testTime.SelectedIndex = AppointmentHelper.GetAppointmentTimeslots().FindIndex(x => x.Value == time); this.testTime.Enabled = false; }
public void LoadResponseByIdTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); var subj = "Item1"; DateTime.TryParse("10-Jun-2019", out var start); var meeting = AppointmentHelper.GetAppointmentBySubject(service, subj, start); AppointmentHelper.GetAttendeesById(service, meeting.Id.ToString(), MeetingAttendeeType.Required); Assert.AreEqual(1, 1); }
public void ResolveNamesTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); string[] testNames = { "Obfuscated attendee1", "Obfuscated attendee2" }; var attendees = AppointmentHelper.ResolveAttendeeNames(service, testNames, true); foreach (var item in attendees) { Console.WriteLine(item.Name + "::" + item.Address); } }
public void LoadAppointmentsTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); DateTime.TryParse("10-Jun-2019", out var start); var meeting = AppointmentHelper.GetAppointmentBySubject(service, "Item1", start); var appointments = AppointmentHelper.GetAppointmentsById(service, meeting.Id.ToString()); foreach (var item in appointments) { Console.WriteLine(item.AppointmentType.ToString()); } }
public async Task <Unit> Handle(UpdateAppointmentCommand request, CancellationToken cancellationToken) { var appointment = await this.context.Appointments .SingleOrDefaultAsync(c => c.Id == request.Id && c.IsDeleted != true, cancellationToken); if (appointment == null) { throw new NotFoundException(GConst.Appointment, request.Id); } var service = await this.context.Services.FindAsync(request.ServiceId); if (service == null || service.IsDeleted == true) { throw new UpdateFailureException(GConst.Appointment, request.Id, string.Format(GConst.RefereceException, GConst.ServiceLower, request.ServiceId)); } var employee = await this.context.Employees.FindAsync(request.EmployeeId); if (employee == null || employee.IsDeleted == true) { throw new UpdateFailureException(GConst.Appointment, request.Id, string.Format(GConst.RefereceException, GConst.EmployeeLower, request.EmployeeId)); } // Set Time request.ReservationTime = DateTime.Parse(request.TimeBlockHelper); // CheckWorkingHours DateTime start = request.ReservationDate.Add(request.ReservationTime.Value.TimeOfDay); DateTime end = request.ReservationDate.Add(request.ReservationTime.Value.TimeOfDay).AddMinutes(double.Parse(this.context.EmployeeServices.Find(employee.Id, service.Id).DurationInMinutes)); if (!AppointmentHelper.IsInWorkingHours(this.context, employee, start, end)) { throw new UpdateFailureException(GConst.Appointment, request.TimeBlockHelper, string.Format(GConst.InvalidAppointmentHourException, employee.Location.StartHour, employee.Location.EndHour)); } ; appointment.ReservationTime = request.ReservationTime.Value; appointment.ReservationDate = request.ReservationDate; appointment.TimeBlockHelper = request.TimeBlockHelper; appointment.Comment = request.Comment; appointment.ServiceId = request.ServiceId; appointment.EmployeeId = request.EmployeeId; appointment.ModifiedOn = DateTime.UtcNow; this.context.Appointments.Update(appointment); await this.context.SaveChangesAsync(cancellationToken); return(Unit.Value); }
private void ClearForm() { appointmentVisitReason.Text = ""; reasonForVisitError.Text = ""; this.appointmentTime.DataSource = AppointmentHelper.GetAppointmentTimeslots(); this.appointmentTime.SelectedIndex = -1; GetAvailableDoctors(this.selectedAppointmentDateTime); this.doctorListComboBox.SelectedIndex = -1; this.firstNameLabel.Text = ""; this.lastNameLabel.Text = ""; this.genderLabel.Text = ""; this.dobLabel.Text = ""; doctorListError.Text = ""; appointmentDateError.Text = ""; }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var service = ExchangeHelper.GetService( context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); // GetMaster Item // Bind to all RequiredAttendees. var meeting = Appointment.Bind(service, new ItemId(context.GetValue(AppointmentId)), AppointmentHelper.GetAttendeesPropertySet()); AppointmentHelper.UpdateAttendees(meeting, context.GetValue(RequiredAttendees), context.GetValue(OptionalAttendees)); // Save and Send Updates meeting.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendOnlyToChanged); }
private void GetAttendees(Event googleEvent, List <Attendee> recipients, bool isOptional) { if (googleEvent != null && googleEvent.Attendees != null) { var attendees = googleEvent.Attendees.Where(attendee => attendee.Optional.GetValueOrDefault() == isOptional); foreach (var eventAttendee in attendees) { recipients.Add(new Attendee { Name = eventAttendee.DisplayName, Email = eventAttendee.Email, MeetingResponseStatus = AppointmentHelper.GetGoogleResponseStatus(eventAttendee.ResponseStatus) }); } } }
private void cmsItemsAttendeeStatus_Click(object sender, EventArgs e) { if (lvItems.SelectedItems.Count > 0) { string sInfo = string.Empty; ItemTag oItemTag = (ItemTag)this.lvItems.SelectedItems[0].Tag; oItemTag = (ItemTag)lvItems.SelectedItems[0].Tag; _CurrentService.ClientRequestId = Guid.NewGuid().ToString(); // Set a new GUID Appointment oAppointment = Appointment.Bind(_CurrentService, oItemTag.Id); string s = AppointmentHelper.GetAttendeeStatusAsInfoString(oAppointment); ShowTextDocument oForm = new ShowTextDocument(); oForm.Text = "Attendee Status"; oForm.txtEntry.Text = s; oForm.ShowDialog(); oForm = null; } }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); Appointment meeting; var id = context.GetValue(AppointmentId); if (string.IsNullOrEmpty(id)) { var start = DateTime.Parse(context.GetValue(AppointmentDate)); meeting = AppointmentHelper.GetAppointmentBySubject(service, context.GetValue(Subject), start); } else { meeting = AppointmentHelper.GetAppointmentById(service, id); } context.SetValue(FoundAppointment, meeting); }
public void AttachedAppointmentTest() { DateTime.TryParse("06-July-2019", out var testStartDate); var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); var appointment = AppointmentHelper.GetAppointmentBySubject(service, "AppointmentAttachmentCheck1", testStartDate); if (appointment != null) { var toRemind = AppointmentHelper.GetAttendeesById(service, appointment.Id.ToString(), MeetingAttendeeType.Required) .Where(x => x.ResponseType == MeetingResponseType.Unknown || x.ResponseType == MeetingResponseType.NoResponseReceived) .Select(attendee => (EmailAddress)attendee.Address) .ToList(); // remind if any if (toRemind.Count > 0) { appointment.Forward("Please resond to an attached invitation", toRemind); } } Assert.AreNotEqual(1, 2); }
/* * * * Loads booking slots based on the datetime dynamically by calliing database * * */ private void checkUpDateTXT_ValueChanged(object sender, EventArgs e) { NoteTXT.Text = ""; bookingSlotTXT.Items.Clear(); bookingSlotTXT.Text = ""; List <string> bookingSlots = AppointmentHelper.getCheckupSlots(checkUpDateTXT.Value); List <string> bookedSlots = new List <string>(); if (bookingSlots.Count != 0) { bookedSlots = AppointmentHelper. bookedCheckupSlots(new DateTime(bookingDate.Year, bookingDate.Month, bookingDate.Day)); } List <string> availableSlots = bookingSlots.Except(bookedSlots).ToList(); if (availableSlots.Count == 0) { NoteTXT.Text = "Note: Slots not available for this day. Please select next day"; } if (availableSlots.Count == 0 && checkUpDateTXT.Value.CompareTo(DateTime.Now.AddDays(7)) <= 0) { DayOfWeek dayOfWeek = DateTime.Now.AddDays(8).DayOfWeek; if (dayOfWeek == DayOfWeek.Saturday) { dayOfWeek = DateTime.Now.AddDays(10).DayOfWeek; } else if (dayOfWeek == DayOfWeek.Sunday) { dayOfWeek = DateTime.Now.AddDays(9).DayOfWeek; } NoteTXT.Text = "Note: You can not book slots this week. Try to select from " + dayOfWeek.ToString() + " of next week"; } bookingSlotTXT.Items.AddRange(availableSlots.ToArray()); }
/* * * Loads the booking slots based on the availability * * */ private void bookingDateTXT_ValueChanged(object sender, EventArgs e) { bookingSlotTXT.Items.Clear(); bookingSlotTXT.Text = ""; List <string> bookingSlots = AppointmentHelper.getEmergencySlots(bookingDateTXT.Value); List <string> bookedSlots = new List <string>(); if (bookingSlots.Count != 0) { bookedSlots = AppointmentHelper. bookedCheckupSlots(new DateTime(bookingDate.Year, bookingDate.Month, bookingDate.Day)); } List <string> availableSlots = bookingSlots.Except(bookedSlots).ToList(); if (availableSlots.Count == 0) { NoteTXT.Text = "Note: Slots not available for this day. Please select next day"; } bookingSlotTXT.Items.AddRange(availableSlots.ToArray()); }
public void PopulateTextBoxes(UserDTO aPatient) { this.dateOfBirthDateTimePicker.MaxDate = DateTime.Now; this.stateComboBox.DataSource = AppointmentHelper.GetStates().ToList(); this.genderComboBox.DataSource = AppointmentHelper.GetGenders().ToList(); this.stateComboBox.SelectedIndex = 0; this.genderComboBox.SelectedIndex = 0; if (aPatient.PatientId > 0) { this.isNewPatient = false; this.addNewPatientLabel.Visible = false; this.updatePatientLabel.Visible = true; this.firstNameTextBox.Text = aPatient.FirstName; this.lastNameTextBox.Text = aPatient.LastName; this.dateOfBirthDateTimePicker.Value = aPatient.DateOfBirth.Value; this.contactPhoneTextBox.Text = aPatient.ContactPhone; this.cityTextBox.Text = aPatient.City; this.genderComboBox.SelectedIndex = AppointmentHelper.GetGenders().FindIndex(x => x.Value.Equals(aPatient.Gender, StringComparison.InvariantCultureIgnoreCase)); this.stateComboBox.SelectedIndex = AppointmentHelper.GetStates().FindIndex(x => x.Value.Equals(aPatient.State, StringComparison.InvariantCultureIgnoreCase)); this.streetTextBox.Text = aPatient.Street; this.zipTextBox.Text = aPatient.Zip; this.ssnTextBox.Text = String.IsNullOrWhiteSpace(aPatient.SSN) ? "" : aPatient.SSN; patient = new Patient(aPatient.PatientId, aPatient.Id, true); patientAddress = new Address(aPatient.AddressId, aPatient.Street, aPatient.City, aPatient.State, aPatient.Zip); patientPerson = new Person(aPatient.Id, "", "", aPatient.FirstName, aPatient.LastName, aPatient.DateOfBirth.Value, aPatient.SSN, aPatient.Gender, aPatient.AddressId, aPatient.ContactPhone); } else { this.isNewPatient = true; this.addNewPatientLabel.Visible = true; this.updatePatientLabel.Visible = false; newPatientAddressId = null; newPersonId = null; this.dateOfBirthDateTimePicker.Value = this.dateOfBirthDateTimePicker.MaxDate; } }
private Appointment CreateAppointment(Event googleEvent) { Appointment appointment; if (googleEvent.Start.DateTime == null && googleEvent.End.DateTime == null) { appointment = new Appointment(googleEvent.Description, googleEvent.Location, googleEvent.Summary, DateTime.Parse(googleEvent.End.Date), DateTime.Parse(googleEvent.Start.Date), googleEvent.Id) { AllDayEvent = true }; } else { appointment = new Appointment(googleEvent.Description, googleEvent.Location, googleEvent.Summary, googleEvent.End.DateTime, googleEvent.Start.DateTime, googleEvent.Id); } if (googleEvent.Reminders != null) { if (!googleEvent.Reminders.UseDefault.GetValueOrDefault() && googleEvent.Reminders.Overrides != null) { appointment.ReminderSet = true; appointment.ReminderMinutesBeforeStart = googleEvent.Reminders.Overrides.First().Minutes.GetValueOrDefault(); } } //Getting Additional Data appointment.BusyStatus = googleEvent.Transparency != null && googleEvent.Transparency.Equals("transparent") ? BusyStatusEnum.Free : BusyStatusEnum.Busy; appointment.Privacy = AppointmentHelper.GetSensitivityEnum(googleEvent.Visibility); appointment.CalendarId = CalendarId; if (googleEvent.ExtendedProperties != null && googleEvent.ExtendedProperties.Private__ != null) { foreach (var property in googleEvent.ExtendedProperties.Private__) { appointment.ExtendedProperties.Add(property.Key, property.Value); } } appointment.Created = googleEvent.Created; appointment.LastModified = googleEvent.Updated; if (googleEvent.Organizer != null) { //Add Organizer appointment.Organizer = new Attendee { Name = googleEvent.Organizer.DisplayName, Email = googleEvent.Organizer.Email }; } //Add Required Attendee GetAttendees(googleEvent, appointment.RequiredAttendees, false); //Add optional Attendee GetAttendees(googleEvent, appointment.OptionalAttendees, true); return(appointment); }
/// <summary> /// </summary> /// <param name="syncProfile"></param> /// <param name="sourceList"></param> /// <param name="destinationList"></param> /// <param name="destAppointmentsToDelete"></param> /// <param name="destAppointmentsToUpdate"></param> /// <param name="sourceAppointmentsToUpdate"></param> /// <param name="destOrphanEntries"></param> /// <returns> /// </returns> private void EvaluateAppointmentsToDelete(CalendarSyncProfile syncProfile, AppointmentsWrapper sourceList, AppointmentsWrapper destinationList, List <Appointment> destAppointmentsToDelete, List <Appointment> destAppointmentsToUpdate, List <Appointment> sourceAppointmentsToUpdate, List <Appointment> destOrphanEntries) { var addDescription = syncProfile.CalendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.Description); var addReminders = syncProfile.CalendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.Reminders); var addAttendeesToDescription = syncProfile.CalendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.AttendeesToDescription); if (!destinationList.Any()) { foreach (var appointment in sourceList) { if (appointment.ChildId != null) { var key = AppointmentHelper.GetChildEntryKey(sourceList.CalendarId); if (!appointment.ExtendedProperties.ContainsKey(key)) { appointment.ExtendedProperties.Remove(key); } sourceAppointmentsToUpdate.AddCompareForUpdate(appointment); } } return; } foreach (var destAppointment in destinationList) { //If SourceId is null, it is not a copy of any entry from the selected source calendar if (destAppointment.SourceId == null) { if (syncProfile.SyncMode == SyncModeEnum.OneWay) { //If mode is one way & user has disabled delete, do not remove this entry, as this is an original entry in the calendar //Else this entry is not a copy of any appointment in source calendar so delete it destOrphanEntries.Add(destAppointment); } else { if (destAppointment.ChildId == null) { var childAppointment = sourceList.FirstOrDefault(t => destAppointment.CompareSourceId(t)); if (childAppointment != null) { destAppointment.ChildId = childAppointment.AppointmentId; var key = childAppointment.GetChildEntryKey(); if (!destAppointment.ExtendedProperties.ContainsKey(key)) { destAppointment.ExtendedProperties.Add(key, childAppointment.AppointmentId); } else { destAppointment.ExtendedProperties[key] = childAppointment.AppointmentId; } destAppointmentsToUpdate.AddCompareForUpdate(destAppointment); } } else if (syncProfile.SyncSettings.KeepLastModifiedVersion) { var childAppointment = sourceList.FirstOrDefault(t => t.AppointmentId.Equals(destAppointment.ChildId)); if (childAppointment == null) { destAppointmentsToDelete.Add(destAppointment); } } } } else { //If the mode is two way, look for its parent copy in Source calendar Appointment sourceAppointment; if (syncProfile.SyncMode == SyncModeEnum.TwoWay && syncProfile.SyncSettings.KeepLastModifiedVersion) { //If no entry was found, it is original entry of the calendar, Ignore //If a child entry is found in source calendar, compare sourceAppointment = sourceList.FirstOrDefault(t => t.CompareSourceId(destAppointment)); if (sourceAppointment != null) { //If any entry is found in source appointment and its contents are not equal to source appointment, //If an entry is found and i same, ignore if (!CompareAppointments(destAppointment, sourceAppointment, addDescription, addReminders, addAttendeesToDescription)) { if (sourceAppointment.LastModified.HasValue && destAppointment.LastModified.HasValue) { if (destAppointment.LastModified.GetValueOrDefault() > sourceAppointment.LastModified.GetValueOrDefault()) { sourceAppointment.CopyDetail(destAppointment, syncProfile.CalendarEntryOptions); sourceAppointmentsToUpdate.AddCompareForUpdate(sourceAppointment); continue; } } //Destination Calendar Entry is not Matching its Source Calendar Entry, Update it destAppointment.CopyDetail(sourceAppointment, syncProfile.CalendarEntryOptions); destAppointmentsToUpdate.AddCompareForUpdate(destAppointment); continue; } } } //If source appointment is not null, means it is a copy of an existing entry in Source calendar sourceAppointment = sourceList.FirstOrDefault(t => t.CompareSourceId(destAppointment)); if (sourceAppointment != null) { //If any entry is found in source appointment and its contents are not equal to source appointment if (!CompareAppointments(destAppointment, sourceAppointment, addDescription, addReminders, addAttendeesToDescription)) { destAppointment.CopyDetail(sourceAppointment, syncProfile.CalendarEntryOptions); destAppointmentsToUpdate.AddCompareForUpdate(destAppointment); } } else { //No parent entry is found, delete it sourceAppointment = sourceList.FirstOrDefault(t => CompareAppointments(destAppointment, t, addDescription, addReminders, addAttendeesToDescription)); if (sourceAppointment == null) { //If parent entry isn't found destAppointmentsToDelete.Add(destAppointment); } } } } }
public AppointmentController() { _appointmentHelper = new AppointmentHelper(); }