Пример #1
0
        private void show_pnl_Rooms()
        {
            pnl_DisplayData.Show();

            // fill a list with rooms by calling a function from the service layer
            SomerenLogic.Room_Service roomService = new SomerenLogic.Room_Service();
            List <Room> roomList = roomService.GetRooms();

            ClearDataGridView(); // clear the DataGridView and fill the column names
            generateGridLayout(roomList.FirstOrDefault().dataGridList());

            // Fill the DataGridView with all the rooms using a foreach
            foreach (var room in roomList)
            {
                FillDataInGridView(room.dataGrid(room));
            }
        }
Пример #2
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();
                pnl_Teachers.Hide();
                pnl_Cash.Hide();
                pnl_Drink.Hide();
                //pnl_Rooms etc.. ******************************************* Add the rest

                // show dashboard
                pnl_Dashboard.Show();
                picbox_Someren4.Show();
            }
            else if (panelName == "Students")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                picbox_Someren4.Hide();
                pnl_Teachers.Hide();
                pnl_Cash.Hide();
                pnl_Drink.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();

                listViewStudents.Columns.Add("Name");
                foreach (SomerenModel.Student s in studentList)
                {
                    // Add the name to the list
                    ListViewItem li = new ListViewItem(s.Firstname);
                    listViewStudents.Items.Add(li);
                }

                /* ************************************************* RADIO BUTTONS! Switch between detailed and compact
                 * listViewStudents.View = View.Details; ************************** Second option with first and last name: detailed view
                 *
                 * listViewStudents.Columns.Add("FirstName");
                 * listViewStudents.Columns.Add("LastName");
                 * foreach (SomerenModel.Student s in studentList)
                 * {
                 *  ListViewItem li = new ListViewItem(s.Firstname);
                 *  listViewStudents.Items.Add(li);
                 *  li.SubItems.Add(s.Lastname);
                 * }
                 */
            }
            else if (panelName == "Teachers")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                picbox_Someren4.Hide();
                pnl_Students.Hide();
                pnl_Cash.Hide();
                pnl_Drink.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.Items.Clear();
                listViewTeachers.Columns.Add("Teachers", 100, HorizontalAlignment.Left);

                foreach (SomerenModel.Teacher t in teacherList)
                {
                    ListViewItem li = new ListViewItem(t.FirstName);
                    listViewTeachers.Items.Add(li);
                }

                /*
                 * listViewTeachers.View = View.Details; ************************** Second option with first and last name: detailed view
                 *
                 * listViewTeachers.Columns.Add(" TeacherID", 100, HorizontalAlignment.Left);
                 * listViewTeachers.Columns.Add("FirstName", 100, HorizontalAlignment.Left);
                 * listViewTeachers.Columns.Add("LastName", 100, HorizontalAlignment.Left);
                 * listViewTeachers.Columns.Add("Supervisor", 100, HorizontalAlignment.Left);
                 *
                 * 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.Supervisor);
                 *  listViewTeachers.Items.Add(li);
                 * }
                 */
            }
            // ********************************************** have one list of rooms
            else if (panelName == "StudentRoom")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                picbox_Someren4.Hide();
                pnl_Cash.Hide();
                pnl_Drink.Hide();

                lbl_Students.Text = "Student's Room";
                // show students
                pnl_Students.Show();

                // fill the students listview within the students panel with a list of students
                SomerenLogic.Sroom_Service roomService = new SomerenLogic.Sroom_Service();
                List <Room> roomList = roomService.GetRoom();

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

                //Adding columns
                listViewStudents.View = View.Details;
                listViewStudents.Columns.Add("ID", -2, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("student/student", -2, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("capacity", -2, HorizontalAlignment.Left);

                foreach (SomerenModel.Room s in roomList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    li.SubItems.Add(s.student);
                    li.SubItems.Add(s.Capacity.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "TeacherRoom")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                picbox_Someren4.Hide();
                pnl_Cash.Hide();
                pnl_Drink.Hide();

                lbl_Students.Text = "Teacher's Room";
                // show students
                pnl_Students.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.GetRoom();

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

                //Adding columns
                listViewStudents.View = View.Details;
                listViewStudents.Columns.Add("ID", -2, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("teacher/student", -2, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("capacity", -2, HorizontalAlignment.Left);

                foreach (SomerenModel.Room s in roomList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    li.SubItems.Add(s.teacher.ToString());
                    li.SubItems.Add(s.Capacity.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Drink Supplies")
            {
                pnl_Dashboard.Hide();
                picbox_Someren4.Hide();
                pnl_Students.Hide();
                pnl_Teachers.Hide();
                pnl_Cash.Hide();
                // show drink panel
                pnl_Drink.Show();
            }
            else if (panelName == "Cash Register")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                picbox_Someren4.Hide();
                pnl_Students.Hide();
                pnl_Teachers.Hide();
                pnl_Drink.Hide();
                // show cash panel
                pnl_Cash.Show();

                // ************************************ get list of drinks
                //SomerenLogic.Drinks_Service drinksService = new SomerenLogic.Drinks_Service();
                //List<Drinks> drinksList = drinksService.GetDrinkSupplies();
                radbtn_Lecturers.Checked = true;


                if (radbtn_Students.Checked)
                {
                    SomerenLogic.Student_Service studService = new SomerenLogic.Student_Service();
                    List <Student> studList = studService.GetStudents();

                    cmbbox_Role.DataSource    = studList;
                    cmbbox_Role.DisplayMember = "FirstName";
                }
                else
                {
                    SomerenLogic.Teacher_Service teachService = new SomerenLogic.Teacher_Service();
                    List <Teacher> teachList = teachService.GetTeachers();

                    cmbbox_Role.DataSource    = teachList;
                    cmbbox_Role.DisplayMember = "FirstName";
                }

                //((ListBox)list_Drinks).DataSource = drinksList;
                //((ListBox)list_Drinks).DisplayMember = "Name";
            }
        }
Пример #3
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                HidePanels();

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

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

                // TODO: Listview Aanpassen
                foreach (SomerenModel.Student s in studentList)
                {
                    string studentName = (s.FirstName + " " + s.LastName);

                    ListViewItem li = new ListViewItem();
                    li.Text = s.Number.ToString();
                    li.SubItems.Add(studentName);
                    li.SubItems.Add(s.Class);

                    listViewStudents.Items.Add(li);
                }
            }

            else if (panelName == "Lecturers")
            {
                // hide all other panels
                HidePanels();

                // show lecturers
                pnl_Lecturers.Show();

                SomerenLogic.Lecturer_Service lectureService = new SomerenLogic.Lecturer_Service();
                List <Lecturer> lecturerList = lectureService.GetTeachers();

                listViewLecturers.Items.Clear();

                foreach (Lecturer l in lecturerList)
                {
                    String lecturerName = (l.FirstName + " " + l.LastName);

                    ListViewItem li = new ListViewItem();
                    li.Text = l.Number.ToString();
                    li.SubItems.Add(lecturerName);
                    li.SubItems.Add(l.Course);

                    listViewLecturers.Items.Add(li);
                }
            }

            else if (panelName == "Rooms")
            {
                // hide all other panels
                HidePanels();

                // show rooms
                panelRooms.Show();

                SomerenLogic.Room_Service roomService = new SomerenLogic.Room_Service();
                List <Room> roomList = roomService.GetRooms();
                listViewRooms.Items.Clear();

                foreach (Room r in roomList)
                {
                    ListViewItem li = new ListViewItem();

                    li.Text = r.Number.ToString();
                    li.SubItems.Add(r.Capacity.ToString());
                    li.SubItems.Add(r.Kind);

                    listViewRooms.Items.Add(li);
                }
            }

            else if (panelName == "Stock")
            {
                // hide all other panels
                HidePanels();

                // show rooms
                pnl_Stock.Show();

                SomerenLogic.Stock_Service stockService = new SomerenLogic.Stock_Service();
                List <Stock> stockList = stockService.GetStock();
                listViewStock.Items.Clear();

                foreach (Stock s in stockList)
                {
                    ListViewItem li = new ListViewItem();

                    li.Text = s.Name;
                    li.SubItems.Add(s.Amount.ToString());
                    li.SubItems.Add(s.Price.ToString());

                    listViewStock.Items.Add(li);
                }
            }

            else if (panelName == "Cash Register")
            {
                HidePanels();

                // show register
                pnl_CashRegister.Show();
                StudentInit();
                DrinkInit();
            }
        }
Пример #4
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();
                pnl_Teachers.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();

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

                listViewStudents.View = View.Details;

                listViewStudents.Columns.Add(" StudentID", 100, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("Firstname", 100, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("Lastname", 100, HorizontalAlignment.Left);

                foreach (SomerenModel.Student s in studentList)
                {
                    //ListViewItem li = new ListViewItem(s.FirstName);
                    //listViewStudents.Items.Add(li);

                    ListViewItem li = new ListViewItem(s.studentID.ToString());
                    li.SubItems.Add(s.Firstname);
                    li.SubItems.Add(s.Lastname);
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Teachers")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();
                pnl_Students.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.Items.Clear();


                listViewTeachers.View = View.Details;

                listViewTeachers.Columns.Add(" TeacherID", 100, HorizontalAlignment.Left);
                listViewTeachers.Columns.Add("FirstName", 100, HorizontalAlignment.Left);
                listViewTeachers.Columns.Add("LastName", 100, HorizontalAlignment.Left);
                listViewTeachers.Columns.Add("Supervisor", 100, HorizontalAlignment.Left);



                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.Supervisor);
                    listViewTeachers.Items.Add(li);
                }
            }
            else if (panelName == "StudentRoom")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();

                lbl_Students.Text = "Student's Room";
                // show students
                pnl_Students.Show();

                // fill the students listview within the students panel with a list of students
                SomerenLogic.Sroom_Service roomService = new SomerenLogic.Sroom_Service();
                List <Room> roomList = roomService.GetRoom();

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

                //Adding columns
                listViewStudents.View = View.Details;
                listViewStudents.Columns.Add("ID", -2, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("student/student", -2, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("capacity", -2, HorizontalAlignment.Left);

                foreach (SomerenModel.Room s in roomList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    li.SubItems.Add(s.student);
                    li.SubItems.Add(s.Capacity.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "TeacherRoom")
            {
                // hide all other panels
                pnl_Dashboard.Hide();
                img_Dashboard.Hide();

                lbl_Students.Text = "Teacher's Room";
                // show students
                pnl_Students.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.GetRoom();

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

                //Adding columns
                listViewStudents.View = View.Details;
                listViewStudents.Columns.Add("ID", -2, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("teacher/student", -2, HorizontalAlignment.Left);
                listViewStudents.Columns.Add("capacity", -2, HorizontalAlignment.Left);

                foreach (SomerenModel.Room s in roomList)
                {
                    ListViewItem li = new ListViewItem(s.Number.ToString());
                    li.SubItems.Add(s.teacher.ToString());
                    li.SubItems.Add(s.Capacity.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            else if (panelName == "Revenue")
            {
                lbl_Students.Text = "Revenue";
                pnl_Students.Show();
            }
        }
Пример #5
0
        private void showPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                HidePanels();

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

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

                // TODO: Listview Aanpassen
                foreach (SomerenModel.Student s in studentList)
                {
                    string studentName = (s.FirstName + " " + s.LastName);

                    ListViewItem li = new ListViewItem();
                    li.Text = s.Number.ToString();
                    li.SubItems.Add(studentName);
                    li.SubItems.Add(s.Class);

                    listViewStudents.Items.Add(li);
                }
            }

            else if (panelName == "Lecturers")
            {
                // hide all other panels
                HidePanels();

                // show lecturers
                pnl_Lecturers.Show();

                SomerenLogic.Lecturer_Service lectureService = new SomerenLogic.Lecturer_Service();
                List <Lecturer> lecturerList = lectureService.GetTeachers();

                listViewLecturers.Items.Clear();

                foreach (Lecturer l in lecturerList)
                {
                    String lecturerName = (l.FirstName + " " + l.LastName);

                    ListViewItem li = new ListViewItem();
                    li.Text = l.Number.ToString();
                    li.SubItems.Add(lecturerName);
                    li.SubItems.Add(l.Course);

                    listViewLecturers.Items.Add(li);
                }
            }

            else if (panelName == "Rooms")
            {
                // hide all other panels
                HidePanels();

                // show rooms
                panelRooms.Show();

                SomerenLogic.Room_Service roomService = new SomerenLogic.Room_Service();
                List <Room> roomList = roomService.GetRooms();
                listViewRooms.Items.Clear();

                foreach (Room r in roomList)
                {
                    ListViewItem li = new ListViewItem();

                    li.Text = r.Number.ToString();
                    li.SubItems.Add(r.Capacity.ToString());
                    li.SubItems.Add(r.Kind);

                    listViewRooms.Items.Add(li);
                }
            }

            else if (panelName == "Stock")
            {
                // hide all other panels
                HidePanels();

                // show rooms
                pnl_Stock.Show();

                SomerenLogic.Stock_Service stockService = new SomerenLogic.Stock_Service();
                List <Stock> stockList = stockService.GetStock();
                listViewStock.Items.Clear();

                foreach (Stock s in stockList)
                {
                    ListViewItem li = new ListViewItem();

                    li.Text = s.Name;
                    li.SubItems.Add(s.Amount.ToString());
                    li.SubItems.Add(s.Price.ToString());

                    listViewStock.Items.Add(li);
                }
            }

            else if (panelName == "Cash Register")
            {
                HidePanels();

                // show register
                pnl_CashRegister.Show();

                cmb_Drink.Items.Clear();
                cmb_Student.Items.Clear();

                StudentInit();
                DrinkInit();
            }


            else if (panelName == "Analysis")
            {
                HidePanels();

                pnl_Analysis.Show();

                SomerenLogic.Stock_Service stockService = new SomerenLogic.Stock_Service();
                List <Stock> stockList = stockService.GetStock();
                listViewAnalysis.Items.Clear();

                foreach (Stock s in stockList)
                {
                    ListViewItem li = new ListViewItem();
                    if (s.Sold >= 1)
                    {
                        li.Text = s.Name;
                        li.SubItems.Add(s.Amount.ToString());
                        li.SubItems.Add(s.Price.ToString());
                        listViewAnalysis.Items.Add(li);
                    }
                }
            }

            else if (panelName == "Activities")
            {
                HidePanels();

                pnl_Activities.Show();

                listViewActivities.Items.Clear();
                ShowActivities();
            }

            else if (panelName == "Attendants")
            {
                HidePanels();

                pnl_Attendants.Show();

                // show all current attendants
                SomerenLogic.Attendant_Service AttendantService = new SomerenLogic.Attendant_Service();
                List <Attendant> attendantList = AttendantService.GetAttendants();



                listViewAttendants.Items.Clear();

                foreach (Attendant a in attendantList)
                {
                    String attendantName = (a.voornaam + " " + a.achternaam);

                    ListViewItem li = new ListViewItem();
                    li.Text = a.Id.ToString();
                    li.SubItems.Add(attendantName);
                    listViewAttendants.Items.Add(li);
                }
            }

            else if (panelName == "DeleteAttendant")
            {
                pnl_DeleteAttendant.Show();

                // show all current attendants
                SomerenLogic.Attendant_Service AttendantService = new SomerenLogic.Attendant_Service();
                List <Attendant> attendantList = AttendantService.GetAttendants();



                listViewDeleteAttendant.Items.Clear();

                foreach (Attendant a in attendantList)
                {
                    String attendantName = (a.voornaam + " " + a.achternaam);

                    ListViewItem li = new ListViewItem();
                    li.Text = a.Id.ToString();
                    li.SubItems.Add(attendantName);
                    listViewDeleteAttendant.Items.Add(li);
                }
            }

            else if (panelName == "AddAttendants")
            {
                pnl_AddAttendant.Show();

                // show all non attendants
                SomerenLogic.Attendant_Service AttendantService = new SomerenLogic.Attendant_Service();
                List <Attendant> attendantList = AttendantService.GetNonAttendants();

                listViewAddAttendant.Items.Clear();

                foreach (Attendant a in attendantList)
                {
                    String attendantName = (a.voornaam + " " + a.achternaam);

                    ListViewItem li = new ListViewItem();
                    li.Text = a.Id.ToString();
                    li.SubItems.Add(attendantName);
                    listViewAddAttendant.Items.Add(li);
                }
            }
            else if (panelName == "Schedule")
            {
                HidePanels();

                pnl_Schedule.Show();
                ShowMonday();
            }
        }