public void fillListViewForEvaluation(ListView listView, string sourceName, string dateFrom, string dateTo) { listView.Items.Clear(); locationControl = new LocationControl(); sourceControl = new SourceControl(); employee = new Employee(); employeeDB = new EmployeeDB(); connection = new DBConnection(); int sourceID = sourceControl.selectID(sourceName); employee.setSourceID(sourceID); employee.setDateFrom(dateFrom); employee.setDateTo(dateTo); SqlDataReader reader = employeeDB.fillListViewRelatedToSource(employee); while (reader.Read()) { ListViewItem lvi = new ListViewItem(reader["ID"].ToString()); lvi.SubItems.Add(reader["name"].ToString()); lvi.SubItems.Add(reader["position"].ToString()); int locationID = int.Parse(reader["locationID"].ToString()); string locationName = locationControl.getLocationName(locationID); lvi.SubItems.Add(locationName); listView.Items.Add(lvi); } connection.close(); }
public string getLocationName(int ID) { employee = new Employee(); employeeDB = new EmployeeDB(); locationControl = new LocationControl(); employee.setID(ID); employeeDB.selectLocationID(employee); int locationID = employee.getLocationID(); return(locationControl.getLocationName(locationID)); }