Exemplo n.º 1
0
        public void FillRegistryStudents()
        {
            Student_Service studService = new Student_Service();
            List <Student>  studentList = studService.GetStudents();

            Lst_RegStu.Items.Clear();
            foreach (Student s in studentList)
            {
                var row = new string[] { s.Number.ToString(), s.FullName };
                var lvi = new ListViewItem(row);
                Lst_RegStu.Items.Add(lvi);
            }
        }
Exemplo n.º 2
0
        private void OrderForm_Load(object sender, EventArgs e)
        {
            //fill the combo boxes
            List <Student> students = studentService.GetStudents();

            foreach (Student S in students)
            {
                cmbOrdStudents.Items.Add(S.Name);
            }

            List <Drink> drinks = drinkService.GetDrinks();

            foreach (Drink D in drinks)
            {
                cmbOrdDrinks.Items.Add(D.Name);
            }
        }
Exemplo n.º 3
0
        private void ReloadForm()
        {
            List <Student> students = studentService.GetStudents();

            cmbDrinks.Items.Clear();
            cmbStudents.Items.Clear();

            cmbDrinks.SelectedIndex   = -1;
            cmbStudents.SelectedIndex = -1;

            foreach (Student student in students)
            {
                cmbStudents.Items.Add(student.FullName);
            }

            List <Drink> drinks = drinkService.GetDrinks();

            foreach (Drink drink in drinks)
            {
                cmbDrinks.Items.Add(drink.DrinkName);
            }
        }
Exemplo n.º 4
0
        private void showPanel(string panelName)
        {
            HideAll();
            ListViewRefresh();

            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();

                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            else if (panelName == "Students")
            {
                // hide all other panels
                HideAll();
                ListViewRefresh();

                // show lable name students
                lbl_Students.Text = "Students";

                // show students
                pnl_Students.Show();

                //show colums, with name and id
                listViewStudents.Columns.Add("studentName");
                listViewStudents.Columns.Add("studentId");

                // fill the students listview within the students panel with a list of students
                Student_Service StudentService = new Student_Service();

                // clear the listview before filling it again
                listViewStudents.Clear();

                foreach (Student student in StudentService.GetStudents())
                {
                    ListViewItem li = new ListViewItem(student.Name);
                    li.SubItems.Add(student.Number.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Teachers")
            {
                HideAll();
                ListViewRefresh();

                // show lable name students
                lbl_Lecturers.Text = "Teachers";

                // show Lecturers
                pnl_Lecturers.Show();

                //show colums, with name and id
                listviewLecturers.Columns.Add("TeachersName");
                listviewLecturers.Columns.Add("TeachersId");

                // fill the Lecturers listview within the Lecturer panel with a list of Lecturers
                Teacher_Service teacherService = new Teacher_Service();

                // clear the listview before filling it again
                listviewLecturers.Clear();

                foreach (Teacher teacher in teacherService.GetTeacher())
                {
                    ListViewItem li = new ListViewItem(teacher.Name);
                    li.SubItems.Add(teacher.Number.ToString());
                    listviewLecturers.Items.Add(li);
                }
            }
        }
        private void ShowPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Rooms.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Drank.Hide();
                pnl_Kassa.Hide();
                pnl_Omzetrapportage.Hide();
                pnl_Begeleiders.Hide();

                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            else if (panelName == "Students")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Lecturers.Hide();
                pnl_Rooms.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Drank.Hide();
                pnl_Kassa.Hide();
                pnl_Omzetrapportage.Hide();
                pnl_Begeleiders.Hide();

                // show students
                pnl_Students.Show();



                // fill the students listview within the students panel with a list of students
                SomerenLogic.Student_Service studService = new SomerenLogic.Student_Service();
                List <Student> studentList = studService.GetStudents();

                // clear the listview before filling it again
                listViewStudents.Clear();

                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.Studentname, s.Studentnumber);
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Lecturers")
            {
                //hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Rooms.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Drank.Hide();
                pnl_Kassa.Hide();
                pnl_Omzetrapportage.Hide();
                pnl_Begeleiders.Hide();

                pnl_Lecturers.Show();

                Teacher_Service teachService = new Teacher_Service();
                List <Teacher>  teacherList  = teachService.GetTeachers();

                listViewLecturers.Clear();

                foreach (Teacher t in teacherList)
                {
                    ListViewItem li = new ListViewItem(t.Teachername, t.Teachernumber);
                    listViewLecturers.Items.Add(li);
                }
            }
            else if (panelName == "Rooms")
            {
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Drank.Hide();
                pnl_Kassa.Hide();
                pnl_Omzetrapportage.Hide();
                pnl_Begeleiders.Hide();

                pnl_Rooms.Show();

                Room_Service roomService = new Room_Service();
                List <Room>  roomList    = roomService.GetRooms();

                ListRoomBox.Items.Clear();

                foreach (Room r in roomList)
                {
                    ListRoomBox.Items.Add(r.RoomToString());
                }
            }
            else if (panelName == "Activities")
            {
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Rooms.Hide();
                pnl_Drank.Hide();
                pnl_Kassa.Hide();
                pnl_Omzetrapportage.Hide();
                pnl_Begeleiders.Hide();

                pnl_Activiteitenlijst.Show();

                Activity_Service activityService = new Activity_Service();
                List <Activity>  activityList    = activityService.GetActivities();

                lv_Activiteitenlijst.Items.Clear();
                cmb_Activiteiten.Items.Clear();

                foreach (Activity a in activityList)
                {
                    ListViewItem li = new ListViewItem(a.Number.ToString());
                    li.SubItems.Add(a.Description.ToString());
                    li.SubItems.Add(a.StartTime.ToString());
                    li.SubItems.Add(a.NumberofStudents.ToString());
                    li.SubItems.Add(a.NumberofLecturers.ToString());
                    lv_Activiteitenlijst.Items.Add(li);

                    cmb_Activiteiten.Items.Add(a.ActiviteitcmbBoxToString());
                }

                cmb_Activiteiten.SelectedIndex = 0;
            }
            else if (panelName == "Drank")
            {
                //Hide all other panels (once again)
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Rooms.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Kassa.Hide();
                pnl_Omzetrapportage.Hide();
                pnl_Begeleiders.Hide();

                //show the Drinks panel
                pnl_Drank.Show();

                Drank_Service drankService = new Drank_Service();
                List <Drank>  drankList    = drankService.GetDrinks();

                lv_Drank.Items.Clear();

                foreach (Drank d in drankList)
                {
                    //drankService.StockCheck(d);

                    ListViewItem li = new ListViewItem(d.DrankName.ToString());
                    li.SubItems.Add(d.StockAmount.ToString());
                    li.SubItems.Add(d.Price.ToString());
                    li.SubItems.Add(drankService.StockCheck(d));
                    lv_Drank.Items.Add(li);
                }
            }
            else if (panelName == "Kassa")
            {
                //Hide all the other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Rooms.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Drank.Hide();
                pnl_Omzetrapportage.Hide();
                pnl_Begeleiders.Hide();

                //show the Kassa panel
                pnl_Kassa.Show();

                cmb_Students.Items.Clear();

                Student_Service studentService = new Student_Service();
                List <Student>  studentList    = studentService.GetStudents();

                foreach (Student s in studentList)
                {
                    cmb_Students.Items.Add(s.Studentname);
                }

                //eerste student selecteren als standaard.
                cmb_Students.SelectedIndex = 0;



                cmb_Drinks.Items.Clear();

                Drank_Service drinksService = new Drank_Service();
                List <Drank>  drankList     = drinksService.GetAllDrinks();

                foreach (Drank d in drankList)
                {
                    cmb_Drinks.Items.Add(d.DrankName);
                }

                //eerste drank selecteren als standaard.
                cmb_Drinks.SelectedIndex = 0;


                Bestelling_Kassa_Service bestellingService = new Bestelling_Kassa_Service();
                List <Bestelling>        orderList         = bestellingService.GetOrders();

                //hier de listview van de bestellingen leegmaken om daarna weer te kunnen vullen
                lv_Bestelling.Items.Clear();

                foreach (Bestelling b in orderList)
                {
                    //drankService.StockCheck(d);

                    ListViewItem Order = new ListViewItem(b.Bestellingsnummer.ToString());
                    Order.SubItems.Add(b.Datum.ToString());

                    Drank Ordereddrank = drinksService.GetDrankById(b.Dranknummer);

                    Order.SubItems.Add(Ordereddrank.DrankName.ToString());

                    Student OrderedStudent = studentService.GetStudentById(b.Studentnummer);

                    Order.SubItems.Add(OrderedStudent.Studentname.ToString());

                    lv_Bestelling.Items.Add(Order);
                }
            }
            else if (panelName == "Omzetrapportage")
            {
                //Hide all the other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Rooms.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Drank.Hide();
                pnl_Kassa.Hide();
                pnl_Begeleiders.Hide();

                //show this panel
                pnl_Omzetrapportage.Show();
            }
            else if (panelName == "Begeleiders")
            {
                //Hide all the other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Rooms.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Drank.Hide();
                pnl_Kassa.Hide();
                pnl_Omzetrapportage.Hide();

                //show this panel
                pnl_Begeleiders.Show();

                Begeleider_Service begeleiderService = new Begeleider_Service();
                List <Begeleider>  begeleiderList    = begeleiderService.GetBegeleiders();

                lv_Begeleiders.Items.Clear();
                cmb_Begeleiders.Items.Clear();

                foreach (Begeleider b in begeleiderList)
                {
                    ListViewItem li = new ListViewItem(b.Begeleidernummer.ToString());
                    li.SubItems.Add(b.Teachernumber.ToString());
                    li.SubItems.Add(b.Teachername.ToString());
                    li.SubItems.Add(b.Subject.ToString());
                    li.SubItems.Add(b.Teacherroomnumber.ToString());
                    lv_Begeleiders.Items.Add(li);

                    cmb_Begeleiders.Items.Add(b.Begeleidernummer.ToString());
                }

                cmb_Begeleiders.SelectedIndex = 0;

                Teacher_Service teacherService = new Teacher_Service();
                List <Teacher>  teacherList    = teacherService.GetTeachers();

                cmb_Docenten.Items.Clear();

                foreach (Teacher t in teacherList)
                {
                    cmb_Docenten.Items.Add(t.Teachernumber);
                }
                cmb_Docenten.SelectedIndex = 0;
            }
        }
Exemplo n.º 6
0
        //private to internal because we will reference it from the other form
        internal void showPanel(string panelName)
        {
            //hide all panels
            pnl_Dashboard.Hide();
            img_Dashboard.Hide();
            pnl_Students.Hide();
            pnl_Teachers.Hide();
            pnl_Drinks.Hide();
            pnl_CashRegister.Hide();
            pnl_Supervisors.Hide();


            if (panelName == "Dashboard")
            {
                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            else if (panelName == "Students")
            {
                //Check if the listview already exist, if not create one.
                if (viewStudentList == null)
                {
                    viewStudentList = CreateStudentListView();
                    pnl_Students.Controls.Add(viewStudentList);
                }

                // show students
                pnl_Students.Show();

                // fill the students listview within the students panel with a list of students
                Student_Service studService = new Student_Service();
                List <Student>  studentList = studService.GetStudents();

                // clear the listview before filling it again
                viewStudentList.Items.Clear();

                foreach (Student s in studentList)
                {
                    ListViewItem student = new ListViewItem(new string[] { s.Number.ToString(), s.FirstName, s.LastName });
                    viewStudentList.Items.Add(student);
                }
            }
            else if (panelName == "Lecturers")
            {
                // show teachers panel
                pnl_Teachers.Show();

                // fill the teachers listview within the teacher panel with a list of teachers
                Teacher_Service teacherService = new Teacher_Service();
                List <Teacher>  teacherList    = teacherService.GetTeachers();

                // clear the items in listview
                listViewTeachers.Items.Clear();

                // fill list
                foreach (Teacher s in teacherList)
                {
                    ListViewItem teacher = new ListViewItem(s.Number.ToString());
                    teacher.SubItems.Add(s.FirstName);
                    teacher.SubItems.Add(s.LastName);
                    listViewTeachers.Items.Add(teacher);
                }
            }



            //this is part of variant A from assignment 3
            //this is part of variant A from assignment 3
            else if (panelName == "Drinks Supplies")
            {
                //show drinks panel
                pnl_Drinks.Show();

                //fill the drinks listview wihin the drink panel with a list of drinks
                Drink_Service drinkService = new Drink_Service();
                List <Drink>  drinkList    = drinkService.GetDrinks();

                //clear the items in listview
                listViewDrinks.Items.Clear();

                //fill list
                foreach (Drink d in drinkList)
                {
                    ListViewItem drink = new ListViewItem(new string[] { d.DrinkName, String.Format("{0:0.00}", d.Price), d.StockAmount.ToString() });
                    drink.Tag = d;
                    if (d.StockAmount < 10)
                    {
                        //show half bottle icon
                        drink.ImageIndex = 1;
                    }
                    else
                    {
                        //show full bottle icon
                        drink.ImageIndex = 0;
                    }
                    listViewDrinks.Items.Add(drink);
                }
                this.Refresh();
            }



            //this is a part of variant B from assignment 3
            //this is a part of variant B from assignment 3
            else if (panelName == "CashRegister")
            {
                //show panel
                pnl_CashRegister.Show();

                //get list of drinks and students
                Student_Service studService = new Student_Service();
                List <Student>  studentList = studService.GetStudents();

                Drink_Service drinkService = new Drink_Service();
                List <Drink>  drinkList    = drinkService.GetDrinks();

                //clear the listview before filling it again
                lv_Cash_Student.Items.Clear();
                lv_Cash_Drinks.Items.Clear();

                //get students
                foreach (Student s in studentList)
                {
                    ListViewItem student = new ListViewItem(s.Number.ToString());
                    student.SubItems.Add(s.FullName);

                    lv_Cash_Student.Items.Add(student);
                }

                //get drinks
                foreach (Drink d in drinkList)
                {
                    ListViewItem drink = new ListViewItem(d.DrinkNumber.ToString());
                    drink.SubItems.Add(d.DrinkName);
                    drink.SubItems.Add(d.Price.ToString("0.00"));
                    drink.SubItems.Add(d.StockAmount.ToString());

                    lv_Cash_Drinks.Items.Add(drink);
                }
            }

            //this is a part of variant B from assignment 4
            //this is a part of variant B from assignment 4
            else if (panelName == "Supervisors")
            {
                //show supervisor panek
                pnl_Supervisors.Show();

                //fill the supervisors listview within the supervisor panel with list of supervisors
                Supervisor_Service supervisorService = new Supervisor_Service();
                List <Supervisor>  supervisorList    = supervisorService.GetSupervisors();

                //clear items in listview
                listViewSupervisors.Items.Clear();

                //fill list
                foreach (Supervisor s in supervisorList)
                {
                    ListViewItem supervisor = new ListViewItem(new string[] { s.LecturerID.ToString(), s.FirstName, s.LastName });
                    supervisor.Tag = s;
                    listViewSupervisors.Items.Add(supervisor);
                }
            }
        }
Exemplo n.º 7
0
        private void showPanel(string panelName)
        {
            //dashboard

            if (panelName == "Dashboard")
            {
                // hide all other panels
                HidingPanels();

                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            //for students
            else if (panelName == "Students")
            {
                // hide all other panels
                HidingPanels();

                // show students
                pnl_Students.Show();

                // fill the students listview within the students panel with a list of students
                SomerenLogic.Student_Service studService = new SomerenLogic.Student_Service();
                List <Student> studentList = studService.GetStudents();

                // clear the listview before filling it again
                listViewStudents.Clear();

                ///////remove this
                listViewStudents.Columns.Add("Id");
                listViewStudents.Columns.Add("First Name");
                listViewStudents.Columns.Add("Last Name");
                listViewStudents.Columns.Add("Year");


                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.StudentNumber.ToString());
                    li.SubItems.Add(s.FirstName.ToString());
                    li.SubItems.Add(s.LastName.ToString());
                    li.SubItems.Add(s.Year.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            //for lecturers
            else if (panelName == "Lecturers")
            {
                HidingPanels();

                PNL_TEACHERS.Show();

                // fill the students listview within the students panel with a list of students
                SomerenLogic.Teacher_Service teachService = new SomerenLogic.Teacher_Service();
                List <Teacher> teacherList = teachService.GetTeachers();

                // clear the listview before filling it again
                listViewTeachers.Items.Clear();

                foreach (SomerenModel.Teacher s in teacherList)
                {
                    ListViewItem li = new ListViewItem(s.TeacherNumber.ToString());
                    li.SubItems.Add(s.FirstName.ToString());
                    li.SubItems.Add(s.LastName.ToString());
                    li.SubItems.Add(s.Speciality.ToString());
                    listViewTeachers.Items.Add(li);
                }
            }
            // for rooms
            else if (panelName == "Rooms")
            {
                //hiding the panels you dont wanna show
                HidingPanels();

                //showing Rooms
                PNL_Rooms.Show();

                //filling the rooms listview within the srooms panel with a list of rooms
                SomerenLogic.Room_Service roomService = new SomerenLogic.Room_Service();
                List <Room> roomList = roomService.GetRooms();

                foreach (SomerenModel.Room r in roomList)
                {
                    ListViewItem li = new ListViewItem(r.Number.ToString());
                    li.SubItems.Add(r.Capacity.ToString());

                    if (r.Type == true)
                    {
                        li.SubItems.Add("Teacher");
                    }
                    else
                    {
                        li.SubItems.Add("Student");
                    }

                    LV_Rooms.Items.Add(li);
                }
            }
            //for drinks
            if (panelName == "Drinks")
            {
                //hide panels
                HidingPanels();
                //Show the panel
                Pnl_Drinks.Show();

                listViewsDrinks.Items.Clear();

                //Add columns
                listViewsDrinks.Columns.Add("Id");
                listViewsDrinks.Columns.Add("NameOfDrink");
                listViewsDrinks.Columns[1].Width = 100;
                listViewsDrinks.Columns.Add("Price");
                listViewsDrinks.Columns.Add("Stock");
                //listViewsDrinks.Columns.Add("studentId");
                ////listViewsDrinks.Columns[5].Width = 50;
                listViewsDrinks.Columns.Add(" ");
                listViewsDrinks.Columns.Add("Alcoholic");


                // Fill the drink
                LoadDrinks();
            }

            //for register
            if (panelName == "Register")
            {
                //hide panels
                HidingPanels();

                //show pnl register
                PNL_Register.Show();
                Student_Service studentService = new Student_Service();
                List <Student>  studentList    = studentService.GetStudents();
                Drink_Service   drinkService   = new Drink_Service();
                List <Drinks>   drinkList      = drinkService.GetDrinks();

                listViewStudent.Items.Clear();
                listViewStudent.Columns.Add("Student ID", 100);
                listViewStudent.Columns.Add("Student Name", 200);

                listViewDrink.Items.Clear();
                //listViewDrink.Items.Add("DrinkID", 60);
                listViewDrink.Columns.Add("DrinkID", 80);
                listViewDrink.Columns.Add("DrinkName", 100);
                listViewDrink.Columns.Add("Price", 80);


                foreach (Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.StudentNumber.ToString());
                    li.SubItems.Add(s.FullName);
                    listViewStudent.Items.Add(li);
                }

                foreach (Drinks d in drinkList)
                {
                    ListViewItem li = new ListViewItem(d.Id.ToString());
                    //li.SubItems.Add(d.NameOfDrink);
                    li.SubItems.Add(d.NameOfDrink);
                    li.SubItems.Add(d.Price.ToString());
                    listViewDrink.Items.Add(li);
                }
            }

            //for revenue --> RETAKE
            else if (panelName == "Revenue")
            {
                //hiding all other panels
                HidingPanels();
                //showing the revenue panel
                PNL_Revenue.Show();
                //generating the revenue table from database
                ShowRevenue();
            }

            //for activities
            if (panelName == "Activities")
            {
                //showing activities panel
                PnlActivities.Show();

                // clear the listview before filling it again
                listViewActivities.Clear();

                //add columns
                listViewActivities.Columns.Add("Id");
                listViewActivities.Columns[0].Width = 30;
                listViewActivities.Columns.Add("ActivityName");
                listViewActivities.Columns[1].Width = 100;
                listViewActivities.Columns.Add("NumberofStudents");
                listViewActivities.Columns[2].Width = 100;
                listViewActivities.Columns.Add("NumberofSupervisors");
                listViewActivities.Columns[3].Width = 130;

                LoadActivities();
            }
            //for supervisors
            else if (panelName == "Supervisors")
            {
                HidingPanels();

                SomerenLogic.Teacher_Service teachService = new SomerenLogic.Teacher_Service();
                List <Teacher> teacherList = teachService.GetSupervisors();

                // clear the listview before filling it again
                listViewSupervisors.Items.Clear();

                foreach (SomerenModel.Teacher s in teacherList)
                {
                    ListViewItem li = new ListViewItem(s.TeacherNumber.ToString());
                    li.SubItems.Add(s.FirstName.ToString());
                    li.SubItems.Add(s.LastName.ToString());
                    li.SubItems.Add(s.Speciality.ToString());
                    li.SubItems.Add(s.Supervisor.ToString());
                    listViewSupervisors.Items.Add(li);
                }
            }
            //for timetbale
            else if (panelName == "Timetable")
            {
                HidingPanels();
                PNL_timetable.Show();
                LV_Timetable.Items.Clear();
            }
        }
Exemplo n.º 8
0
        private void showPanel(string panelName)
        {
            try
            {
                if (panelName == "Dashboard")
                {
                    hideAllPanels();

                    // show dashboard
                    pnl_Dashboard.Show();
                    img_Dashboard.Show();
                }
                else if (panelName == "Revenue")
                {
                    hideAllPanels();
                    pnl_Revenue.Show();

                    //pnl_Revenue.Show();
                    //lstvw_Revenue.Clear();
                    pnl_Revenue.Show();

                    mntclndr_Revenue.MaxDate = DateTime.Today;
                }
                else if (panelName == "Rooms")
                {
                    hideAllPanels();
                    pnl_Rooms.Show();

                    // fill the rooms listview within the students panel with a list of students
                    SomerenLogic.Room_Service rmService = new SomerenLogic.Room_Service();
                    List <Room> roomList = rmService.GetRooms();

                    // clear the listview before filling it again
                    listViewRooms.Items.Clear();
                    foreach (SomerenModel.Room r in roomList)
                    {
                        ListViewItem li = new ListViewItem(r.Number.ToString());
                        li.SubItems.Add(r.Capacity.ToString());
                        li.SubItems.Add(r.Type);
                        listViewRooms.Items.Add(li);
                    }
                }
                else if (panelName == "Students")
                {
                    // hide all other panels
                    hideAllPanels();
                    pnl_Students.Show();



                    // fill the students listview within the students panel with a list of students
                    SomerenLogic.Student_Service studService = new SomerenLogic.Student_Service();
                    studentList = studService.GetStudents();

                    // clear the listview before filling it again
                    listViewStudents.Items.Clear();
                    fillListViewStudents(studentList);
                }
                else if (panelName == "Teachers")
                {
                    hideAllPanels();
                    pnl_Teachers.Show();


                    Teacher_Service lecService = new Teacher_Service();
                    List <Teacher>  lectList   = lecService.GetTeachers();

                    listViewTeachers.Items.Clear();
                    foreach (Teacher t in lectList)
                    {
                        ListViewItem item = new ListViewItem(t.Number.ToString());
                        item.SubItems.Add(t.Name);
                        listViewTeachers.Items.Add(item);
                    }
                }
                else if (panelName == "Activities")
                {
                    hideAllPanels();
                    pnl_Activities.Show();

                    ResetModifyActivity();
                }
                else if (panelName == "RoomLayout")
                {
                    hideAllPanels();
                    pnl_kamerindeling.Show();

                    // fill the Combobox within the kamerindeling panel with a list of the roomnumbers
                    SomerenLogic.Student_Service indelingService = new SomerenLogic.Student_Service();
                    List <Student> kamers = indelingService.GetKamers();
                    foreach (Student kamer in kamers)
                    {
                        comboBoxKamerindeling.Items.Add(kamer.RoomNumber);
                    }
                }
                else if (panelName == "Stock")
                {
                    hideAllPanels();
                    pnl_Stock.Show();

                    Stock_Service stockService = new Stock_Service();
                    List <Stock>  stockList    = stockService.GetStocksCondition();
                    stockList = stockList.OrderBy(stockpile => stockpile.Name).ToList();
                    listViewStock.Items.Clear();
                    foreach (Stock stock in stockList)
                    {
                        ListViewItem item = new ListViewItem(stock.Name.ToString());

                        // ENOUGHT IN STOCK?
                        string icon;
                        if (stock.Stockpile >= 10)
                        {
                            icon = "✔ ";
                        }
                        else
                        {
                            icon = "❌ ";
                        }

                        item.SubItems.Add(icon + stock.Stockpile.ToString());
                        item.SubItems.Add(stock.Sellprice.ToString());
                        listViewStock.Items.Add(item);
                    }
                }
                else if (panelName == "ModifyStock")
                {
                    hideAllPanels();
                    pnl_ModifyStock.Show();


                    ResetModifyStock();
                }
                else if (panelName == "Log")
                {
                    hideAllPanels();
                    pnl_Log.Show();

                    listViewLogs.Items.Clear();
                    foreach (Log log in logList)
                    {
                        ListViewItem item = new ListViewItem(log.Date.ToString());
                        item.SubItems.Add(log.Message);
                        item.SubItems.Add(log.Source);
                        item.SubItems.Add(log.Method);
                        item.SubItems.Add(log.Fullname);
                        listViewLogs.Items.Add(item);
                    }
                }

                else if (panelName == "Cash Register")
                {
                    hideAllPanels();
                    pnl_CashRegister.Show();


                    lvDrink.View = View.Details;
                    lvDrink.Columns.Add("ID", 30);
                    lvDrink.Columns.Add("Name");
                    lvDrink.Columns.Add("Kind", 100);
                    lvDrink.Columns.Add("Price");
                    lvDrink.Columns.Add("Amount Left", 75);
                    lvStudent.View = View.Details;
                    lvStudent.Columns.Add("ID", 30);
                    lvStudent.Columns.Add("Name", 100);

                    lvDrink.Items.Clear();
                    Stock_Service   stockservice   = new Stock_Service();
                    Student_Service studentService = new Student_Service();
                    foreach (Stock stock in stockservice.GetStocks())
                    {
                        //de lijst vullen met alle data in de juiste volgorde.
                        ListViewItem item = new ListViewItem(stock.Number.ToString());
                        item.SubItems.Add(stock.Name);
                        item.SubItems.Add(stock.Kind);
                        item.SubItems.Add((stock.Sellprice * ((decimal)stock.Tax / 100 + 1)).ToString("0.00"));
                        item.SubItems.Add(stock.SellAmounts.ToString());
                        lvDrink.Items.Add(item);
                        //"\u20AC " +
                    }
                    lvDrink.Select();

                    lvStudent.Items.Clear();
                    foreach (Student student in studentService.GetStudents())
                    {
                        ListViewItem item = new ListViewItem(student.Number.ToString());
                        item.SubItems.Add(student.Name);
                        lvStudent.Items.Add(item);
                    }
                    lvStudent.Select();
                }
                else if (panelName == "VAT Calculation")
                {
                    hideAllPanels();
                    pnl_BTWBerekenen.Show();
                }
            }
            catch (Exception exception)
            {
                Catch(exception);
            }
        }
Exemplo n.º 9
0
        private void showPanel(string panelName)

        {
            hideAllPanels();

            if (panelName == "Dashboard")
            {
                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            else if (panelName == "Students")
            {
                // show students
                pnl_Students.Show();

                // fill the students listview within the students panel with a list of students
                List <Student> studentList = studService.GetStudents();

                // clear the listview before filling it again
                listViewStudents.Items.Clear();

                foreach (Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.Id.ToString());

                    li.Tag = s;
                    li.SubItems.Add(s.FirstName);
                    li.SubItems.Add(s.LastName);
                    li.SubItems.Add(s.BirthDate.ToString("dd-mm-yyyy"));

                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Teachers")
            {
                // show teachers
                pnl_Teachers.Show();

                // clear the listview before filling it again
                listViewTeachers.Items.Clear();

                // fill the teachers listview within the teachers panel with a list of teachers
                List <Teacher> teacherList = teacher_Service.GetTeacher();

                foreach (Teacher t in teacherList)
                {
                    ListViewItem List = new ListViewItem(t.Id.ToString());
                    List.Tag = t;
                    List.SubItems.Add(t.FirstName);
                    List.SubItems.Add(t.LastName);
                    List.SubItems.Add(t.RoomNumber.ToString());
                    List.SubItems.Add(t.Lead.ToString());
                    listViewTeachers.Items.Add(List);
                }
            }
            else if (panelName == "Rooms")
            {
                // show rooms
                pnl_Rooms.Show();

                // fill the rooms listview within the rooms panel with a list of rooms
                List <Room> roomList = room_Service.GetRoom();

                // clear the listview before filling it again
                ListViewRooms.Items.Clear();

                foreach (Room t in roomList)
                {
                    ListViewItem li = new ListViewItem(t.Number.ToString());

                    li.Tag = t;
                    li.SubItems.Add(t.Capacity.ToString());

                    ListViewRooms.Items.Add(li);
                }
            }
            else if (panelName == "Activities")
            {
                //show activities panel
                pnl_Activity.Show();

                // fill the activities listview within the panel with a list of activities
                List <Activity> activitiesList = activity_Service.GetActivities();

                // clear the listview before filling it again
                listViewActivities.Items.Clear();


                foreach (Activity a in activitiesList)
                {
                    ListViewItem List = new ListViewItem(a.ActivityID.ToString());
                    List.Tag = a;
                    List.SubItems.Add(a.Name);
                    List.SubItems.Add(a.Date);
                    List.SubItems.Add(a.NStudent.ToString());
                    List.SubItems.Add(a.NGuide.ToString());


                    listViewActivities.Items.Add(List);
                    //List view task (right arrow) then View and then details to see the columns
                }
            }
            else if (panelName == "Register")
            {
                // show Register
                pnl_Register.Show();

                // fill the rooms listview within the rooms panel with a list of rooms
                List <Drink>   DrinkList   = Drink_Service.GetDrink();
                List <Student> StudentList = studService.GetStudents();

                // clear the listview before filling it again
                listView_Register.Items.Clear();
                listView_Register2.Items.Clear();

                foreach (Drink t in DrinkList)
                {
                    ListViewItem li = new ListViewItem(t.Id.ToString());

                    li.Tag = t;
                    li.SubItems.Add(t.Name.ToString());
                    li.SubItems.Add(t.Price.ToString());
                    li.SubItems.Add(t.Alcoholic.ToString());

                    listView_Register.Items.Add(li);
                }
                foreach (Student t in StudentList)
                {
                    ListViewItem li = new ListViewItem(t.Id.ToString());

                    li.Tag = t;
                    li.SubItems.Add(t.FirstName.ToString());
                    li.SubItems.Add(t.LastName.ToString());

                    listView_Register2.Items.Add(li);
                }
            }
            else if (panelName == "Sales")
            {
                pnl_Sales.Show();
                updateSales();
            }
            else if (panelName == "Stock")
            {
                // show Stock
                pnl_Stock.Show();

                // clear the listview before filling it again
                listViewStock.Items.Clear();

                // fill the teachers listview within the teachers panel with a list of teachers
                List <Stock> stockList = stock_Service.GetStock();

                foreach (Stock s in stockList)
                {
                    ListViewItem List = new ListViewItem(s.DrinkID.ToString());
                    List.Tag = s;
                    List.SubItems.Add(s.Name);
                    List.SubItems.Add(s.Price.ToString());
                    List.SubItems.Add(s.Amount.ToString());
                    listViewStock.Items.Add(List);
                }
            }
            else if (panelName == "Attendants")
            {
                // show attendants
                pnl_Attendants.Show();

                // clear the items of the two list views
                lv_Attendants.Items.Clear();
                lv_NonAttendants.Items.Clear();

                List <Teacher> attending     = teacher_Service.GetAttending();
                List <Teacher> non_attending = teacher_Service.GetNonAttending();

                foreach (Teacher t in attending)
                {
                    ListViewItem li = new ListViewItem(t.Id.ToString());

                    li.Tag = t;
                    li.SubItems.Add(t.FirstName);
                    li.SubItems.Add(t.LastName);
                    li.SubItems.Add(t.RoomNumber.ToString());
                    lv_Attendants.Items.Add(li);
                }

                foreach (Teacher t in non_attending)
                {
                    ListViewItem li = new ListViewItem(t.Id.ToString());

                    li.Tag = t;
                    li.SubItems.Add(t.FirstName);
                    li.SubItems.Add(t.LastName);
                    li.SubItems.Add(t.RoomNumber.ToString());
                    lv_NonAttendants.Items.Add(li);
                }
            }
            else if (panelName == "Activities")
            {
                //show activities panel
                pnl_Activity.Show();

                // fill the activities listview within the panel with a list of activities
                List <Activity> activitiesList = activity_Service.GetActivities();

                // clear the listview before filling it again
                listViewActivities.Items.Clear();


                foreach (Activity a in activitiesList)
                {
                    ListViewItem List = new ListViewItem(a.ActivityID.ToString());
                    List.Tag = a;
                    List.SubItems.Add(a.Name);
                    List.SubItems.Add(a.Date);
                    List.SubItems.Add(a.NStudent.ToString());
                    List.SubItems.Add(a.NGuide.ToString());


                    listViewActivities.Items.Add(List);
                    //List view task (right arrow) then View and then details to see the columns
                }
            }
            else if (panelName == "Roster")
            {
                //show Roster panel
                pnl_Roster.Show();

                // fill the Roster listview within the panel with a list of activities
                List <Activity> RosterList = activity_Service.GetActivities();

                // clear the listview before filling it again
                listViewActivities.Items.Clear();

                foreach (Activity a in RosterList)
                {
                    ListViewItem List = new ListViewItem(a.Name.ToString());
                    List.SubItems.Add(a.Date);
                    List.SubItems.Add(a.Time.ToString());


                    listView_Roster.Items.Add(List);
                    //List view task (right arrow) then View and then details to see the columns
                }
            }
        }
Exemplo n.º 10
0
        private void showPanel(string panelName)
        {
            switch (panelName)
            {
            case "Students":
                Student_Service studService = new Student_Service();
                List <Student>  studentList = studService.GetStudents();

                ListViewStuPrint(listViewStudents, studentList);
                break;

            case "Lecturers":
                Lecturer_Service lecService = new Lecturer_Service();
                List <Teacher>   lecList    = lecService.GetTeachers();

                ListViewLecPrint(listView_Lec, lecList);
                break;

            case "Supervisors":
                Supervisor_Service supService = new Supervisor_Service();
                List <Supervisor>  supList    = supService.GetSupervisors();
                PrintSup(listView_Sup, supList);
                Activity_Service actService = new Activity_Service();
                List <Activity>  actList    = actService.GetActivities();
                cmb_ActivityID.DataSource    = actList;
                cmb_ActivityID.DisplayMember = "Name";
                cmb_ActivityID.ValueMember   = "ID";
                break;

            case "Rooms":
                Room_Service roomService = new Room_Service();
                List <Room>  roomList    = roomService.GetRooms();

                ListViewRoomPrint(listViewRooms, roomList);
                break;

            case "DrinkSup":
                Btn_Supplies_Save.Enabled  = false;
                Txt_Supplies_Id.Text       = string.Empty;
                Txt_Supplies_NewName.Text  = string.Empty;
                Txt_Supplies_NewStock.Text = string.Empty;
                Txt_Supplies_Price.Text    = string.Empty;
                Txt_Supplies_Sold.Text     = string.Empty;

                // fill the students listview within the students panel with a list of students
                Drink_Service drinkService = new Drink_Service();
                List <Drink>  DrinkList    = drinkService.GetDrinks();

                ListViewStockPrint(Lst_Supplies, DrinkList);
                break;

            case "Activities":
                Dtp_Activities_TimePart.Format       = DateTimePickerFormat.Custom;
                Dtp_Activities_TimePart.CustomFormat = "hh:mm tt";
                Dtp_Activities_TimePart.ShowUpDown   = true;

                Txt_Activities_Id.Text          = "";
                Txt_Activities_Description.Text = "";
                Txt_Activities_Location.Text    = "";
                Txt_Activities_Name.Text        = "";
                Dtp_Activities_DatePart.Value   = DateTime.Today;
                Dtp_Activities_TimePart.Value   = DateTime.UtcNow;

                Activity_Service actServe     = new Activity_Service();
                List <Activity>  ActivityList = actServe.GetActivities();

                ListViewActivitiesPrint(Lst_Activities, ActivityList);
                break;

            case "CashRegister":
                FillRegistryStudents();
                FillRegistryDrinks();
                Btn_Register_Checkout.Enabled = false;
                break;

            case "RevRep":
                mcRev.MaxDate = DateTime.Today;
                PrintReport();
                break;

            case "Timetable":
                Timetable_Service timeServ      = new Timetable_Service();
                List <Timetable>  TimetableList = timeServ.GetTimetable();

                ListViewTimetablePrint(listViewTimetable, TimetableList);
                break;

            default:
                break;
            }
        }
Exemplo n.º 11
0
        private void showPanel(string panelName)
        {
            //Hide all panels
            HideAllPanels();

            if (panelName == "Dashboard")
            {
                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }

            else if (panelName == "Students")
            {
                // show students
                pnl_Students.Show();

                // clear the listview before filling it again
                listViewStudents.Clear();

                // fill the students listview within the students panel with a list of students
                Student_Service studService = new Student_Service();
                List <Student>  studentList = studService.GetStudents();

                ColumnHeader id = new ColumnHeader();
                id.Text = "StudentID";

                ColumnHeader firstName = new ColumnHeader();
                firstName.Text = "FirstName";

                ColumnHeader lastName = new ColumnHeader();
                lastName.Text = "LastName";

                ColumnHeader origin = new ColumnHeader();
                origin.Text = "Origin";

                ColumnHeader dateOfBirth = new ColumnHeader();
                dateOfBirth.Text = "BirthDate";



                listViewStudents.Columns.AddRange(new ColumnHeader[] { id, firstName, lastName, origin, dateOfBirth });


                foreach (Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.StudentId.ToString(), 0);
                    li.SubItems.Add(s.FirstName);
                    li.SubItems.Add(s.LastName);
                    li.SubItems.Add(s.Origin);
                    li.SubItems.Add(s.BirthDate.ToString("dd-MM-yyyy"));
                    listViewStudents.Items.Add(li);
                }

                listViewStudents.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                listViewStudents.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            }

            else if (panelName == "Lecturers")
            {
                // show lecturers
                pnl_lecturer.Show();

                // clear the listview before filling it again
                lvlecturer.Items.Clear();

                // fill the students listview within the students panel with a list of students
                SomerenLogic.lecturer_Service lectService = new SomerenLogic.lecturer_Service();
                List <Lecturer> lecturerList = lectService.Getlecturers();

                foreach (SomerenModel.Lecturer l in lecturerList)
                {
                    ListViewItem li = new ListViewItem(new[] { l.number.ToString(), l.firstName, l.lastName, l.specialisation });
                    lvlecturer.Items.Add(li);
                }

                lvlecturer.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                lvlecturer.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            }

            else if (panelName == "room_panel")
            {
                //show rooms
                pnl_Room.Show();

                Room_Service room_Service = new Room_Service();
                List <Room>  RoomList     = room_Service.GetRooms();

                //clear listview before filling it
                listViewRoom.Items.Clear();

                //fill up list view
                foreach (Room r in RoomList)
                {
                    ListViewItem Item = new ListViewItem(r.Number.ToString());

                    if (r.Type)
                    {
                        Item.SubItems.Add("Teacher");
                    }
                    else
                    {
                        Item.SubItems.Add("Students");
                    }
                    Item.SubItems.Add(r.Capacity.ToString());
                    Item.Tag = r;

                    listViewRoom.Items.Add(Item);
                }

                listViewStudents.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            }

            else if (panelName == "Drinks")
            {
                //show drinks
                pnl_Drinks.Show();

                RefreshDrinkPanel();

                listViewDrinks.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                listViewDrinks.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            }

            else if (panelName == "Order History")
            {
                //show cash register
                pnl_OrderHistory.Show();

                Transaction_Service transactionService = new Transaction_Service();
                List <Transaction>  transactions       = transactionService.GetAllTransactions();
                List <int>          transactionIDs     = new List <int>();

                listViewOrderHistory.Items.Clear();

                //NOT MANDATORY + STILL NEEDS FIXING (showing a history log of past orders)
                foreach (Transaction t in transactions)
                {
                    ListViewItem li;
                    if (!transactionIDs.Contains(t.transactionId))
                    {
                        transactionIDs.Add(t.transactionId);

                        li = new ListViewItem(t.transactionId.ToString(), 0);
                        li.SubItems.Add(t.transactionDate.ToString("dd/MM/yyyy HH:mm"));
                        li.SubItems.Add(t.drink.DrinkID.ToString());
                        li.SubItems.Add(t.student.StudentId.ToString());
                        li.SubItems.Add(t.totalPrice.ToString("€ 0.00"));

                        listViewOrderHistory.Items.Add(li);
                    }
                }
                listViewOrderHistory.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            }

            else if (panelName == "Revenue Report")
            {
                pnl_RevenueReport.Show();
            }

            else if (panelName == "Activities")
            {
                //Show panel for activities
                pnl_Activities.Show();

                RefreshActivityPanel();
            }
            else if (panelName == "Supervisor_list")
            {
                Supervisor_list.Show();

                Supervisor_Service supervisor_service = new Supervisor_Service();

                // supervisor_service = listViewActivities.SelectedItems[0].Tag;
                Activity activityID = (Activity)listViewActivities.SelectedItems[0].Tag;

                List <Supervision> supervisors = supervisor_service.GetSupervisorsbyid(activityID.activityID);
                Supervisor_listview.Items.Clear();
                lecturer_list.Items.Clear();
                foreach (Supervision s in supervisors)
                {
                    ListViewItem item = new ListViewItem(s.ActivityId.ToString());
                    item.SubItems.Add(s.lecturer.number.ToString());
                    item.SubItems.Add(s.StartTime.ToString());
                    item.SubItems.Add(s.EndTime.ToString());
                    item.SubItems.Add(s.TeacherFullName);
                    item.SubItems.Add(s.lecturer.firstName);

                    item.Tag = s;
                    Supervisor_listview.Items.Add(item);
                }
                lecturer_Service Service_lecturer = new lecturer_Service();
                List <Lecturer>  lecturers        = Service_lecturer.Getlecturers();
                foreach (Lecturer l in lecturers)
                {
                    ListViewItem lecturer_item = new ListViewItem(l.number.ToString());
                    lecturer_item.SubItems.Add(l.firstName);
                    lecturer_item.SubItems.Add(l.lastName);
                    lecturer_item.Tag = l;
                    lecturer_list.Items.Add(lecturer_item);
                }
            }
        }