private void showPanel(string panelName) { HideAll(); ListViewRefresh(); 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 HideAll(); ListViewRefresh(); // show lable name students lbl_Students.Text = "Students"; // show students pnl_Students.Show(); //show colums, with name and id listViewStudents.Columns.Add("studentName"); listViewStudents.Columns.Add("studentId"); // fill the students listview within the students panel with a list of students Student_Service StudentService = new Student_Service(); // clear the listview before filling it again listViewStudents.Clear(); foreach (Student student in StudentService.GetStudents()) { ListViewItem li = new ListViewItem(student.Name); li.SubItems.Add(student.Number.ToString()); listViewStudents.Items.Add(li); } } else if (panelName == "Teachers") { HideAll(); ListViewRefresh(); // show lable name students lbl_Lecturers.Text = "Teachers"; // show Lecturers pnl_Lecturers.Show(); //show colums, with name and id listviewLecturers.Columns.Add("TeachersName"); listviewLecturers.Columns.Add("TeachersId"); // fill the Lecturers listview within the Lecturer panel with a list of Lecturers Teacher_Service teacherService = new Teacher_Service(); // clear the listview before filling it again listviewLecturers.Clear(); foreach (Teacher teacher in teacherService.GetTeacher()) { ListViewItem li = new ListViewItem(teacher.Name); li.SubItems.Add(teacher.Number.ToString()); listviewLecturers.Items.Add(li); } } }
private void showPanel(string panelName) { hideAllPanels(); 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 List <Student> studentList = studService.GetStudents(); // clear the listview before filling it again listViewStudents.Items.Clear(); foreach (Student s in studentList) { ListViewItem li = new ListViewItem(s.Id.ToString()); li.Tag = s; li.SubItems.Add(s.FirstName); li.SubItems.Add(s.LastName); li.SubItems.Add(s.BirthDate.ToString("dd-mm-yyyy")); listViewStudents.Items.Add(li); } } else if (panelName == "Teachers") { // show teachers pnl_Teachers.Show(); // clear the listview before filling it again listViewTeachers.Items.Clear(); // fill the teachers listview within the teachers panel with a list of teachers List <Teacher> teacherList = teacher_Service.GetTeacher(); foreach (Teacher t in teacherList) { ListViewItem List = new ListViewItem(t.Id.ToString()); List.Tag = t; List.SubItems.Add(t.FirstName); List.SubItems.Add(t.LastName); List.SubItems.Add(t.RoomNumber.ToString()); List.SubItems.Add(t.Lead.ToString()); listViewTeachers.Items.Add(List); } } else if (panelName == "Rooms") { // show rooms pnl_Rooms.Show(); // fill the rooms listview within the rooms panel with a list of rooms List <Room> roomList = room_Service.GetRoom(); // clear the listview before filling it again ListViewRooms.Items.Clear(); foreach (Room t in roomList) { ListViewItem li = new ListViewItem(t.Number.ToString()); li.Tag = t; li.SubItems.Add(t.Capacity.ToString()); ListViewRooms.Items.Add(li); } } else if (panelName == "Activities") { //show activities panel pnl_Activity.Show(); // fill the activities listview within the panel with a list of activities List <Activity> activitiesList = activity_Service.GetActivities(); // clear the listview before filling it again listViewActivities.Items.Clear(); foreach (Activity a in activitiesList) { ListViewItem List = new ListViewItem(a.ActivityID.ToString()); List.Tag = a; List.SubItems.Add(a.Name); List.SubItems.Add(a.Date); List.SubItems.Add(a.NStudent.ToString()); List.SubItems.Add(a.NGuide.ToString()); listViewActivities.Items.Add(List); //List view task (right arrow) then View and then details to see the columns } } else if (panelName == "Register") { // show Register pnl_Register.Show(); // fill the rooms listview within the rooms panel with a list of rooms List <Drink> DrinkList = Drink_Service.GetDrink(); List <Student> StudentList = studService.GetStudents(); // clear the listview before filling it again listView_Register.Items.Clear(); listView_Register2.Items.Clear(); foreach (Drink t in DrinkList) { ListViewItem li = new ListViewItem(t.Id.ToString()); li.Tag = t; li.SubItems.Add(t.Name.ToString()); li.SubItems.Add(t.Price.ToString()); li.SubItems.Add(t.Alcoholic.ToString()); listView_Register.Items.Add(li); } foreach (Student t in StudentList) { ListViewItem li = new ListViewItem(t.Id.ToString()); li.Tag = t; li.SubItems.Add(t.FirstName.ToString()); li.SubItems.Add(t.LastName.ToString()); listView_Register2.Items.Add(li); } } else if (panelName == "Sales") { pnl_Sales.Show(); updateSales(); } else if (panelName == "Stock") { // show Stock pnl_Stock.Show(); // clear the listview before filling it again listViewStock.Items.Clear(); // fill the teachers listview within the teachers panel with a list of teachers List <Stock> stockList = stock_Service.GetStock(); foreach (Stock s in stockList) { ListViewItem List = new ListViewItem(s.DrinkID.ToString()); List.Tag = s; List.SubItems.Add(s.Name); List.SubItems.Add(s.Price.ToString()); List.SubItems.Add(s.Amount.ToString()); listViewStock.Items.Add(List); } } else if (panelName == "Attendants") { // show attendants pnl_Attendants.Show(); // clear the items of the two list views lv_Attendants.Items.Clear(); lv_NonAttendants.Items.Clear(); List <Teacher> attending = teacher_Service.GetAttending(); List <Teacher> non_attending = teacher_Service.GetNonAttending(); foreach (Teacher t in attending) { ListViewItem li = new ListViewItem(t.Id.ToString()); li.Tag = t; li.SubItems.Add(t.FirstName); li.SubItems.Add(t.LastName); li.SubItems.Add(t.RoomNumber.ToString()); lv_Attendants.Items.Add(li); } foreach (Teacher t in non_attending) { ListViewItem li = new ListViewItem(t.Id.ToString()); li.Tag = t; li.SubItems.Add(t.FirstName); li.SubItems.Add(t.LastName); li.SubItems.Add(t.RoomNumber.ToString()); lv_NonAttendants.Items.Add(li); } } else if (panelName == "Activities") { //show activities panel pnl_Activity.Show(); // fill the activities listview within the panel with a list of activities List <Activity> activitiesList = activity_Service.GetActivities(); // clear the listview before filling it again listViewActivities.Items.Clear(); foreach (Activity a in activitiesList) { ListViewItem List = new ListViewItem(a.ActivityID.ToString()); List.Tag = a; List.SubItems.Add(a.Name); List.SubItems.Add(a.Date); List.SubItems.Add(a.NStudent.ToString()); List.SubItems.Add(a.NGuide.ToString()); listViewActivities.Items.Add(List); //List view task (right arrow) then View and then details to see the columns } } else if (panelName == "Roster") { //show Roster panel pnl_Roster.Show(); // fill the Roster listview within the panel with a list of activities List <Activity> RosterList = activity_Service.GetActivities(); // clear the listview before filling it again listViewActivities.Items.Clear(); foreach (Activity a in RosterList) { ListViewItem List = new ListViewItem(a.Name.ToString()); List.SubItems.Add(a.Date); List.SubItems.Add(a.Time.ToString()); listView_Roster.Items.Add(List); //List view task (right arrow) then View and then details to see the columns } } }