예제 #1
0
        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();
        }
예제 #2
0
        private void ExecuteQuery()
        {
            try
            {
                WIN.GUI.UTILITY.Helper.ShowWaitBox("Elaborazione in corso...", Properties.Resources.Waiting);


                WIN.SCHEDULING_APPLICATION.HANDLERS.AppointmentHandler h = new WIN.SCHEDULING_APPLICATION.HANDLERS.AppointmentHandler();


                IList <IsearchDTO> dtos = new List <IsearchDTO>();

                dtos.Add(appointmentCustomerSearchControl1.CreateDTO());
                dtos.Add(appointmentDateSearchControl1.CreateDTO());
                dtos.Add(appointmentSimplesearchControl1.CreateDTO());
                dtos.Add(appointmentStateSeachControl1.CreateDTO());

                h.ExecuteQuery(dtos, -1, Properties.Settings.Default.Main_DeadlineDaysBefore);

                gridControl1.DataSource = h.BindableResults;


                if (h.BindableResults.Count == 0)
                {
                    XtraMessageBox.Show("Nessun risultato è stato trovato. Riprovare con altri criteri di selezione!", "Nessun risultato", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    try
                    {
                        gridControl1.MainView.SaveLayoutToXml(fileLayout);
                    }
                    catch (Exception)
                    {
                        //non fa nulla
                    }
                }
            }
            catch (Exception ex)
            {
                WIN.SCHEDULING_APP.GUI.Utility.ErrorHandler.Show(ex);
            }
            finally
            {
                WIN.GUI.UTILITY.Helper.HideWaitBox();
            }
        }
예제 #3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                if (schedulerControl1.Services.SchedulerState.IsDataRefreshAllowed)
                {
                    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);

                    schedulerControl1.BeginUpdate();
                    schedulerStorage1.BeginUpdate();


                    schedulerStorage1.Appointments.DataSource = h.BindableResults;

                    schedulerStorage1.EndUpdate();
                    schedulerControl1.EndUpdate();
                }
            }
            catch (Exception)
            {
                // non fa nulla
            }


            //schedulerStorage1.Appointments.DataSource = null;
            // = myAppointmentBindingSource;
            //schedulerStorage1.RefreshData();
            //IBindingList l = schedulerStorage1.Appointments.DataSource as IBindingList;

            //foreach (MyAppointment item in h.BindableResults )
            //{
            //    if (!Exsist(l, item))
            //        l.Add(item);
            //}


            //    //schedulerStorage1.RefreshData();
            //    //schedulerControl1.Storage.RefreshData();
            //    //schedulerControl1.Refresh();
            //}
        }