//Code for the Medewerker panel #region Medewerkers //Get a list of all the employees in the database private void LoadEmployeeList() { //Get the list List <Employee> employeeList = employeeService.GetAllEmployees(); //Make sure the ListView is clear CP_Medewerkers_listView.Clear(); //Add all of the items in the list to the listView for (int i = 0; i < employeeList.Count; i++) { ListViewItem li = new ListViewItem(employeeList[i].Id.ToString()); li.SubItems.Add(employeeList[i].FirstName.ToString() + " " + employeeList[i].LastName.ToString()); li.SubItems.Add(employeeList[i].Age.ToString()); li.SubItems.Add(employeeList[i].Gender.ToShortString()); li.SubItems.Add(employeeList[i].DateEmployment.ToString("dd-MM-yyyy")); li.SubItems.Add(employeeList[i].Password.ToString()); li.SubItems.Add(employeeList[i].EmployeeType.ToDutchString()); //Tag is used to store the employee object li.Tag = employeeList[i]; CP_Medewerkers_listView.Items.Add(li); } // Create some column headers for the data. columnheader = new ColumnHeader(); columnheader.Text = "ID"; CP_Medewerkers_listView.Columns.Add(columnheader); columnheader = new ColumnHeader(); columnheader.Text = "Naam"; CP_Medewerkers_listView.Columns.Add(columnheader); columnheader = new ColumnHeader(); columnheader.Text = "Leeftijd"; CP_Medewerkers_listView.Columns.Add(columnheader); columnheader = new ColumnHeader(); columnheader.Text = "Geslacht"; CP_Medewerkers_listView.Columns.Add(columnheader); columnheader = new ColumnHeader(); columnheader.Text = "Indiensttreding"; CP_Medewerkers_listView.Columns.Add(columnheader); columnheader = new ColumnHeader(); columnheader.Text = "Wachtwoord"; CP_Medewerkers_listView.Columns.Add(columnheader); columnheader = new ColumnHeader(); columnheader.Text = "Rol"; CP_Medewerkers_listView.Columns.Add(columnheader); // Loop through and size each column header to fit the column header text. foreach (ColumnHeader ch in CP_Medewerkers_listView.Columns) { ch.Width = -2; } //No item is selected after reloading, so dont make the buttons that require a selected item enabled CP_Medewerkers_btnEdit.Enabled = false; CP_Medewerkers_btnVerwijderen.Enabled = false; CP_Medewerkers_btnEdit.BackColor = Color.PaleTurquoise; CP_Medewerkers_btnVerwijderen.BackColor = Color.Salmon; //Select the first item in the listview if (CP_Medewerkers_listView.Items.Count > 0) { CP_Medewerkers_listView.Items[0].Selected = true; } }
/// <summary> /// when the program is opened /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void KitchenOverview_Load(object sender, EventArgs e) { labels.Add("name1", lb_NameOrder1); labels.Add("name2", lb_NameOrder2); labels.Add("name3", lb_NameOrder3); labels.Add("name4", lb_NameOrder4); labels.Add("table1", lb_TableOrder1); labels.Add("table2", lb_TableOrder2); labels.Add("table3", lb_TableOrder3); labels.Add("table4", lb_TableOrder4); labels.Add("time1", lbl_TimeOrder1); labels.Add("time2", lbl_TimeOrder2); labels.Add("time3", lbl_TimeOrder3); labels.Add("time4", lbl_TimeOrder4); labels.Add("note1", lb_NoteOrder1); labels.Add("note2", lb_NoteOrder2); labels.Add("note3", lb_NoteOrder3); labels.Add("note4", lb_NoteOrder4); listviews.Add("lv1", lv_Order1); listviews.Add("lv2", lv_Order2); listviews.Add("lv3", lv_Order3); listviews.Add("lv4", lv_Order4); Label label = labels["name" + 1]; order1 = new ChapooModels.Order(); order2 = new ChapooModels.Order(); order3 = new ChapooModels.Order(); order4 = new ChapooModels.Order(); employees = Employee_Service.GetAllEmployees(); int i = 0; Orders = Order_Service.GetOrders(TypeOfView); foreach (ChapooModels.Order order in Orders) { switch (i) { case 0: order1 = order; break; case 1: order2 = order; break; case 2: order3 = order; break; case 3: order4 = order; break; } i++; } Orders.Remove(order1); Orders.Remove(order2); Orders.Remove(order3); Orders.Remove(order4); Order(order1, 1); Order(order2, 2); Order(order3, 3); Order(order4, 4); }