Beispiel #1
0
        public override void DoDelete()
        {
            if (_current == null)
            {
                return;
            }


            try
            {
                if (XtraMessageBox.Show("L'elemento sarà eliminato solamente se nel sistema non ci sono altri riferimenti all'elemento oppure se non è un elemento predefinito. Sicuro di voler procedere? ", "Elimina elemento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Nested_CheckSecurityForDeletion();

                    BookingResourceHandler h = new BookingResourceHandler();
                    h.Delete(_current);

                    _mainForm.NavigatorUtility.NavigateToPrevious();
                }
            }
            catch (AccessDeniedException)
            {
                XtraMessageBox.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
Beispiel #2
0
        private void LoadGrid()
        {
            BookingResourceHandler h = new BookingResourceHandler();

            IList l = h.GetAll();

            gridControl1.DataSource = l;
        }
Beispiel #3
0
        private void SaveOrUpdate()
        {
            _current.Descrizione = txtDescrizione.Text;
            _current.Color       = cboColor.Color.ToArgb();
            _current.ImagePath   = hyperLinkEdit1.Text;
            BookingResourceHandler h = new BookingResourceHandler();

            h.SaveOrUpdate(_current);
        }
Beispiel #4
0
        protected override void Nested_LoadDataFromDataSource()
        {
            BookingResourceHandler h = new BookingResourceHandler();

            _current = h.GetElementById(m_IdShowedObject.ToString()) as WIN.SCHEDULING_APPLICATION.DOMAIN.Booking.BookingResource;

            if (_current == null)
            {
                throw new Exception("Elemento non trovato");
            }
        }
Beispiel #5
0
        private void LoadResourcesCombo()
        {
            //preparo la combo delle zone
            chkResources.Properties.Items.Clear();

            BookingResourceHandler h = new BookingResourceHandler();

            //la riempio
            chkResources.Properties.Items.AddRange(h.GetAll());

            //seleziono quella iniziale
            chkResources.SelectedIndex = 0;
        }
Beispiel #6
0
        private void schedulerStorage1_AppointmentChanging(object sender, PersistentObjectCancelEventArgs e)
        {
            try
            {
                Nested_CheckSecurityForChanging();

                //qui verifico che l'appuntamento può essere cambiato
                Appointment app = e.Object as Appointment;

                BookingResourceHandler bc  = new BookingResourceHandler();
                BookingResource        res = bc.GetElementById(app.ResourceId.ToString()) as BookingResource;

                Assignment ass = app.GetSourceObject(schedulerStorage1) as Assignment;

                AssignmentHandler hh = new AssignmentHandler();

                FreeRoomCheck cc = hh.IsRoomFree(app.Start, app.End, res, ass.Id);
                if (!cc.IsFree)
                {
                    XtraMessageBox.Show(cc.Message, "Attenzione", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    e.Cancel = true;
                }


                //if (XtraMessageBox.Show("Il prezzo verra' cambiato di conseguenza. Continuare?", "Domanda", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                //{
                //    e.Cancel = true;
                //    return;
                //}

                //Appointment app1 = e.Object as Appointment;
                //Assignment aas1 = app1.GetSourceObject(schedulerStorage1) as Assignment;

                //if (aas1.Booking.Confirmed)
                //{


                //    aas1.Booking.Payment.Total = aas1.Booking.Payment.Total + 10;
                //}
            }
            catch (AccessDeniedException)
            {
                ErrorHandler.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato");
                e.Cancel = true;
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
                e.Cancel = true;
            }
        }
Beispiel #7
0
        public BookingStatsControl(MainForm form)
            : base(form)
        {
            InitializeComponent();
            comboBoxEdit1.EditValue = DateTime.Now.Year.ToString();
            CustomGUI_SetCommandBarVisibility(false);


            BookingResourceHandler h = new BookingResourceHandler();

            ressourceCount = h.GetAll().Count;
            if (ressourceCount == 0)
            {
                ressourceCount = 1;
            }

            SetDataPivotSource();
        }
Beispiel #8
0
        private void schedulerStorage1_AppointmentsChanged(object sender, PersistentObjectsEventArgs e)
        {
            try
            {
                Nested_CheckSecurityForChanging();
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
                return;
            }


            foreach (DevExpress.XtraScheduler.Appointment app in e.Objects)
            {
                // DevExpress.XtraScheduler.Appointment app = e.Objects[0] as DevExpress.XtraScheduler.Appointment;
                //imposto per sicurezza il campo allday a true;
                app.AllDay = true;

                Assignment a = app.GetSourceObject(schedulerStorage1) as Assignment;

                //se ho cambiato risorsa dal calendario e non dal form
                //(il form tiene i valori sincronizzati) recupero la risorsa e la setto
                if (a.ResourceId != a.Resource.Id)
                {
                    BookingResourceHandler h1 = new BookingResourceHandler();
                    WIN.SCHEDULING_APPLICATION.DOMAIN.Booking.BookingResource res = h1.GetElementById(a.ResourceId.ToString()) as WIN.SCHEDULING_APPLICATION.DOMAIN.Booking.BookingResource;
                    a.Resource = res;
                    app.SetValue(schedulerStorage1, "Resource", res);
                }
                ////i save on my db
                AssignmentHandler h = new AssignmentHandler();

                try
                {
                    h.SaveOrUpdate(a);
                }
                catch (Exception ex)
                {
                    WIN.SCHEDULING_APP.GUI.Utility.ErrorHandler.Show(ex);
                }
            }
        }
Beispiel #9
0
        public BookingControl(MainForm form)
            : base(form)
        {
            try
            {
                DataAccessServices.Instance().PersistenceFacade.EmptyCacheAll();

                _initializing = true;

                InitializeComponent();



                schedulerStorage1.FetchAppointments += new FetchAppointmentsEventHandler(schedulerStorage1_FetchAppointments);

                CustomGUI_SetCommandBarVisibility(false);
                //non permetto nessuna operazione dalla toolbar
                base.m_ChangeStateEnabled        = false;
                schedulerControl1.Start          = DateTime.Now;
                schedulerControl1.ActiveViewType = SchedulerViewType.Timeline;


                BookingResourceHandler h = new BookingResourceHandler();
                schedulerStorage1.Resources.DataSource = h.GetAll();


                ////imposto il raggruppamento del calendario
                //if (Properties.Settings.Default.Main_CalendarGroupType == 0)
                //{
                //    schedulerControl1.GroupType = SchedulerGroupType.None;
                //    comboBoxEdit1.SelectedIndex = 0;
                //}
                //else if (Properties.Settings.Default.Main_CalendarGroupType == 1)
                //{
                //    schedulerControl1.GroupType = SchedulerGroupType.Date;
                //    comboBoxEdit1.SelectedIndex = 1;
                //}
                //else if (Properties.Settings.Default.Main_CalendarGroupType == 2)
                //{
                schedulerControl1.GroupType = SchedulerGroupType.Resource;
                // comboBoxEdit1.SelectedIndex = 2;
                //}
                //else
                //{
                //    schedulerControl1.GroupType = SchedulerGroupType.None;
                //    comboBoxEdit1.SelectedIndex = 0;
                //}

                if (Properties.Settings.Default.Main_ZoomTemporale != 0)
                {
                    schedulerControl1.TimelineView.GetBaseTimeScale().Width = Properties.Settings.Default.Main_ZoomTemporale;
                    trackBarControl1.Value = Properties.Settings.Default.Main_ZoomTemporale;
                }

                if (Properties.Settings.Default.Main_ZoomSpaziale != 0)
                {
                    schedulerControl1.TimelineView.AppointmentDisplayOptions.AppointmentHeight = Properties.Settings.Default.Main_ZoomSpaziale;
                    trackBarControl2.Value = Properties.Settings.Default.Main_ZoomSpaziale;
                }
            }
            finally
            {
                _initializing = false;
            }
        }