Exemple #1
0
        public object AddNew()
        {
            CustomAppointment app = new CustomAppointment(this);

            List.Add(app);
            return(app);
        }
        private void schedulerStorage1_FetchAppointments(object sender, FetchAppointmentsEventArgs e)
        {
            DateTime start = e.Interval.Start;
            DateTime end   = e.Interval.End;

            CustomEventList actualDataSource = this.schedulerStorage1.Appointments.DataSource as CustomEventList;

            if (actualDataSource == null)
            {
                return;
            }

            // Check if the requested interval is outside lastFetchedInterval
            if (start <= lastFetchedInterval.Start || end >= lastFetchedInterval.End)
            {
                // You can vary margin value to find the most appropriate balance between performance and detalization
                TimeSpan margin = TimeSpan.FromDays(0); // TimeSpan.FromDays(1)
                lastFetchedInterval = new TimeInterval(start - margin, end + margin);

                // Poplate the actualDataSource using the lastFetchedInterval
                actualDataSource.Clear();
                for (int i = 0; i < fullDataSource.Count; i++)
                {
                    CustomAppointment customAppointment = fullDataSource[i];

                    if (customAppointment.StartTime >= lastFetchedInterval.Start.Date &&
                        customAppointment.EndTime <= lastFetchedInterval.End.Date)
                    {
                        actualDataSource.Add(customAppointment);
                    }
                }
            }

            lblInfo.Text = string.Format("Interval: {0}, Appointments: {1}", lastFetchedInterval, actualDataSource.Count.ToString());
        }
        CustomAppointment CreateEvent(CustomEventList eventList, string subject, object resourceId, int status, int label)
        {
            CustomAppointment apt = new CustomAppointment(eventList);

            apt.Subject = subject;
            apt.OwnerId = resourceId;
            Random rnd            = RandomInstance;
            int    rangeInMinutes = 60 * 24;

            apt.StartTime = DateTime.Today + TimeSpan.FromHours(rnd.Next(0, rangeInMinutes));
            apt.EndTime   = apt.StartTime + TimeSpan.FromMinutes(60);
            apt.Status    = status;
            apt.Label     = label;
            return(apt);
        }
Exemple #4
0
 public int IndexOf(CustomAppointment appointment)
 {
     return(List.IndexOf(appointment));
 }
Exemple #5
0
 public void Add(CustomAppointment appointment)
 {
     base.List.Add(appointment);
 }