Example #1
0
        private void showPanel(string panelName)
        {
            switch (panelName)
            {
            case "Students":
                Student_Service studService = new Student_Service();
                List <Student>  studentList = studService.GetStudents();

                ListViewStuPrint(listViewStudents, studentList);
                break;

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

                ListViewLecPrint(listView_Lec, lecList);
                break;

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

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

                ListViewRoomPrint(listViewRooms, roomList);
                break;

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

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

                ListViewStockPrint(Lst_Supplies, DrinkList);
                break;

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

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

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

                ListViewActivitiesPrint(Lst_Activities, ActivityList);
                break;

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

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

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

                ListViewTimetablePrint(listViewTimetable, TimetableList);
                break;

            default:
                break;
            }
        }
        private void ShowPanel(string panelName)
        {
            if (panelName == "Dashboard")
            {
                // hide all other panels
                pnl_Students.Hide();
                pnl_Lecturers.Hide();
                pnl_Rooms.Hide();
                pnl_Activiteitenlijst.Hide();
                pnl_Drank.Hide();
                pnl_Kassa.Hide();
                pnl_Omzetrapportage.Hide();
                pnl_Begeleiders.Hide();

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

                // show students
                pnl_Students.Show();



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

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

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

                pnl_Lecturers.Show();

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

                listViewLecturers.Clear();

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

                pnl_Rooms.Show();

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

                ListRoomBox.Items.Clear();

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

                pnl_Activiteitenlijst.Show();

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

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

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

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

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

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

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

                lv_Drank.Items.Clear();

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

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

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

                cmb_Students.Items.Clear();

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

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

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



                cmb_Drinks.Items.Clear();

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

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

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


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

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

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

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

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

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

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

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

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

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

                //show this panel
                pnl_Begeleiders.Show();

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

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

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

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

                cmb_Begeleiders.SelectedIndex = 0;

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

                cmb_Docenten.Items.Clear();

                foreach (Teacher t in teacherList)
                {
                    cmb_Docenten.Items.Add(t.Teachernumber);
                }
                cmb_Docenten.SelectedIndex = 0;
            }
        }
Example #3
0
        private void showPanel(string panelName)
        {
            //Hide all panels
            HideAllPanels();

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

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

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

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

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

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

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

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

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



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


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

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

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

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

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

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

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

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

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

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

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

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

                    listViewRoom.Items.Add(Item);
                }

                listViewStudents.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            }

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

                RefreshDrinkPanel();

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

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

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

                listViewOrderHistory.Items.Clear();

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

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

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

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

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

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

                Supervisor_Service supervisor_service = new Supervisor_Service();

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

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

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