AppointmentBaseCollection PrepareAppointmentsToSelect(XPAppointment[] rows)
        {
            AppointmentBaseCollection appoitnments = new AppointmentBaseCollection();

            for (int i = 0; i < rows.Length; i++)
            {
                Appointment apt = FindAppointmentByRow(rows[i]);
                if (apt != null)
                {
                    switch (apt.Type)
                    {
                    case AppointmentType.Pattern:
                        TimeIntervalCollection    tiCollection  = schedulerControl1.ActiveView.GetVisibleIntervals();
                        OccurrenceCalculator      calc          = OccurrenceCalculator.CreateInstance(apt.RecurrenceInfo);
                        AppointmentBaseCollection aptCollection = calc.CalcOccurrences(tiCollection.Interval, apt);
                        appoitnments.AddRange(aptCollection);
                        break;

                    case AppointmentType.DeletedOccurrence:
                        break;

                    default:
                        appoitnments.Add(apt);
                        break;
                    }
                }
            }
            return(appoitnments);
        }
コード例 #2
0
        private float CalcCurrentWorkTimeLoad(AppointmentBaseCollection apts, TimeInterval interval, Resource resource)
        {
            AppointmentBaseCollection aptsByResource = new AppointmentBaseCollection();
            var aptQuery = apts.Where(a => a.ResourceId.Equals(resource.Id));

            aptsByResource.AddRange(aptQuery.ToList());

            IntervalLoadRatioCalculator calc = new IntervalLoadRatioCalculator(interval, aptsByResource);

            return(calc.Calculate());
        }
        public static AppointmentBaseCollection GenerateAppointmentsPerDay(AppointmentBaseCollection sourceCollection)
        {
            AppointmentBaseCollection aptsPerDaysCollection = new AppointmentBaseCollection();

            foreach (Appointment item in sourceCollection)
            {
                if (item.SameDay)
                {
                    aptsPerDaysCollection.Add(item);
                }
                else
                {
                    aptsPerDaysCollection.AddRange(DivideApointments(item));
                }
            }

            return(aptsPerDaysCollection);
        }