Esempio n. 1
0
        // Show the rooms
        private void roomsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showPanel("Students");
            lbl_Students.Text = ("Rooms");
            listViewStudents.Items.Clear();

            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());
                listViewStudents.Items.Add(li);
            }
        }
Esempio n. 2
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();
                pnl_Rooms.Hide();

                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            else if (panelName == "Students")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Rooms.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.Name);
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Rooms")
            {
                // hiding other panels except for rooms
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();

                // show room panel
                pnl_Rooms.Show();

                // filling rooms listview with a list of rooms (from room 201 - 225)
                SomerenLogic.Room_Service roService = new SomerenLogic.Room_Service();
                List <Room> roomList = roService.GetRooms();

                // clear the listview, also add columns
                listView_room.Clear();
                listView_room.Columns.Add("Number");
                listView_room.Columns.Add("Type");
                listView_room.Columns.Add("Capacity");

                foreach (SomerenModel.Room r in roomList)
                {
                    ListViewItem li = new ListViewItem(r.Number.ToString());
                    if (r.Type == false)
                    {
                        string x = "student";
                        li.SubItems.Add(x);
                    }
                    else
                    {
                        string y = "lecturer";
                        li.SubItems.Add(y);
                    }
                    li.SubItems.Add(r.Capacity.ToString());
                    listView_room.Items.Add(li);
                }
            }
        }
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();
                pnl_teachers.Hide();
                pnl_Rooms.Hide();
                pnl_Products.Hide();
                pnl_Orders.Hide();
                pnl_Sales.Hide();

                // show dashboard
                pnl_Dashboard.Show();
            }
            else if (panelName == "Students")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                pnl_Products.Hide();
                pnl_Orders.Hide();
                pnl_Sales.Hide();
                pnl_teachers.Hide();
                pnl_Rooms.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.Items.Clear();

                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.StudentID.ToString());
                    li.SubItems.Add(s.FirstName);
                    li.SubItems.Add(s.LastName);
                    li.SubItems.Add(s.EmailAddress);
                    li.SubItems.Add(s.PhoneNumber);
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Teachers")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                pnl_Products.Hide();
                pnl_Orders.Hide();
                pnl_Sales.Hide();
                pnl_Students.Hide();
                pnl_Rooms.Hide();

                // show teachers
                pnl_teachers.Show();

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

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

                foreach (SomerenModel.Teacher t in teacherList)
                {
                    ListViewItem li = new ListViewItem(t.TeacherID.ToString());
                    li.SubItems.Add(t.FirstName);
                    li.SubItems.Add(t.LastName);
                    li.SubItems.Add(t.EmailAddress);
                    li.SubItems.Add(t.PhoneNumber);
                    listViewteachers.Items.Add(li);
                }
            }
            else if (panelName == "Rooms")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                pnl_Products.Hide();
                pnl_Orders.Hide();
                pnl_Sales.Hide();
                pnl_Students.Hide();
                pnl_teachers.Hide();

                // show rooms
                pnl_Rooms.Show();

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

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

                foreach (SomerenModel.Room r in roomList)
                {
                    ListViewItem li = new ListViewItem(r.RoomID.ToString());
                    li.SubItems.Add(r.RoomType);
                    li.SubItems.Add(r.Capacity.ToString());
                    listViewRooms.Items.Add(li);
                }
            }
            else if (panelName == "Products")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                pnl_Rooms.Hide();
                pnl_Students.Hide();
                pnl_teachers.Hide();
                pnl_Orders.Hide();
                pnl_Sales.Hide();

                //show product panel
                pnl_Products.Show();

                SomerenLogic.Product_Service productService = new SomerenLogic.Product_Service();
                List <Product> productList = productService.GetProducts();

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

                foreach (SomerenModel.Product p in productList)
                {
                    ListViewItem li = new ListViewItem(p.Id.ToString());
                    li.SubItems.Add(p.Name);
                    li.SubItems.Add(p.PriceIncl.ToString("€0.00"));
                    li.SubItems.Add(p.Amount.ToString());
                    li.SubItems.Add(p.Description);
                    if (p.Amount < 10)
                    {
                        li.SubItems.Add("Voorraad bijna op");
                    }
                    else
                    {
                        li.SubItems.Add("Voldoende voorraad");
                    }
                    listViewProducts.Items.Add(li);
                }
            }
            else if (panelName == "Orders")
            {
                //hide all other panels
                pnl_Dashboard.Hide();
                pnl_Rooms.Hide();
                pnl_Students.Hide();
                pnl_teachers.Hide();
                pnl_Products.Hide();
                pnl_Sales.Hide();

                //show order panel
                pnl_Orders.Show();
                SomerenLogic.Student_Service studService = new SomerenLogic.Student_Service();
                List <Student> studentList = studService.GetStudents();

                foreach (SomerenModel.Student s in studentList)
                {
                    combo_Students.Items.Add(s.StudentID + " - " + s.FirstName + " " + s.LastName);
                }

                //fill products
                SomerenLogic.Product_Service productService = new SomerenLogic.Product_Service();
                List <Product> productList = productService.GetProducts();

                foreach (SomerenModel.Product p in productList)
                {
                    combo_Products.Items.Add(p.Id + " - " + p.Name);
                }
            }
            else if (panelName == "Sales")
            {
                // hide all others
                pnl_Dashboard.Hide();
                pnl_Rooms.Hide();
                pnl_Students.Hide();
                pnl_teachers.Hide();
                pnl_Products.Hide();
                pnl_Orders.Hide();

                // show sales
                pnl_Sales.Show();
            }
        }
Esempio n. 4
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();
            }
        }
Esempio n. 5
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);
            }
        }
        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();
            }
        }
Esempio n. 7
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
        }
Esempio n. 8
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();
                pnl_Teachers.Hide();
                pnl_Rooms.Hide();
                pnl_StockDrinks.Hide();
                pnl_CheckOut.Hide();

                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            else if (panelName == "Students")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Teachers.Hide();
                pnl_Rooms.Hide();
                pnl_StockDrinks.Hide();
                pnl_CheckOut.Hide();

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

                listViewStudents.View          = View.Details;
                listViewStudents.GridLines     = true;
                listViewStudents.FullRowSelect = true;

                // Aanmaken van kolommen
                listViewStudents.Columns.Add("Student Number", 100);
                listViewStudents.Columns.Add("First Name", 100);
                listViewStudents.Columns.Add("Last Name", 100);

                string[]     students = new string[3];
                ListViewItem itm;

                foreach (SomerenModel.Student s in studentList)
                {
                    students[0] = s.Number.ToString();
                    students[1] = s.FirstName;
                    students[2] = s.LastName;

                    itm = new ListViewItem(students);
                    listViewStudents.Items.Add(itm);
                }
            }
            else if (panelName == "Teachers")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Rooms.Hide();
                pnl_StockDrinks.Hide();
                pnl_CheckOut.Hide();

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

                listViewTeachers.View          = View.Details;
                listViewTeachers.GridLines     = true;
                listViewTeachers.FullRowSelect = true;

                // Aanmaken van kollomen
                listViewTeachers.Columns.Add("Teacher Number", 100);
                listViewTeachers.Columns.Add("First Name", 100);
                listViewTeachers.Columns.Add("Last Name", 100);
                listViewTeachers.Columns.Add("Guide", 50);

                string[]     teachers = new string[4];
                ListViewItem itm;

                foreach (SomerenModel.Teacher t in teacherList)
                {
                    // Items toevoegen aan een lijst
                    teachers[0] = t.Number.ToString();
                    teachers[1] = t.FirstName;
                    teachers[2] = t.LastName;
                    teachers[3] = t.Guide;

                    itm = new ListViewItem(teachers);
                    listViewTeachers.Items.Add(itm);
                }
            }
            else if (panelName == "Rooms")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Teachers.Hide();
                pnl_StockDrinks.Hide();
                pnl_CheckOut.Hide();

                // show rooms
                pnl_Rooms.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.Clear();

                listViewRooms.View          = View.Details;
                listViewRooms.GridLines     = true;
                listViewRooms.FullRowSelect = true;

                // Aanmaken van kolommen
                listViewRooms.Columns.Add("Room Number", 80);
                listViewRooms.Columns.Add("Capacity", 80);
                listViewRooms.Columns.Add("Room Type", 80);

                string[]     rooms = new string[3];
                ListViewItem itm;

                foreach (SomerenModel.Room r in roomList)
                {
                    rooms[0] = r.Number.ToString();
                    rooms[1] = r.Capacity.ToString();
                    rooms[2] = r.Type;

                    itm = new ListViewItem(rooms);
                    listViewRooms.Items.Add(itm);
                }
            }
            else if (panelName == "StockDrinks")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Teachers.Hide();
                pnl_Rooms.Hide();
                pnl_CheckOut.Hide();

                // show stock
                pnl_StockDrinks.Show();

                // fill the listview with a list of the stock
                List <StockDrinks> stockList = stockDrinksService.GetStock();

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

                // laten zien van de tabel
                listViewStockDrinks.View          = View.Details;
                listViewStockDrinks.GridLines     = true;
                listViewStockDrinks.FullRowSelect = true;

                // Aanmaken van kollomen
                listViewStockDrinks.Columns.Add("Name of drink");
                listViewStockDrinks.Columns.Add("Stock");
                listViewStockDrinks.Columns.Add("Voucher price");
            }
            else if (panelName == "CheckOut")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Teachers.Hide();
                pnl_Rooms.Hide();
                pnl_StockDrinks.Hide();

                // show checkout
                pnl_CheckOut.Show();

                // lijsten
                List <Student>     studentList = studService.GetStudents();
                List <StockDrinks> drinkList   = stockDrinksService.GetStock();

                // listview students
                listViewStudentsCO.Clear();

                listViewStudentsCO.View       = View.Details;
                listViewStudentsCO.GridLines  = true;
                listViewStudentsCO.CheckBoxes = true;

                listViewStudentsCO.Columns.Add("Student Number", 80);
                listViewStudentsCO.Columns.Add("First Name", 80);
                listViewStudentsCO.Columns.Add("Last Name", 100);

                string[]     students = new string[3];
                ListViewItem itm;

                foreach (SomerenModel.Student s in studentList)
                {
                    students[0] = s.Number.ToString();
                    students[1] = s.FirstName;
                    students[2] = s.LastName;

                    itm = new ListViewItem(students);
                    listViewStudentsCO.Items.Add(itm);
                }

                // listview drinks
                listViewDrinksCO.Clear();

                listViewDrinksCO.View       = View.Details;
                listViewDrinksCO.GridLines  = true;
                listViewDrinksCO.CheckBoxes = true;

                listViewDrinksCO.Columns.Add("Name", 80);
                listViewDrinksCO.Columns.Add("Price", 70);
                listViewDrinksCO.Columns.Add("Stock", 70);

                string[] drinks = new string[3];

                foreach (SomerenModel.StockDrinks d in drinkList)
                {
                    drinks[0] = d.Name;
                    drinks[1] = d.Price.ToString();
                    drinks[2] = d.Stock.ToString();

                    itm = new ListViewItem(drinks);
                    listViewDrinksCO.Items.Add(itm);
                }
            }
        }
Esempio n. 9
0
        private void showPanel(string panelName)
        {
            try
            {
                if (panelName == "Dashboard")
                {
                    // hide all other panels
                    pnl_Students.Hide();
                    //thigns i added
                    pnl_Teachers.Hide();
                    pnl_Students.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    pnl_Activities.Hide();
                    panel_TimeTable.Hide();
                    pnl_Supervisors.Hide();



                    //this is for the barservice
                    pnl_BarService.Hide();
                    // show dashboard
                    pnl_Dashboard.Show();
                    img_Dashboard.Show();
                }
                else if (panelName == "Students")
                {
                    // hide all other panels
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    //things i added
                    pnl_Teachers.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    pnl_Activities.Hide();
                    panel_TimeTable.Hide();
                    pnl_Supervisors.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();

                    listViewStudents.Clear();
                    listViewStudents.View = View.Details;
                    listViewStudents.Columns.Add("Student Id", 100, HorizontalAlignment.Left);
                    listViewStudents.Columns.Add("First Name", 100, HorizontalAlignment.Left);
                    listViewStudents.Columns.Add("Last Name", 100, HorizontalAlignment.Left);
                    listViewStudents.Columns.Add("Class", 100, HorizontalAlignment.Left);
                    listViewStudents.Columns.Add("Contact Info", 100, HorizontalAlignment.Left);

                    // clear the listview before filling it again

                    foreach (SomerenModel.Student s in studentList)
                    {
                        ListViewItem li = new ListViewItem(s.Number.ToString());
                        li.SubItems.Add(s.FirstName);
                        li.SubItems.Add(s.LastName);
                        li.SubItems.Add(s.Group);
                        li.SubItems.Add(s.Contact);
                        listViewStudents.Items.Add(li);
                    }
                }
                else if (panelName == "Teachers")
                {
                    // hide all other panels
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    //things that i added -stephen
                    pnl_Students.Hide();
                    pnl_Rooms.Hide();
                    pnl_BarService.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    pnl_Activities.Hide();
                    panel_TimeTable.Hide();
                    pnl_Supervisors.Hide();



                    // show Teachers
                    pnl_Teachers.Show();


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

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

                    foreach (SomerenModel.Teacher t in teacherList)
                    {
                        ListViewItem ListofT = new ListViewItem(t.Number.ToString());
                        ListofT.SubItems.Add(t.firstName);
                        ListofT.SubItems.Add(t.lastName);
                        ListofT.SubItems.Add(t.supervisor);
                        ListofT.SubItems.Add(t.Department);
                        ListofT.SubItems.Add(t.Contact.ToString());
                        listViewTeachers.Items.Add(ListofT);
                    }

                    // this is for the display
                    listViewTeachers.GridLines     = true;
                    listViewTeachers.FullRowSelect = true;
                    listViewTeachers.View          = View.Details;
                    listViewTeachers.Columns.Add("Teacher ID", 100, HorizontalAlignment.Left);
                    listViewTeachers.Columns.Add("First Name", 100, HorizontalAlignment.Left);
                    listViewTeachers.Columns.Add("Last Name", 100, HorizontalAlignment.Left);
                    listViewTeachers.Columns.Add("Supervisor", 100, HorizontalAlignment.Left);
                    listViewTeachers.Columns.Add("Department", 100, HorizontalAlignment.Left);
                    listViewTeachers.Columns.Add("Contact info.", 100, HorizontalAlignment.Left);
                }
                else if (panelName == "Rooms")
                {
                    // hide all other panels
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    pnl_Students.Hide();
                    pnl_Teachers.Hide();
                    pnl_BarService.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    pnl_Activities.Hide();
                    panel_TimeTable.Hide();
                    pnl_Supervisors.Hide();



                    //show rooms
                    pnl_Rooms.Show();


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

                    // clear the listview before filling it again
                    listViewRooms.Clear();
                    listViewRooms.View = View.Details;
                    listViewRooms.Columns.Add("Room Id", 100, HorizontalAlignment.Left);
                    listViewRooms.Columns.Add("TypeOfRoom", 100, HorizontalAlignment.Left);
                    listViewRooms.Columns.Add("Taken/Not-Taken", 100, HorizontalAlignment.Left);
                    listViewRooms.Columns.Add("Size", 100, HorizontalAlignment.Left);



                    foreach (SomerenModel.Room r in roomList)
                    {
                        ListViewItem li = new ListViewItem(r.Room_Id.ToString());
                        li.SubItems.Add(r.Type);
                        li.SubItems.Add(r.Occupied);
                        li.SubItems.Add(r.Size.ToString());

                        listViewRooms.Items.Add(li);
                    }
                }
                else if (panelName == "Cash Register")
                {
                    pnl_Dashboard.Hide();
                    pnl_Students.Hide();
                    pnl_Teachers.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Show();
                    pnl_Drinks.Hide();
                    panel_TimeTable.Hide();
                    pnl_Supervisors.Hide();



                    SomerenLogic.Cash_Service studService = new SomerenLogic.Cash_Service();
                    //List<CashRegister> drList = studService.GetDrinks();
                    SomerenLogic.Student_Service ss = new SomerenLogic.Student_Service();
                    List <Student> stList           = ss.GetStudents();
                    comboBoxStudents.DataSource    = stList;
                    comboBoxStudents.DisplayMember = "Name";
                    //checkedListBoxDrinks.DataSource = drList;
                    checkedListBoxDrinks.DisplayMember = "Name";
                }

                else if (panelName == "Bar Service")
                {
                    // hide all other panels
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    pnl_Students.Hide();
                    pnl_Teachers.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    pnl_Activities.Hide();



                    //show the
                    //pnl_BarService.Show();
                }
                else if (panelName == "Drinks")
                {
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    pnl_Students.Hide();
                    pnl_Teachers.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Hide();
                    pnl_BarService.Hide();
                    pnl_Activities.Hide();
                    panel_TimeTable.Hide();
                    pnl_Supervisors.Hide();



                    pnl_Drinks.Show();

                    ShowData();
                }
                else if (panelName == "Sales Report")
                {
                    // hide all other panels
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    pnl_Students.Hide();
                    pnl_Teachers.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    pnl_Activities.Hide();
                    panel_TimeTable.Hide();
                    pnl_Supervisors.Hide();



                    StartCalendar.MaxDate = DateTime.Today;//this is for the calendar to only show the dates til today.


                    //show the
                    pnl_BarService.Show();

                    //this is to show all the transaction.. with no specific date, just all the current transaction in the
                    //the database.

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


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

                    foreach (SomerenModel.Revenue r in revenueList)
                    {
                        ListViewItem ListofRev = new ListViewItem((r.Students).ToString());//(r.Date.ToString("yyyy-dd-MM"));
                        //ListViewItem ListofRev = new ListViewItem((r.Date).ToString("dd-MM-yyyy"));
                        ListofRev.SubItems.Add((r.Price).ToString());
                        ListofRev.SubItems.Add((r.Prod_Sold).ToString());
                        ListofRev.SubItems.Add((r.Date).ToString("dd-MM-yyyy"));
                        ListofRev.SubItems.Add((r.Turnover).ToString());

                        listViewRevenue.Items.Add(ListofRev);
                    }


                    listViewRevenue.GridLines     = true;
                    listViewRevenue.FullRowSelect = true;
                    listViewRevenue.View          = View.Details;
                    listViewRevenue.Columns.Add("Student", 100, HorizontalAlignment.Left);
                    listViewRevenue.Columns.Add("Price", 100, HorizontalAlignment.Left);
                    listViewRevenue.Columns.Add("Amount product Sold", 120, HorizontalAlignment.Left);
                    listViewRevenue.Columns.Add("Date", 100, HorizontalAlignment.Left);
                    listViewRevenue.Columns.Add("Turnover", 100, HorizontalAlignment.Left);

                    //clear the list after for the display when the date is selecteds


                    lblmsg.Text   = "General overview of transaction";
                    lblStart.Text = "";
                    lblEnd.Text   = "";
                }
                else if (panelName == "Activities")
                {
                    //hide

                    // hide all other panels
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    pnl_Students.Hide();
                    pnl_Teachers.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    panel_TimeTable.Hide();
                    pnl_Supervisors.Hide();


                    //show
                    pnl_Activities.Show();

                    SomerenLogic.Activities_Service activityService = new SomerenLogic.Activities_Service();
                    List <Activity> activityList = activityService.GetActivity();

                    //clear listview before filling in the informations
                    listViewActivity.Clear();

                    //the informations that needs to be shown
                    foreach (SomerenModel.Activity a in activityList)
                    {
                        ListViewItem ListofActivities = new ListViewItem(a.ID.ToString());
                        ListofActivities.SubItems.Add((a.Description));
                        ListofActivities.SubItems.Add(a.numbOfStudent.ToString());
                        ListofActivities.SubItems.Add(a.numbOfTeacher.ToString());
                        ListofActivities.Tag = a;

                        listViewActivity.Items.Add(ListofActivities);
                    }

                    listViewActivity.GridLines     = true;
                    listViewActivity.FullRowSelect = true;
                    listViewActivity.View          = View.Details;
                    listViewActivity.Columns.Add("Activity ID", 100, HorizontalAlignment.Left);
                    listViewActivity.Columns.Add("Description", 100, HorizontalAlignment.Left);
                    listViewActivity.Columns.Add("Number Of Students", 100, HorizontalAlignment.Left);
                    listViewActivity.Columns.Add("Number Of Supervisors", 100, HorizontalAlignment.Left);
                }
                else if (panelName == "Supervisors")
                {
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    pnl_Students.Hide();
                    pnl_Teachers.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    pnl_BarService.Hide();
                    pnl_Activities.Hide();
                    panel_TimeTable.Hide();


                    pnl_Supervisors.Show();

                    //displaying datagridview in another method
                    DisplayDataSup();

                    //to get all the info from teacher's table
                    SomerenLogic.Teacher_Service teacherdb = new SomerenLogic.Teacher_Service();
                    List <Teacher> TeacherList             = teacherdb.GetTeachers();

                    combo_Teacher.DataSource = TeacherList;
                    //only displaying the first name in the combo box
                    combo_Teacher.DisplayMember = "FirstName";
                }
                //time table
                else if (panelName == "Time Table")
                {
                    pnl_Dashboard.Hide();
                    img_Dashboard.Hide();
                    pnl_Students.Hide();
                    pnl_Teachers.Hide();
                    pnl_Rooms.Hide();
                    pnl_Sales.Hide();
                    pnl_Drinks.Hide();
                    pnl_Activities.Hide();
                    pnl_BarService.Hide();
                    pnl_Activities.Hide();
                    pnl_Supervisors.Hide();

                    //to show
                    panel_TimeTable.Show();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                StreamWriter writer = new StreamWriter($"errorLog.txt", true);
                writer.WriteLine($"{ DateTime.Now}, error message:  {e.Message}");
                writer.Close();
            }
        }
Esempio n. 10
0
        private void showPanel(string panelName)
        {
            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
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                lbl_checkedview.Text = "Students";

                // 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
                listView.Clear();
                listView.Columns.Add("ID", 30);
                listView.Columns.Add("Name", 100);
                listView.Columns.Add("DayOfBirth", 200);

                foreach (SomerenModel.Student student in studentList)
                {
                    ListViewItem li = new ListViewItem(student.Number.ToString());
                    li.Tag = student;
                    li.SubItems.Add(student.Name);
                    li.SubItems.Add(student.BirthDate.ToString("dd/mm/yyyy"));
                    listView.Items.Add(li);
                }
            }
            else if (panelName == "Lecturers")
            {
                //hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();

                //show students
                pnl_Students.Show();
                lbl_checkedview.Text = "Lecturers";


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

                //clear the listview before filling it again
                listView.Clear();
                listView.Columns.Add("ID", 30);
                listView.Columns.Add("Name", 100);
                //listView.Columns.Add("DayOfBirth", 200);
                foreach (SomerenModel.Teacher t in teacherList)
                {
                    ListViewItem li = new ListViewItem(t.Number.ToString());
                    li.SubItems.Add(t.Name);
                    listView.Items.Add(li);
                }
            }
            else if (panelName == "Room")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();

                //show students
                pnl_Students.Show();
                lbl_checkedview.Text = "Room";


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


                //clear the listview before filling it again
                listView.Clear();
                // Add columns
                listView.Columns.Add("Number", 30);
                listView.Columns.Add("Capacity", 40);
                listView.Columns.Add("Type", 200);

                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");
                    }
                    listView.Items.Add(li);
                }
            }
        }
Esempio n. 11
0
        private void showPanel(string panelName)
        {
            if (IamAdmin == false)
            {
                btnAdd.Hide();
                btnChange.Hide();
                btnRemove.Hide();
                btnSubmit.Hide();
                btn_EditDrinks.Hide();
                btn_saveDrink.Hide();
                btn_Add.Hide();
                btn_Remove.Hide();
            }
            DisplayActivityID();
            //normally hidden stuff:
            //filter panel
            pnl_Filter.Hide();

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

                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            else if (panelName == "Activities")
            {
                //
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                //pnl_Students.Hide();
                pnl_EditDrink.Hide();
                pnl_Drinks.Hide();
                panel1Activity.Hide();
                panel3Activity.Hide();
                //
                pnl_Activity.Show();
                pnl_Students.Show();

                //
                DisplayListViewActivity();
            }
            else if (panelName == "Students")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                btn_Filter.Hide();
                btn_RemoveFilter.Hide();
                pnl_Drinks.Hide();
                pnl_EditDrink.Hide();
                pnl_Activity.Hide();

                // show students

                lbl_Students.Text = "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 and allign
                listViewStudents.Columns.Add("Student number");
                listViewStudents.Columns[0].Width = 100;
                listViewStudents.Columns.Add("First Name");
                listViewStudents.Columns[1].Width = 125;
                listViewStudents.Columns.Add("Last Name");
                listViewStudents.Columns[2].Width = 125;

                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 == "Teachers")
            {
                //hiding the dashboard
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                btn_Filter.Hide();
                pnl_Drinks.Hide();
                pnl_EditDrink.Hide();
                btn_RemoveFilter.Hide();
                pnl_Activity.Hide();

                //show teachers
                lbl_Students.Text = "Teachers";
                pnl_Students.Show();

                // fill the Teachers listview within the Teachers panel with a list of lecturers
                SomerenLogic.Lecturers_Service lecService = new SomerenLogic.Lecturers_Service();
                List <Teacher> lecturersList = lecService.GetLecturers();

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

                //Adding columns
                listViewStudents.View = View.Details;
                listViewStudents.Columns.Add("Teacher Number");
                listViewStudents.Columns[0].Width = 100;
                listViewStudents.Columns.Add("Name");
                listViewStudents.Columns[1].Width = 125;

                foreach (SomerenModel.Teacher s in lecturersList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    li.SubItems.Add(s.Name.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Rooms")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                btn_Filter.Hide();
                pnl_Drinks.Hide();
                pnl_EditDrink.Hide();
                btn_RemoveFilter.Hide();
                pnl_Activity.Hide();

                //show rooms
                pnl_Students.Show();
                lbl_Students.Text = "Rooms     ";


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

                //clearing listView
                listViewStudents.Clear();

                //add columns and allign
                listViewStudents.Columns.Add("Room Number");
                listViewStudents.Columns[0].Width = 100;
                listViewStudents.Columns.Add("Type");
                listViewStudents.Columns[1].Width = 125;
                listViewStudents.Columns.Add("Capacity");
                listViewStudents.Columns[2].Width = 125;

                foreach (SomerenModel.Room s in roomList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    if (s.Type == true)
                    {
                        li.SubItems.Add("teacher");
                    }
                    else
                    {
                        li.SubItems.Add("student");
                    }

                    li.SubItems.Add(s.Capacity.ToString());
                    listViewStudents.Items.Add(li);

                    //li.SubItems.Add(s.Type.ToString());
                    //saved for potential later use
                }
            }
            else if (panelName == "Drinks")
            {
                //hiding the dashboard and other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_EditDrink.Hide();
                btn_Filter.Hide();
                btn_RemoveFilter.Hide();
                pnl_Activity.Hide();

                //show drinks
                lbl_Drinks.Text = "Drinks";
                pnl_Drinks.Show();
                // clear the listview before filling it again
                listViewDrinks.Clear();

                // fill the drinks listview within the drinks panel with a list of drinks
                SomerenLogic.Drinks_Service drinkService = new SomerenLogic.Drinks_Service();
                List <Drinks> drinksList = drinkService.GetDrinks();

                //Adding columns
                listViewDrinks.View = View.Details;
                listViewDrinks.Columns.Add("Name");
                listViewDrinks.Columns[0].Width = 100;
                listViewDrinks.Columns.Add("Stock");
                listViewDrinks.Columns[1].Width = 100;
                listViewDrinks.Columns.Add("Price");
                listViewDrinks.Columns[2].Width = 100;

                foreach (SomerenModel.Drinks d in drinksList)
                {
                    ListViewItem li = new ListViewItem(d.DrinkName.ToString());
                    if (d.Stock >= 10)
                    {
                        li.SubItems.Add("✔️" + "  (" + d.Stock.ToString() + ")");
                    }
                    else
                    {
                        li.SubItems.Add("⚠️" + "  (" + d.Stock.ToString() + ")");
                    }
                    li.SubItems.Add(d.Price.ToString());
                    listViewDrinks.Items.Add(li);
                }
            }
            else if (panelName == "Edit drinks")
            {
                //hiding the dashboard
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Drinks.Hide();
                pnl_Students.Hide();
                btn_Filter.Hide();
                btn_RemoveFilter.Hide();
                pnl_Activity.Hide();

                //show datagridview drinks
                pnl_EditDrink.Show();
            }
            else if (panelName == "RevenueReport")
            {
                //hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Activity.Hide();

                //show report
                pnl_Students.Show();
                btn_Filter.Show();
                btn_RemoveFilter.Show();
                lbl_Students.Text = "Revenue Report";

                //clearing listView
                listViewStudents.Clear();

                //prep
                listViewStudents.GridLines = false;

                //calling the list with drinks
                SomerenLogic.Drinks_Service drinkService = new SomerenLogic.Drinks_Service();
                List <Drinks> drinksList = drinkService.GetDrinks();

                //calling the list of students from the register
                SomerenLogic.SomerenDAL CashService  = new SomerenLogic.SomerenDAL();
                List <Register>         registerList = CashService.GetRegister();

                //calculating sales and turnover
                int     Sales = 0, Customers = 0;
                decimal Turnover = 0m;

                foreach (SomerenModel.Drinks s in drinksList)
                {
                    Sales    += s.DrinkSold;
                    Turnover += (s.Price * s.DrinkSold);
                }

                //calculating the amount of customers
                List <string> TempCustomerList = new List <string>();
                foreach (Register s in registerList)
                {
                    if (!TempCustomerList.Contains(s.StudentName))
                    {
                        TempCustomerList.Add(s.StudentName);
                        Customers++;
                    }
                }

                //displaying report
                listViewStudents.Columns.Add("Sales");
                listViewStudents.Columns[0].Width = 100;
                listViewStudents.Columns.Add("Turnover");
                listViewStudents.Columns[1].Width = 100;
                listViewStudents.Columns.Add("Num of Customers");
                listViewStudents.Columns[2].Width = 100;

                ListViewItem li = new ListViewItem(Sales.ToString());
                li.SubItems.Add("€ " + Turnover.ToString("0.00"));
                li.SubItems.Add(Customers.ToString());
                listViewStudents.Items.Add(li);
            }
            else if (panelName == "Supervisors")
            {
                //hiding the dashboard
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Drinks.Hide();
                pnl_EditDrink.Hide();
                pnl_Students.Hide();
                btn_Filter.Hide();
                btn_RemoveFilter.Hide();
                comboBoxAdd.Items.Clear();
                comboBoxDelete.Items.Clear();

                //show supervisor panel
                pnl_Supervisor.Show();

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

                // fill the drinks listview within the supervisor panel with a list of supervisor
                SomerenLogic.Supervisor_Service supervisor_Service = new SomerenLogic.Supervisor_Service();
                List <Supervisor> supervisors = supervisor_Service.GetSupervisors();

                //Adding columns
                listViewSupervisor.View = View.Details;
                listViewSupervisor.Columns.Add("Name");
                listViewSupervisor.Columns[0].Width = 100;
                listViewSupervisor.Columns.Add("ID");
                listViewSupervisor.Columns[1].Width = 100;

                foreach (SomerenModel.Supervisor s in supervisors)
                {
                    ListViewItem li = new ListViewItem(s.name);
                    li.SubItems.Add(s.LecturerID.ToString());
                    listViewSupervisor.Items.Add(li);
                }

                DisplayTeachersComboBox();
                DisplaySupervisorsComboBox();
            }
            else if (panelName == "WeeklyTimetable")
            {
                //hiding all the other stuff
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Drinks.Hide();
                pnl_EditDrink.Hide();
                pnl_Students.Hide();
                btn_Filter.Hide();
                btn_RemoveFilter.Hide();

                //show report
                pnl_Students.Show();
                lbl_Students.Text = "Weekly Timetable";

                //clearing listView
                listViewStudents.Clear();

                //calling the timetable list
                SomerenLogic.Timetable_Service timetable_Service = new SomerenLogic.Timetable_Service();
                List <Timetable> timetables = timetable_Service.GetTimetables();

                //displaying timetable
                listViewStudents.Columns.Add("Date");
                listViewStudents.Columns[0].Width = 100;
                listViewStudents.Columns.Add("Day of Week");
                listViewStudents.Columns[1].Width = 100;
                listViewStudents.Columns.Add("Activities");
                listViewStudents.Columns[2].Width = 100;
                listViewStudents.Columns.Add("Supervisors");
                listViewStudents.Columns[3].Width = 100;

                int counter = 0;

                foreach (SomerenModel.Timetable s in timetables)
                {
                    ListViewItem li = new ListViewItem(s.Date.ToShortDateString().ToString());
                    li.SubItems.Add(s.Date.DayOfWeek.ToString());
                    li.SubItems.Add(s.Activity);
                    li.SubItems.Add(s.Supervisor);
                    listViewStudents.Items.Add(li);
                    counter++;
                    if (counter == 7)
                    {
                        return;
                    }
                }
            }
        }
Esempio n. 12
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Room.Hide();
                pnl_Beverage.Hide();
                pnl_Revenue.Hide();
                pnl_Register.Hide();
                pnl_Guidance.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_Room.Hide();
                pnl_Beverage.Hide();
                pnl_Revenue.Hide();
                pnl_Register.Hide();
                pnl_Guidance.Hide();

                // show students
                pnl_Students.Show();
                pnl_Students.BringToFront();



                // 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.View = View.Details;
                listViewStudents.Clear();

                listViewStudents.Columns.Add("Id");
                listViewStudents.Columns.Add("First Name");
                listViewStudents.Columns.Add("Last Name");
                listViewStudents.Columns.Add("Birthdate");

                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li        = new ListViewItem(s.Number.ToString());
                    var          names     = s.Name.Split(' ');
                    string       firstName = names[0];
                    string       lastName  = "";
                    if (names.Count() > 0 && names[1] != null)
                    {
                        lastName = names[1];
                    }
                    li.SubItems.Add(firstName);
                    li.SubItems.Add(lastName);
                    li.SubItems.Add(s.BirthDate.ToString("dd/MM/yyyy"));
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Lecturers")
            {
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.Hide();
                pnl_Room.Hide();
                pnl_Beverage.Hide();
                pnl_Revenue.Hide();
                pnl_Register.Hide();
                pnl_Guidance.Hide();

                pnl_Lecturers.Show();
                // pnl_Lecturers.BringToFront();


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

                listViewTeachers.View = View.Details;

                // clear the listview before filling it again

                listViewTeachers.Clear();

                // Maakt collums aan

                listViewTeachers.Columns.Add("Id");
                listViewTeachers.Columns.Add("First name");
                listViewTeachers.Columns.Add("Last name");
                listViewTeachers.Columns.Add("Guidance");


                foreach (SomerenModel.Teacher t in teacherList)
                {
                    ListViewItem li = new ListViewItem(t.Number.ToString());

                    //De naam splitsen naar voor naam en achter naam
                    var    names     = t.Name.Split(' ');
                    string firstName = names[0];
                    string lastName  = "";
                    if (names.Count() > 0 && names[1] != null)
                    {
                        lastName = names[1];
                    }
                    li.SubItems.Add(firstName);
                    li.SubItems.Add(lastName);

                    //Bit naar duidelijke tekst
                    if (t.Guide == true)
                    {
                        li.SubItems.Add("Yes");
                    }
                    else
                    {
                        li.SubItems.Add("No");
                    }


                    listViewTeachers.Items.Add(li);
                }
            }

            else if (panelName == "Rooms")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Lecturers.Hide();
                pnl_Students.Hide();
                pnl_Beverage.Hide();
                pnl_Revenue.Hide();
                pnl_Register.Hide();
                pnl_Guidance.Hide();

                // show rooms
                pnl_Room.Show();



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

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

                listViewRooms.Columns.Add("Nummer");
                listViewRooms.Columns.Add("Type");
                listViewRooms.Columns.Add("Capaciteit");

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

                    if (s.Type == true)
                    {
                        li.SubItems.Add("Teachers' room");
                    }
                    else
                    {
                        li.SubItems.Add("Students' room");
                    }

                    li.SubItems.Add(s.Capacity.ToString());
                    listViewRooms.Items.Add(li);
                }
            }

            else if (panelName == "Beverages")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Lecturers.Hide();
                pnl_Students.Hide();
                pnl_Rooms.Hide();
                pnl_Revenue.Hide();
                pnl_Register.Hide();
                pnl_Guidance.Hide();

                // show rooms
                pnl_Beverage.Show();


                // fill the rooms listview within the rooms panel with a list of rooms
                SomerenLogic.Beverage_Service bevService = new SomerenLogic.Beverage_Service();
                List <Beverage> beverageList             = bevService.GetBeverages();
                listViewBeverages.View = View.Details;

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

                listViewBeverages.Columns.Add("Id");
                listViewBeverages.Columns.Add("Name");
                listViewBeverages.Columns.Add("Price");
                listViewBeverages.Columns.Add("Alcoholic");
                //listViewBeverages.Columns.Add("Total Sold");
                //listViewBeverages.Columns.Add("Revenue");
                //listViewBeverages.Columns.Add("Total Tax");
                listViewBeverages.Columns.Add("Stock");

                foreach (SomerenModel.Beverage s in beverageList)
                {
                    ListViewItem li = new ListViewItem(s.Id.ToString());
                    li.SubItems.Add(s.Name);
                    li.SubItems.Add(s.Price.ToString());

                    if (s.Alcoholic == true)
                    {
                        li.SubItems.Add("Alcoholic Beverage");
                    }
                    else
                    {
                        li.SubItems.Add("Non Alcoholic Beverage");
                    }

                    //li.SubItems.Add(s.TotalSold.ToString());
                    //li.SubItems.Add(s.Revenue.ToString());
                    //li.SubItems.Add(s.TotalTax.ToString());
                    li.SubItems.Add(s.Stock.ToString());
                    listViewBeverages.Items.Add(li);
                }
            }
            else if (panelName == "Revenue")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Lecturers.Hide();
                pnl_Students.Hide();
                pnl_Room.Hide();
                pnl_Beverage.Hide();
                pnl_Guidance.Hide();

                //show Revenue
                pnl_Revenue.Show();

                // clear the listview before filling it again
                SomerenLogic.Beverage_Service bevService = new SomerenLogic.Beverage_Service();
                List <Beverage> beverageList             = bevService.GetBeverages();
                listViewRevenue.View = View.Details;
                listViewRevenue.Clear();

                listViewRevenue.Columns.Add("Beverage ID");
                listViewRevenue.Columns.Add("Name");
                listViewRevenue.Columns.Add("Total Sold");
                listViewRevenue.Columns.Add("Revenue");
                listViewRevenue.Columns.Add("Total Tax");

                foreach (SomerenModel.Beverage s in beverageList)
                {
                    ListViewItem li = new ListViewItem(s.Id.ToString());
                    li.SubItems.Add(s.Name);

                    li.SubItems.Add(s.TotalSold.ToString());
                    li.SubItems.Add(s.Revenue.ToString());
                    li.SubItems.Add(s.TotalTax.ToString());
                    listViewRevenue.Items.Add(li);
                }

                monthCalendarStartDate.Show();
                monthCalendarEndDate.Show();
            }

            else if (panelName == "Register")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Lecturers.Hide();
                pnl_Students.Hide();
                pnl_Rooms.Hide();
                pnl_Beverage.Hide();
                pnl_Revenue.Hide();
                pnl_Guidance.Hide();

                // show register
                pnl_Register.Show();

                listViewRegisterB.View = View.Details;
                listViewRegisterB.Clear();
                listViewRegisterB.Columns.Add("Beverage ID");
                listViewRegisterB.Columns.Add("Name");
                listViewRegisterB.Columns.Add("Price");
                listViewRegisterB.Columns.Add("Stock");

                SomerenLogic.Beverage_Service becService = new SomerenLogic.Beverage_Service();
                List <Beverage> beverageList             = becService.GetBeverages();

                foreach (SomerenModel.Beverage b in beverageList)
                {
                    ListViewItem li = new ListViewItem(b.Id.ToString());
                    li.Tag = b;
                    li.SubItems.Add(b.Name);
                    li.SubItems.Add(b.Price.ToString());
                    li.SubItems.Add(b.Stock.ToString());
                    listViewRegisterB.Items.Add(li);
                }

                listViewRegister.View = View.Details;

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

                listViewRegister.Columns.Add("Id");
                listViewRegister.Columns.Add("Student name");

                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());
                    li.Tag = s;
                    li.SubItems.Add(s.Name);
                    listViewRegister.Items.Add(li);
                }
            }

            else if (panelName == "Guidance")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Lecturers.Hide();
                pnl_Students.Hide();
                pnl_Rooms.Hide();
                pnl_Beverage.Hide();
                pnl_Revenue.Hide();
                pnl_Register.Hide();

                pnl_Guidance.Show();
                pnlGuidanceAdd.Hide();
                pnlGuidanceDelete.Show();

                listViewGuidance.View = View.Details;
                listViewGuidance.Clear();

                listViewGuidance.Columns.Add("Teacher ID");
                listViewGuidance.Columns.Add("First name");
                listViewGuidance.Columns.Add("Last name");

                SomerenLogic.Guidance_Service guiService = new SomerenLogic.Guidance_Service();
                List <Guidance> guidanceList             = guiService.GetGuidances();

                foreach (SomerenModel.Guidance g in guidanceList)
                {
                    var    names     = g.TeacherName.Split(' ');
                    string firstName = names[0];
                    string lastName  = "";
                    if (names.Count() > 0 && names[1] != null)
                    {
                        lastName = names[1];
                    }

                    ListViewItem li = new ListViewItem(g.TeacherId.ToString());
                    li.Tag = g;
                    li.SubItems.Add(g.TeacherName);
                    li.SubItems.Add(firstName);
                    li.SubItems.Add(lastName);
                    listViewGuidance.Items.Add(li);
                }

                listViewTeachersToGuidance.View = View.Details;
                listViewTeachersToGuidance.Clear();

                listViewTeachersToGuidance.Columns.Add("Teacher ID");
                listViewTeachersToGuidance.Columns.Add("First name");
                listViewTeachersToGuidance.Columns.Add("Last name");

                SomerenLogic.Guidance_Service teachService = new SomerenLogic.Guidance_Service();
                List <Guidance> teacherList = teachService.GetNotGuidance();

                foreach (SomerenModel.Guidance g in teacherList)
                {
                    var    names     = g.TeacherName.Split(' ');
                    string firstName = names[0];
                    string lastName  = "";
                    if (names.Count() > 0 && names[1] != null)
                    {
                        lastName = names[1];
                    }


                    ListViewItem li = new ListViewItem(g.TeacherId.ToString());
                    li.Tag = g;
                    li.SubItems.Add(g.TeacherName);
                    li.SubItems.Add(firstName);
                    li.SubItems.Add(lastName);
                    listViewTeachersToGuidance.Items.Add(li);
                }
            }
        }
Esempio n. 13
0
        private void showPanel(string panelName)
        {
            pnl_Dashboard.Hide();
            img_Dashboard.Hide();
            pnl_Teachers.Hide();
            pnl_Verkoop.Hide();
            pnl_rooms.Hide();
            pnl_Students.Hide();

            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
                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")
            {
                // show
                pnl_Teachers.Show();


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

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

                foreach (SomerenModel.Teacher t in teacherList)
                {
                    ListViewItem li = new ListViewItem(t.Name);
                    listViewTeacher.Items.Add(li);
                }
            }
            else if (panelName == "Rooms")
            {
                // show
                pnl_rooms.Show();

                // fill the students listview within the students panel with a list of students
                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 t in roomList)
                {
                    string type = "student";
                    if (t.Type)
                    {
                        type = "student";
                    }
                    else
                    {
                        type = "teacher";
                    }
                    ListViewItem li = new ListViewItem(t.Number.ToString() + " " + t.Capacity.ToString() + " " + type);

                    listViewRooms.Items.Add(li);
                }
            }
            else if (panelName == "kassa")
            {
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Teachers.Hide();
                pnl_Verkoop.Hide();
                pnl_rooms.Hide();
                pnl_Students.Hide();
                pnl_kassa.Show();
                Kassa_Service kassa_Service = new Kassa_Service();
                List <Kassa>  KassaList     = kassa_Service.GetKassa();
                lst_kassa.Items.Clear();
                lst_kassa.View = View.Details;
                lst_kassa.Columns.Add("Voornaam", 100, HorizontalAlignment.Left);
                lst_kassa.Columns.Add("Drankje", 100, HorizontalAlignment.Left);


                foreach (Kassa i in KassaList)
                {
                    string[] buffer = new string[] {
                        i.Naam.ToString(), i.DrankjeNaam.ToString()
                    };
                    ListViewItem li = new ListViewItem(buffer);
                    lst_kassa.Items.Add(li);
                }
                lst_kassa.LabelEdit = true;
            }
            else if (panelName == "Verkoop")
            {
                // show
                pnl_Verkoop.Show();
                UpdateInventoryListView();
            }
        }