/* * Pre: id must be an integer or the empty string * Post: The input parameters are used to search for existing students. Matching student * information is displayed in the input gridview. * @param gridView is the gridView in which the search results will be displayed * @param id is the id being searched for - must be an integer or the empty string * @param firstName is all or part of the first name being searched for * @param lastName is all or part of the last name being searched for * @param session is the name of the session variable storing the student search table data * @districtId is the district in which to search for students, -1 indicates all districts * @returns true if results were found and false otherwise */ private bool searchStudents(GridView gridView, string id, string firstName, string lastName, string session, int districtId) { bool result = true; try { DataTable table = DbInterfaceStudent.GetStudentSearchResultsForDistrictPointEntry(id, firstName, lastName, districtId); //If there are results in the table, display them. Otherwise clear current //results and return false if (table != null && table.Rows.Count > 0) { gridView.DataSource = table; gridView.DataBind(); //save the data for quick re-binding upon paging Session[session] = table; } else if (table != null && table.Rows.Count == 0) { clearGridView(gridView); result = false; } else if (table == null) { showErrorMessage("Error: An error occurred during the search."); } } catch (Exception e) { showErrorMessage("Error: An error occurred during the search."); Utility.LogError("District Point Entry", "searchStudents", "gridView: " + gridView.ID + ", id: " + id + ", firstName: " + firstName + ", lastName: " + lastName + ", session: " + session, "Message: " + e.Message + " Stack Trace: " + e.StackTrace, -1); } return(result); }