コード例 #1
0
        void DisplayListViewActivity()
        {
            SomerenLogic.Activity_Service activityService = new SomerenLogic.Activity_Service();
            List <Activity> activityList = activityService.GetActivities();

            listViewActivity.Clear();
            //add columns and allign
            listViewActivity.View = View.Details;
            listViewActivity.Columns.Add("Activity ID");
            listViewActivity.Columns[0].Width = 80;
            listViewActivity.Columns.Add("Description");
            listViewActivity.Columns[1].Width = 80;
            listViewActivity.Columns.Add("Number of students");
            listViewActivity.Columns[2].Width = 80;
            listViewActivity.Columns.Add("Number of supervisors");
            listViewActivity.Columns[3].Width = 80;

            foreach (SomerenModel.Activity s in activityList)
            {
                ListViewItem li = new ListViewItem(s.ActivityID.ToString());
                //li.SubItems.Add(s.ActivityID.ToString());
                li.SubItems.Add(s.Description);
                li.SubItems.Add(s.NumberOfStudents.ToString());
                li.SubItems.Add(s.NumberOfSupervisors.ToString());
                listViewActivity.Items.Add(li);
            }
        }
コード例 #2
0
        void DisplayActivityID()
        {
            SomerenLogic.Activity_Service activityService = new SomerenLogic.Activity_Service();
            List <Activity> activityList = activityService.GetActivities();

            foreach (SomerenModel.Activity item in activityList)
            {
                if (item != null)
                {
                    comboBoxChange.Items.Add(item.ActivityID);
                    comboBoxRemove.Items.Add(item.ActivityID);
                }
            }
        }
コード例 #3
0
        public bool isAvailableBetween(Teacher teacher, DateTime startDateTime, DateTime endDateTime)   // a2
        {
            Participant_Service participant_Service = new Participant_Service();
            Activity_Service    activity_Service    = new Activity_Service();

            List <Participant> participants = participant_Service.getParticipansByUser(teacher);

            foreach (Participant participant in participants)
            {
                Activity activity = activity_Service.getActivityById(participant.ActivityId); // a1

                if (!(endDateTime < activity.ActivityStartDate || startDateTime > activity.ActivityEndDate))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();


                // show dashboard
                pnl_Dashboard.Show();
                imgDashboardLogo.Show();
            }
            else if (panelName == "Students")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();


                // show students
                pnl_Students.Show();
                imgStudentsLogo.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.Items.Clear();

                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    li.SubItems.Add(s.Name);
                    li.SubItems.Add(s.BirthDate.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Teachers")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();


                // show Teachers
                pnl_Teachers.Show();
                imgTeachersLogo.Show();



                // fill the teacher listview within the teacher panel with a list of teacher
                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 t in teacherList)
                {
                    string supervisor;

                    if (t.IsSupervisor == true)
                    {
                        supervisor = "Yes";
                    }
                    else
                    {
                        supervisor = "No";
                    }

                    ListViewItem list = new ListViewItem(t.Number.ToString());
                    list.SubItems.Add(t.Name);
                    list.SubItems.Add(supervisor);
                    listViewTeachers.Items.Add(list);
                }
            }
            else if (panelName == "Rooms")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();

                // show Rooms
                pnl_Rooms.Show();
                imgRoomsLogo.Show();

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

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

                foreach (SomerenModel.Room r in roomList)
                {
                    ListViewItem li = new ListViewItem(r.Number.ToString());
                    listViewRooms.Items.Add(li);
                    li.SubItems.Add(r.Capacity.ToString());
                    li.SubItems.Add(r.Type.ToString());
                }
            }
            else if (panelName == "DrinkSupply")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();


                // show Rooms
                pnl_DrinkSupply.Show();



                // fill the drank listview within the drank panel with a list of drank
                SomerenLogic.Drank_Service drank_Service = new SomerenLogic.Drank_Service();
                List <Drank> drankList = drank_Service.GetDrank();

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

                foreach (SomerenModel.Drank d in drankList)
                {
                    ListViewItem li = new ListViewItem(d.Name);
                    listViewDrankVoorraad.Items.Add(li);
                    li.SubItems.Add(d.Number.ToString());
                    li.SubItems.Add(d.Voorraad.ToString());
                    li.SubItems.Add(d.Prijs.ToString());

                    if (d.Voorraad < 10)
                    {
                        li.SubItems.Add("te laag");
                    }
                    else
                    {
                        li.SubItems.Add("Genoeg");
                    }
                }
            }
            else if (panelName == "DrinkSupply")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();


                // show Rooms
                pnl_DrinkSupply.Show();
            }
            else if (panelName == "Revenue")
            {
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();

                pnl_Revenue.Show();

                DateTime startDate = dateTimePickerStartDate.Value;
                DateTime endDate   = dateTimePickerEndDate.Value;

                DateTime startDateOnly = startDate.Date;
                DateTime endDateOnly   = endDate.Date;

                SomerenLogic.Revenue_Service revenueService = new SomerenLogic.Revenue_Service();
                List <Revenue> revenueList = revenueService.GetRevenue();

                listViewRevenue.Items.Clear();

                if (startDate <= endDate)
                {
                    int totalSales = 0, totalRevenue = 0, numberOfStudents = 0;

                    List <int> studentList = new List <int>();

                    foreach (SomerenModel.Revenue r in revenueList)
                    {
                        if (startDateOnly == r.Date || endDateOnly == r.Date)
                        {
                            totalSales++;
                            totalRevenue += r.Price;

                            if (studentList.IndexOf(r.StudentNumber) < 0)
                            {
                                studentList.Add(r.StudentNumber);
                                numberOfStudents++;
                            }
                        }
                    }

                    ListViewItem list = new ListViewItem(totalSales.ToString());
                    list.SubItems.Add(totalRevenue.ToString());
                    list.SubItems.Add(numberOfStudents.ToString());
                    listViewRevenue.Items.Add(list);
                }
                else
                {
                    MessageBox.Show("Start date can't be higher than end date", "Error");
                }
            }
            else if (panelName == "CashRegister")
            {
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_Revenue.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();

                pnl_CashRegister.Show();

                SomerenLogic.CashRegister_Service cashRegisterService = new SomerenLogic.CashRegister_Service();
                List <CashRegister> cashRegisters = cashRegisterService.GetCashRegisters();

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

                listViewCRStudents.Items.Clear();
                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    listViewCRStudents.Items.Add(li);
                    li.SubItems.Add(s.Name);
                }
                listViewCRDrank.Items.Clear();
                foreach (SomerenModel.CashRegister c in cashRegisters)
                {
                    ListViewItem li = new ListViewItem(c.DrankID.ToString());
                    listViewCRDrank.Items.Add(li);
                    li.SubItems.Add(c.DrankNaam);
                }
            } //meneer otter kan geen dammen bouwen want hij is geen bever
            else if (panelName == "Activity")
            {
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Schedule.Hide();
                pnl_Registratie.Hide();

                pnl_Activity.Show();

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

                listViewActivity.Items.Clear();
                foreach (SomerenModel.Activity A in activities)
                {
                    ListViewItem li = new ListViewItem(A.activityID.ToString());
                    listViewActivity.Items.Add(li);
                    li.SubItems.Add(A.activityName);
                    li.SubItems.Add(A.numberOfStudents.ToString());
                    li.SubItems.Add(A.numerOfDocents.ToString());
                }
            }
            else if (panelName == "Schedule")
            {
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Registratie.Hide();

                pnl_Schedule.Show();

                SomerenLogic.Schedule_Service scheduleService = new SomerenLogic.Schedule_Service();
                List <Schedule> schedules = scheduleService.GetSchedules();

                listViewSchedule.Items.Clear();

                foreach (SomerenModel.Schedule S in schedules)
                {
                    ListViewItem li = new ListViewItem(S.RoosterID.ToString());

                    //li.SubItems.Add(S.RoosterID.ToString());
                    li.SubItems.Add(S.Supervisors.ToString());

                    DateTime date       = S.StartDate.Date;
                    string   dateString = date.ToString("dd-MM-yyyy");
                    li.SubItems.Add(dateString);

                    string timeString = S.StartTime.ToString(@"hh\:mm");
                    li.SubItems.Add(timeString);

                    timeString = S.EndTime.ToString(@"hh\:mm");
                    li.SubItems.Add(timeString);


                    listViewSchedule.Items.Add(li);
                }
            }
            else if (panelName == "Registratie")
            {
                pnl_Dashboard.Hide();
                imgDashboardLogo.Hide();
                pnl_Teachers.Hide();
                imgTeachersLogo.Hide();
                pnl_Students.Hide();
                imgStudentsLogo.Hide();
                pnl_Rooms.Hide();
                imgRoomsLogo.Hide();
                pnl_DrinkSupply.Hide();
                pnl_Revenue.Hide();
                pnl_CashRegister.Hide();
                pnl_Activity.Hide();
                pnl_Schedule.Hide();

                pnl_Registratie.Show();
            }
        }
コード例 #5
0
ファイル: SomerenUI.cs プロジェクト: Sholden8340/Someren1920F
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                selectPanel(panelName);
            }
            else if (panelName == "Students")
            {
                selectPanel(panelName); //hide other panels and show relevant

                // 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();
                listViewStudents.View = View.Details;       // Enable rows
                listViewStudents.Columns.Add("Student ID"); // Add colums
                listViewStudents.Columns.Add("First Name");
                listViewStudents.Columns.Add("Last Name");
                listViewStudents.Columns.Add("Date Of Birth");

                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(new String[] { s.Number.ToString(), s.FName, s.LName, s.BirthDate.ToString() });
                    listViewStudents.Items.Add(li);                                            // Add each student to new listitem row
                }
                listViewStudents.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); //Auto resize colums to fit data
                listViewStudents.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);    // Make sure headers fit
            }
            else if (panelName == "Teachers")
            {
                selectPanel(panelName);

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

                // clear the listview before filling it again
                listViewTeachers.Clear();
                listViewTeachers.View = View.Details;
                listViewTeachers.Columns.Add("Teacher_ID");
                listViewTeachers.Columns.Add("First Name");
                listViewTeachers.Columns.Add("Subject");

                foreach (SomerenModel.Teacher t in TeacherList)
                {
                    ListViewItem li = new ListViewItem(new String[] { t.Id.ToString(), t.TName, t.Subject });
                    listViewTeachers.Items.Add(li);
                }

                listViewTeachers.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); //Auto resize colums to fit data
                listViewTeachers.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);    // Make sure headers fit
            }
            else if (panelName == "Cash_Register")
            {
                selectPanel(panelName);

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

                //SomerenLogic.Drink_Service drink_Service = new SomerenLogic.Drink_Service();
                //List<Drinks> drinkList = drink_Service.GetDrinks();

                List <Drinks> drinkList = new List <Drinks>();
                Drinks        drink     = new Drinks();
                {
                    drink.Drinkid    = 1;
                    drink.DrinkName  = "Test Drink";
                    drink.Stock      = 10;
                    drink.DrinkType  = "Alcohlic";
                    drink.Price      = 2;
                    drink.TotalSales = 200;
                }

                drinkList.Add(drink);

                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(new String[] { s.Number.ToString(), s.FName, s.LName, s.BirthDate.ToString() });
                    registerListStudents.Items.Add($"{s.Number} {s.FName} {s.LName}");
                }

                foreach (SomerenModel.Drinks d in drinkList)
                {
                    ListViewItem li = new ListViewItem(new String[] { d.DrinkName }, d.Price.ToString());
                    registerListDrinks.Items.Add($"{d.Drinkid} {d.DrinkName} - {d.Price} Tokens");
                }
            }
            else if (panelName == "Activities")
            {
                selectPanel(panelName);

                // fill the teachers listview within the teacher panel with a list of lecturers
                SomerenLogic.Activity_Service activityService = new SomerenLogic.Activity_Service();
                List <Activity> ActivityList = activityService.GetActivities();

                // clear the listview before filling it again
                groupBoxEdit.Hide();//hide edit box
                textBoxActivityName.Clear();
                textBoxActivityDescription.Clear();
                textBoxActivityStudents.Value    = 0;
                textBoxActivitySupervisors.Value = 0;



                listViewActivities.Clear();
                listViewActivities.View = View.Details;
                listViewActivities.Columns.Add("ID");
                listViewActivities.Columns.Add("Name");
                listViewActivities.Columns.Add("Description");
                listViewActivities.Columns.Add("No. of Students");
                listViewActivities.Columns.Add("No. of Teachers");

                foreach (SomerenModel.Activity a in ActivityList)
                {
                    ListViewItem li = new ListViewItem(new String[] { a.ID.ToString(), a.Name, a.Description, a.NumberOfStudents.ToString(), a.NumberOfSupervisors.ToString() });

                    li.Tag = "act_" + a.Name;
                    listViewActivities.Items.Add(li);
                }

                listViewActivities.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); //Auto resize colums to fit data
                listViewActivities.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);    // Make sure headers fit
            }
        }
コード例 #6
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Activity_DAO activity = new Activity_DAO();

            listViewActivity.Clear();
            if (txtActivityID.Text == "" && comboBoxChange.Text == "")
            {
                DialogResult dialogResult = MessageBox.Show("Are you sure that you wish to remove this activity?", "Remove validation", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    activity.ActivityRemover(int.Parse(comboBoxRemove.Text));
                    comboBoxChange.Items.Clear();
                    comboBoxRemove.Items.Clear();
                    DisplayActivityID();
                }
                else if (dialogResult == DialogResult.No)
                {
                }
                comboBoxRemove.ResetText();
            }
            else if (txtActivityID.Text != "" && comboBoxChange.Text == "")
            {
                SomerenLogic.Activity_Service activityService = new SomerenLogic.Activity_Service();
                List <Activity> activityList = activityService.GetActivities();
                bool            check        = false;
                foreach (var s in activityList)
                {
                    if (s.ActivityID == int.Parse(txtActivityID.Text))
                    {
                        MessageBox.Show("You can't add an activity with the same name");
                        break;
                    }
                    else
                    {
                        check = true;
                    }
                }
                if (check == true)
                {
                    activity.ActivityAdder(int.Parse(txtActivityID.Text), txtDescriptionAdd.Text, int.Parse(txtNOfStudentsAdd.Text), int.Parse(txtNOfSupervisorsAdd.Text));
                    txtActivityID.ResetText();
                    txtDescriptionAdd.ResetText();
                    txtNOfStudentsAdd.ResetText();
                    txtNOfSupervisorsAdd.ResetText();
                    comboBoxChange.Items.Clear();
                    comboBoxRemove.Items.Clear();
                    DisplayActivityID();
                }
                else if (check == false)
                {
                    txtActivityID.ResetText();
                    txtDescriptionAdd.ResetText();
                    txtNOfStudentsAdd.ResetText();
                    txtNOfSupervisorsAdd.ResetText();
                }
            }
            else if (comboBoxChange.Text != "")
            {
                activity.ActivityChanger(int.Parse(comboBoxChange.Text), txtDescriptionAdd.Text, int.Parse(txtNOfStudentsAdd.Text), int.Parse(txtNOfSupervisorsAdd.Text));
                comboBoxChange.ResetText();
                txtDescriptionAdd.ResetText();
                txtNOfStudentsAdd.ResetText();
                txtNOfSupervisorsAdd.ResetText();
            }
            DisplayListViewActivity();
        }
コード例 #7
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                HideAllPanels();

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

                // 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();

                //add columns
                listViewStudents.Columns.Add("Student number");
                listViewStudents.Columns[0].Width = 100;
                listViewStudents.Columns.Add("First name");
                listViewStudents.Columns[1].Width = 100;
                listViewStudents.Columns.Add("Last name");
                listViewStudents.Columns[2].Width = 100;

                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    li.SubItems.Add(s.FirstName);
                    li.SubItems.Add(s.LastName);
                    listViewStudents.Items.Add(li);
                }
            }

            else if (panelName == "Lecturers")
            {
                // Hide other panels
                HideAllPanels();

                // Show lecturers panel; clear listView
                pnl_Lecturers.Show();
                listViewLecturers.Clear();

                // Add columns
                listViewLecturers.Columns.Add("Lecturer ID");
                listViewLecturers.Columns[0].Width = 100;
                listViewLecturers.Columns.Add("First Name");
                listViewLecturers.Columns[1].Width = 100;
                listViewLecturers.Columns.Add("Last Name");
                listViewLecturers.Columns[2].Width = 100;
                listViewLecturers.Columns.Add("Is Supervisor");
                listViewLecturers.Columns[3].Width = 100;

                // Fill the lecturers listview within the lecturers panel with a list of lecturers
                SomerenLogic.Lecturer_Service lecService = new SomerenLogic.Lecturer_Service();
                List <Teacher> lecturerList = lecService.GetTeachers();

                // Iterate over teachers
                foreach (SomerenModel.Teacher t in lecturerList)
                {
                    ListViewItem li = new ListViewItem(t.Number.ToString());
                    li.SubItems.Add(t.FirstName);
                    li.SubItems.Add(t.LastName);

                    // Parse supervisor status which is either 0 or 1.
                    if (t.Supervisor == 1)
                    {
                        li.SubItems.Add("Yes");
                    }
                    else
                    {
                        li.SubItems.Add("No");
                    }
                    listViewLecturers.Items.Add(li);
                }
            }
            else if (panelName == "Drinks Supplies")
            {
                HideAllPanels();
                //Show the panel
                pnl_Drinks.Show();
                listViewDrinks.Clear();

                //Add columns
                listViewDrinks.Columns.Add("Drink");
                listViewDrinks.Columns[0].Width = 100;
                listViewDrinks.Columns.Add("Token");
                listViewDrinks.Columns[1].Width = 100;
                listViewDrinks.Columns.Add("Stock");
                listViewDrinks.Columns[2].Width = 100;
                listViewDrinks.Columns.Add("Amount");
                listViewDrinks.Columns[3].Width = 50;

                // Fill the lecturers listview within the lecturers panel with a list of lecturers
                SomerenLogic.Drink_Service drinkService = new SomerenLogic.Drink_Service();
                List <Drink> drinksList = drinkService.GetDrinks();

                foreach (SomerenModel.Drink d in drinksList)
                {
                    ListViewItem li = new ListViewItem(d.Name);
                    li.SubItems.Add(d.Token.ToString());
                    li.SubItems.Add(d.Stock.ToString());
                    d.Amount = d.Stock;

                    //listing the sufficiency
                    if (d.Amount >= 10)
                    {
                        li.SubItems.Add("✔️");
                    }
                    else
                    {
                        li.SubItems.Add("⚠️");
                    }
                    li.SubItems.Add(d.DrinksSold.ToString());


                    listViewDrinks.Items.Add(li);
                }
            }
            else if (panelName == "Edit drinks")
            {
                pnl_Drinks.Hide();

                //show panel
                pnl_UpdateDrinks.Show();
            }

            else if (panelName == "Revenue Report")
            {
                HideAllPanels();

                SomerenLogic.Report_Service reportService = new SomerenLogic.Report_Service();
                List <Report> reportsList = reportService.GetReports();

                pnl_Report.Show();
            }
            else if (panelName == "Activities")
            {
                HideAllPanels();
                pnl_Activities.Show();

                // fill the students listview within the students panel with a list of students
                SomerenLogic.Activity_Service actService = new SomerenLogic.Activity_Service();
                List <Activity> studentList = actService.GetActivities();

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

                //add columns
                listViewActivities.Columns.Add("activity_id");
                listViewActivities.Columns[0].Width = 100;
                listViewActivities.Columns.Add("name");
                listViewActivities.Columns[1].Width = 100;
                listViewActivities.Columns.Add("number of students");
                listViewActivities.Columns[2].Width = 100;
                listViewActivities.Columns.Add("number of supervisors");
                listViewActivities.Columns[2].Width = 100;

                foreach (SomerenModel.Activity s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.activity_id.ToString());
                    li.SubItems.Add(s.name);
                    li.SubItems.Add(s.numberofstudents.ToString());
                    li.SubItems.Add(s.numberofsupervisors.ToString());

                    listViewActivities.Items.Add(li);
                }
            }
            else if (panelName == "Supervisors")
            {
                HideAllPanels();

                //show panel
                pnl_Supervisor.Show();
                listViewSupervisors.Clear();

                DisplayAddCB();
                DisplayRemoveCB();

                SomerenLogic.Supervisor_Service supservice = new SomerenLogic.Supervisor_Service();
                List <Supervisor> supList = supservice.GetSupervisors();

                //Add columns
                listViewSupervisors.View = View.Details;
                listViewSupervisors.Columns.Add("Lecturer ID");
                listViewSupervisors.Columns[0].Width = 80;
                listViewSupervisors.Columns.Add("Name");
                listViewSupervisors.Columns[1].Width = 120;

                foreach (SomerenModel.Supervisor s in supList)
                {
                    ListViewItem li = new ListViewItem(s.SupervisorID.ToString());
                    li.SubItems.Add(s.Name);
                    listViewSupervisors.Items.Add(li);
                }
            }

            else if (panelName == "Time Table")
            {
                HideAllPanels();
                clearTimetable();
                SomerenLogic.Timetable_Service ttService = new SomerenLogic.Timetable_Service();
                List <Activity> activities = ttService.GetTimetableData();

                Dictionary <int, string> teacherNames = ttService.GetTeacherNames();

                // Sort activities by day
                DateTime actdate = activities[0].date;
                foreach (Activity act in activities)
                {
                    //int teacher1Id = (int)act.supervisor1;
                    string t1name = TeacherLookup(teacherNames, act.supervisor1);
                    string t2name = TeacherLookup(teacherNames, act.supervisor2);

                    // Check if no supervisor is assigned
                    if (t1name == "" && t2name == "")
                    {
                        t1name = "UNSUPERVISED!";
                    }

                    string day   = act.date.DayOfWeek.ToString();
                    int    month = act.date.Month;
                    int    year  = act.date.Year;

                    // Only check activities that are within the correct year and month.
                    if (year == 2016 && month == 4)
                    {
                        // Create a list view item
                        string       time = act.date.ToString("H:mm");
                        ListViewItem item = new ListViewItem(time);
                        item.SubItems.Add(act.name);
                        item.SubItems.Add(t1name);
                        item.SubItems.Add(t2name);

                        // Switch case that filters activities by weekday. Since only monday and tuesday are relevant,
                        // those values are hardcoded as well.
                        switch (day)
                        {
                        case "Monday":
                            lv_mon.Items.Add(item);
                            break;

                        case "Tuesday":
                            lv_tue.Items.Add(item);
                            break;
                        }
                    }
                }
                SetColumnSizes();
                pnl_Timetable.Show();
            }
        }