// Fill combobox with Drink options private void DrinkInit() { SomerenLogic.Stock_Service stockService = new SomerenLogic.Stock_Service(); List <Stock> stockList = stockService.GetStock(); foreach (SomerenModel.Stock c in stockList) { cmb_Drink.Items.Add(c.Name); cmb_StockSelect.Items.Add(c.Name); } }
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(); } }
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(); } }