Пример #1
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();
            }
        }
Пример #2
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();


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


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


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

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


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


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

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

                int totalSales = 0, totalRevenue = 0, numberOfStudents = 0;
                
                List<int> studentList = new List<int>();

                foreach (SomerenModel.Revenue r in revenueList)
                {
                    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 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_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();

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

                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
        }