예제 #1
0
        public void Delete(int position, List <Assignment> assignments)
        {
            Console.Clear();
            Console.WriteLine();
            string[]     menu         = { "có", "không" };
            MenuSelector menuSelector = new MenuSelector(menu, "Bạn có chắc muốn xóa phân công này?");
            int          select       = menuSelector.Selector();

            switch (select)
            {
            case 0:
                Console.Clear();
                handler.Delete(assignments[position].ID);
                assignments[position].TeacherID = null;
                assignments[position].Semester  = 0;
                Console.WriteLine("Xóa thành công");
                break;

            case 1:
                Console.Clear();
                PrintSelectorTable(assignments, position);
                break;
            }
        }
예제 #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;
        }
예제 #3
0
        } // checked

        public void Delete()
        {
            List <Class> classes = this.teacher.Role == (int)UserPermission.HeadSection ? classHandler.GetList(teacher.SubjectID) : classHandler.GetClasses();
            bool         exit    = false;

            while (!exit)
            {
                Console.Clear();
                PrintTable(classes);
                string classId = GetID2();
                classHandler.Delete(classId);
                assignmentHandler.Delete(assigment => assigment.ClassID == classId);
                classes.RemoveAt(classHandler.GetIndex(classId, classes));
                Console.Clear();
                PrintTable(classes);
                Console.Write("Nhấn esc để thoát");
                ConsoleKeyInfo keyInfo = Console.ReadKey();
                if (keyInfo.Key == ConsoleKey.Escape)
                {
                    exit = true;
                }
            }
        } //checked
예제 #4
0
        } //checked

        public void Delete()
        {
            AssignmentHandler assignmentHandler = new AssignmentHandler();
            bool exit = false;

            while (!exit)
            {
                List <Term> terms = this.teacher.Role == (int)UserPermission.HeadSection ? handler.GetList(this.teacher.SubjectID) : handler.GetListTerm();
                PrintTable(terms);
                string id = GetId2();
                handler.DeleteTerm(id);
                terms.RemoveAt(handler.GetIndex(id, terms));
                assignmentHandler.Delete(assignment => assignment.TermID == id);
                PrintTable(terms);
                Console.Clear();
                PrintTable(terms);
                Console.Write("Bạn có muốn sửa tiếp không?(nhấn esc để thoát)");
                ConsoleKeyInfo info = Console.ReadKey();
                if (info.Key == ConsoleKey.Escape)
                {
                    exit = true;
                }
            }
        }  //checked