private void busniessViolationsrefreshButton_Click(object sender, EventArgs e) { BusinessViolationList.Items.Clear(); List <Violation> violations = violationManagement.GetDepartmentViolations(currentUser.DepartmentUID); foreach (Violation violate in violations) { string[] row = { violate.ViolationUID.ToString(), violate.StenerSetUID.ToString(), violate.DepartmentUID.ToString(), violate.ViolationDescription.ToString(), violate.Severity.ToString(), violate.ViolationDate.ToString("MM/dd/yyyy") }; var listItem = new ListViewItem(row); BusinessViolationList.Items.Add(listItem); } }
// Event handler for the violations refresh button private void BusinessViolationsRefreshButton_Click(object sender, EventArgs e) { BusinessViolationList.Items.Clear(); // get all violations corresponding to the user's department var violations = violationManagement.GetDepartmentViolations(currentUser.DepartmentUid); //loop through each violation to populate the UI list foreach (var violate in violations) { // create a string array for the view's row. string[] row = { violate.ViolationUid.ToString(), violate.StenerSetUid.ToString(), violate.DepartmentUid.ToString(), violate.ViolationDescription, violate.Severity.ToString(), violate.ViolationDate.ToString("MM/dd/yyyy") }; var listItem = new ListViewItem(row); BusinessViolationList.Items.Add(listItem); } }