Esempio n. 1
0
        protected bool Equals(ServiceHolder other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;

            //They are equal if the ServiceIds are equal or if the OccurDate and the RecurringServiceIds are equal
            return (ExistingServiceId.HasValue && ExistingServiceId.Equals(other.ExistingServiceId)) ||
                (OccurDate.Equals(other.OccurDate) &&
                RecurringServiceId.HasValue && RecurringServiceId.Equals(other.RecurringServiceId));
        }
Esempio n. 2
0
 /// <summary>
 /// Create a new ServiceHolder object.
 /// </summary>
 /// <param name="occurDate">Initial value of the OccurDate property.</param>
 public static ServiceHolder CreateServiceHolder(global::System.DateTime occurDate)
 {
     ServiceHolder serviceHolder = new ServiceHolder();
     serviceHolder.OccurDate = occurDate;
     return serviceHolder;
 }
 /// <summary>
 /// An empty method to allow creating ServiceHolders on the client.
 /// </summary>
 public void InsertServiceHolder(ServiceHolder serviceHolder)
 {
     throw new Exception("Cannot save ServiceHolders in the database.");
 }
Esempio n. 4
0
        /// <summary>
        /// Sets up the ServiceHolder on this RouteTask 
        /// Also, sets up tracking changes on that ServiceHolder and moving those changes to the RouteTask
        /// </summary>
        private void InitializeHelper()
        {
            //Initialize the ServiceHolder
            ServiceHolder = new ServiceHolder { ExistingServiceId = ServiceId, OccurDate = Date, RecurringServiceId = RecurringServiceId };

            //Follow property changes and update the ServiceHolder
            this.FromAnyPropertyChanged().Where(e => e.PropertyName == "OccurDate" || e.PropertyName == "RecurringServiceId" || e.PropertyName == "ServiceId")
            .Throttle(TimeSpan.FromMilliseconds(100)).ObserveOnDispatcher().Subscribe(_ =>
            {
                ServiceHolder.OccurDate = this.Date;
                ServiceHolder.RecurringServiceId = this.RecurringServiceId;
                ServiceHolder.ExistingServiceId = this.ServiceId;
            });

            //Follow any ServiceHolder property changes and update this RouteTask
            this.ServiceHolder.FromAnyPropertyChanged().Where(e => e.PropertyName == "OccurDate" || e.PropertyName == "RecurringServiceId" || e.PropertyName == "ExistingServiceId")
            .Throttle(TimeSpan.FromMilliseconds(100)).ObserveOnDispatcher().Subscribe(_ =>
            {
                this.Date = ServiceHolder.OccurDate;
                this.RecurringServiceId = ServiceHolder.RecurringServiceId;
                this.ServiceId = ServiceHolder.ExistingServiceId;
            });
        }