private void schedulerStorage1_FetchAppointments(object sender, FetchAppointmentsEventArgs e) { if (_initializing) { return; } DateTime start = e.Interval.Start; DateTime end = e.Interval.End; // Check if the requested interval is outside the lastFetchedInterval if (start <= lastFetchedInterval.Start || end >= lastFetchedInterval.End) { lastFetchedInterval = new TimeInterval(start - TimeSpan.FromDays(31), end + TimeSpan.FromDays(31)); WIN.SCHEDULING_APPLICATION.HANDLERS.AppointmentHandler h = new WIN.SCHEDULING_APPLICATION.HANDLERS.AppointmentHandler(); IList <IsearchDTO> dtos = new List <IsearchDTO>(); dtos.Add(new PeriodAppointmentDTO(PeriodAppointmentDTO.PeriodAppointmentDTOEnum.Periodo, new WIN.BASEREUSE.DataRange(lastFetchedInterval.Start, lastFetchedInterval.End), true, false)); h.ExecuteQuery(dtos, -1, Properties.Settings.Default.Main_DeadlineDaysBefore); schedulerStorage1.Appointments.DataSource = h.BindableResults; //schedulerStorage1.RefreshData(); } //else // schedulerStorage1.RefreshData(); }
private void OnAppointmentsFetch(object sender, FetchAppointmentsEventArgs e) { DateTime start = e.Interval.Start; DateTime end = e.Interval.End; if (isDirty || !lastFetchedInterval.Contains(e.Interval) || lastFetchedResource != Filter.Current.User) { isDirty = false; lastFetchedInterval = new TimeInterval( start - TimeSpan.FromDays(7), end + TimeSpan.FromDays(7)); lastFetchedResource = Filter.Current.User; schedulerControl.Enabled = false; dateNavigator.Enabled = false; gridControl.Enabled = false; try { Fill(lastFetchedInterval, Filter.Current.User, Program.Service); } finally { schedulerControl.Enabled = true; dateNavigator.Enabled = true; gridControl.Enabled = true; } } }
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()); }
public static object FetchAppointmentsHelperMethod(FetchAppointmentsEventArgs args) { args.ForceReloadAppointments = true; SchedulingDataClassesDataContext db = new SchedulingDataClassesDataContext(); return(db.DBAppointments.Where(e => e.StartDate > args.Interval.Start && e.EndDate < args.Interval.End)); }
public static List <CustomAppointment> FetchAppointmentsMethod(FetchAppointmentsEventArgs args) { args.ForceReloadAppointments = true; List <CustomAppointment> initialDataSource = HttpContext.Current.Session["AppointmentsList"] as List <CustomAppointment>; List <CustomAppointment> fetchedData = initialDataSource.Where(appt => args.Interval.Contains(appt.StartTime) || args.Interval.Contains(appt.EndTime)).ToList(); return(fetchedData); }
private void SchedulerDataStorage1_FetchAppointments(object sender, FetchAppointmentsEventArgs e) { Console.WriteLine($"FetchAppointments {e.Interval}"); if (allEvents != null) { var events = allEvents.Where(ev => ev.Start <e.Interval.End && ev.End> e.Interval.Start).ToList(); Console.WriteLine($"Returning {events.Count()} appointments"); bindingSource1.DataSource = events; } }
private void QueryAppointmentDataSource(FetchAppointmentsEventArgs e, ResourceBaseCollection resources) { string resListString = String.Join(",", resources.Select(res => res.Id.ToString())); // Modify the FillBy query to fetch appointments only for the specified resources. appointmentsTableAdapter.Commands[1].CommandText = String.Format("SELECT Appointments.* FROM Appointments WHERE (OriginalOccurrenceStart >= @Start) AND(OriginalOccurrenceEnd <= @End) AND (ResourceID IN ({0})) OR (Type != 0)", resListString); appointmentsTableAdapter.FillBy(this.scheduleTestDataSet.Appointments, e.Interval.Start.AddDays(-PADDING_DAYS), e.Interval.End.AddDays(PADDING_DAYS)); queryExecutionCounter++; }
public static object FetchAppointmentsHelperMethod(FetchAppointmentsEventArgs args) { var _currentDbContext = DependencyResolver.Current.GetService <IApplicationContext>(); args.ForceReloadAppointments = true; DateTime startDate = args.Interval.Start; DateTime endDate = args.Interval.End; return(_currentDbContext.ResourceHolidays.Where(m => ((m.StartDate >= startDate && m.StartDate <= endDate) || (m.EndDate >= startDate && m.EndDate <= endDate) || (m.StartDate >= startDate && m.EndDate <= endDate) || (m.StartDate < startDate && m.EndDate > endDate) || (m.EventType > 0)) && m.IsDeleted != true && m.RequestStatus == ResourceRequestStatusEnum.Accepted).ToList()); }
public static object FetchAppointmentsHelperMethod(FetchAppointmentsEventArgs args) { var _currentDbContext = DependencyResolver.Current.GetService <IApplicationContext>(); int CurrentTenantId = caCurrent.CurrentTenant().TenantId; args.ForceReloadAppointments = true; DateTime startDate = args.Interval.Start; DateTime endDate = args.Interval.End; return(_currentDbContext.Appointments.AsNoTracking().Where(m => ((m.StartTime >= startDate && m.StartTime <= endDate) || (m.EndTime >= startDate && m.EndTime <= endDate) || (m.StartTime >= startDate && m.EndTime <= endDate) || (m.StartTime < startDate && m.EndTime > endDate) || (m.EventType > 0)) && m.IsCanceled != true).ToList()); }
void schedulerDataStorage1_FetchAppointments(object sender, FetchAppointmentsEventArgs e) { ResourceBaseCollection resourcesVisible = new ResourceBaseCollection() { Capacity = schedulerControl1.ActiveView.ResourcesPerPage }; for (int i = 0; i < schedulerControl1.ActiveView.ResourcesPerPage; i++) { resourcesVisible.Add(schedulerDataStorage1.Resources[schedulerControl1.ActiveView.FirstVisibleResourceIndex + i]); } QueryAppointmentDataSource(e, resourcesVisible); }
private void Storage_FetchAppointments(object sender, FetchAppointmentsEventArgs e) { DateTime startTime = e.Interval.Start; DateTime endTime = e.Interval.End; var entities = carsXtraSchedulingEntities.CarSchedulings.Where(entity => (entity.EventType == 1) || (entity.EventType != 1 && (entity.OriginalStartTime >= startTime && entity.OriginalStartTime < endTime) || (entity.OriginalEndTime > startTime && entity.OriginalEndTime <= endTime))); entities.Load(); var collection = carsXtraSchedulingEntities.CarSchedulings.Local.ToBindingList(); schedulerControl1.Storage.Appointments.DataSource = collection; Text = String.Format("{0} appointments are loaded for {1} interval", collection.Count, e.Interval); }
private void schedulerStorage1_FetchAppointments(object sender, FetchAppointmentsEventArgs e) { }