public static bool LoadReport(int project_uid, int pageNo, int pageSize, ForEachCallstack func, out int totalPageSize, ReportWhereFilter filterType = ReportWhereFilter.None, string filterValue = "", int hideResolved = 0) { totalPageSize = 0; using (SqlConnection conn = new SqlConnection(connectionString)) { try { conn.Open(); SqlCommand cmd1 = new SqlCommand("usp_select_recent_reports", conn); cmd1.CommandType = CommandType.StoredProcedure; SqlParameter returned = cmd1.CreateParameter(); returned.Direction = ParameterDirection.ReturnValue; cmd1.Parameters.Add(returned); cmd1.Parameters.AddWithValue("@project_uid", project_uid); cmd1.Parameters.AddWithValue("@where", filterType); cmd1.Parameters.AddWithValue("@filter", filterValue); cmd1.Parameters.AddWithValue("@pageNumber", pageNo); cmd1.Parameters.AddWithValue("@cntPerPage", pageSize); cmd1.Parameters.AddWithValue("@hideResolved", hideResolved); SqlDataReader reader = cmd1.ExecuteReader(); while (reader.Read()) { DelegateReport(reader, func); } reader.Close(); double numItems = (int)returned.Value; totalPageSize = (int)Math.Ceiling(numItems / pageSize); } catch (System.Exception) { return false; } } return true; }
public static bool LoadReport(int project_uid, int pageNo, int pageSize, ForEachCallstack func, out int totalPageSize, ReportWhereFilter filterType = ReportWhereFilter.None, string filterValue = "", int hideResolved = 0) { totalPageSize = 0; using (SqlConnection conn = new SqlConnection(connectionString)) { try { conn.Open(); SqlCommand cmd1 = new SqlCommand("usp_select_recent_reports", conn); cmd1.CommandType = CommandType.StoredProcedure; SqlParameter returned = cmd1.CreateParameter(); returned.Direction = ParameterDirection.ReturnValue; cmd1.Parameters.Add(returned); cmd1.Parameters.AddWithValue("@project_uid", project_uid); cmd1.Parameters.AddWithValue("@where", filterType); cmd1.Parameters.AddWithValue("@filter", filterValue); cmd1.Parameters.AddWithValue("@pageNumber", pageNo); cmd1.Parameters.AddWithValue("@cntPerPage", pageSize); cmd1.Parameters.AddWithValue("@hideResolved", hideResolved); SqlDataReader reader = cmd1.ExecuteReader(); while (reader.Read()) { DelegateReport(reader, func); } reader.Close(); double numItems = (int)returned.Value; totalPageSize = (int)Math.Ceiling(numItems / pageSize); } catch (System.Exception) { return(false); } } return(true); }