Exemplo n.º 1
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (XtraMessageBox.Show("La prenotazione corrente sarà eliminata. Continuare?", "Domanda", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    //elimino dal calendario tutte le assegnazioni
                    foreach (Assignment item in _currentBooking.Assignments)
                    {
                        Appointment app = GetAppointment(item);
                        if (app != null)
                        {
                            _control.Storage.Appointments.Remove(app);
                        }
                    }


                    BookingHandler h = new BookingHandler();
                    h.Delete(_currentBooking.BaseObject);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
Exemplo n.º 2
0
        private void schedulerStorage1_AppointmentDeleting(object sender, PersistentObjectCancelEventArgs e)
        {
            try
            {
                Nested_CheckSecurityForDeletion();
            }
            catch (AccessDeniedException)
            {
                ErrorHandler.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato");
                e.Cancel = true;
                return;
            }


            //if (XtraMessageBox.Show("Sicuro di procedere alla cancellazione dell'assegnazione?", "Domanda", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            //{

            DevExpress.XtraScheduler.Appointment app = e.Object as DevExpress.XtraScheduler.Appointment;

            Assignment a = app.GetSourceObject(schedulerStorage1) as Assignment;
            IBooking   b = a.Booking;

            //aggiorno lo stato della prenotaizone
            a.Booking.RemoveAssignment(a);

            if (b.Assignments.Count == 0)
            {
                //elimino l'intera prenotazione
                BookingHandler h = new BookingHandler();

                h.Delete(b.BaseObject);
            }
            else
            {
                //elimino solo la assegnazione corrente
                ////i save on my db
                AssignmentHandler h = new AssignmentHandler();

                h.Delete(a);
            }



            //    return;
            //}

            //e.Cancel = true;
        }
Exemplo n.º 3
0
        private void DeleteBooking()
        {
            BookingHandler h = new BookingHandler();

            h.Delete(_currentBooking as Booking);
        }