public void OnSetTimeMarkerCommandExecuted(object parameter) { Appointment appointment = this.SelectedAppointment as Appointment; TimeMarker newTimeMarker = parameter as TimeMarker; IExceptionOccurrence exceptionToEdit = null; if (!(this.SelectedAppointment is Appointment)) { appointment = (this.SelectedAppointment as Occurrence).Master as Appointment; if (appointment.RecurrenceRule != null) { exceptionToEdit = appointment.RecurrenceRule.Exceptions.SingleOrDefault(e => (e.Appointment as IOccurrence) == ((Telerik.Windows.Controls.ScheduleView.Occurrence)(this.SelectedAppointment)).Appointment); if (exceptionToEdit != null) { appointment.RecurrenceRule.Exceptions.Remove(exceptionToEdit); (exceptionToEdit.Appointment as Appointment).TimeMarker = newTimeMarker; appointment.RecurrenceRule.Exceptions.Add(exceptionToEdit); } } } Appointment appointmentToEdit = (from app in this.Appointments where app.Equals(appointment) select app).FirstOrDefault(); if (exceptionToEdit == null) { appointmentToEdit.TimeMarker = newTimeMarker; } var index = this.Appointments.IndexOf(appointmentToEdit); this.Appointments.Remove(appointmentToEdit); this.Appointments.Insert(index, appointmentToEdit); }
public IExceptionOccurrence CreateNew(IExceptionOccurrence item) { var sqlExceptionOccurrence = this.CreateNew(); sqlExceptionOccurrence.CopyFrom(item); return(sqlExceptionOccurrence); }
public void CopyFrom(IExceptionOccurrence other) { if (this.GetType().FullName != other.GetType().FullName) throw new ArgumentException("Invalid type"); this.ExceptionDate = other.ExceptionDate; if (other.Appointment != null) this.Appointment = other.Appointment.Copy(); }
public void CopyFrom(IExceptionOccurrence other) { if (this.GetType().FullName != other.GetType().FullName) { throw new ArgumentException("Invalid type"); } this.ExceptionDate = other.ExceptionDate; if (other.Appointment != null) { this.Appointment = other.Appointment.Copy(); } }
public IExceptionOccurrence CreateNew(IExceptionOccurrence item) { var sqlExceptionOccurrence = this.CreateNew(); sqlExceptionOccurrence.CopyFrom(item); return sqlExceptionOccurrence; }