public static bool LoadDailyCount(int project_uid, short fromDate, short toDate, ForEachDailyCount func) { if (fromDate <= 0) fromDate = (short)kSampleBegin; if (toDate < 0) toDate = (short)kSampleEnd; using (SqlConnection conn = new SqlConnection(connectionString)) { try { conn.Open(); SqlCommand cmd1 = new SqlCommand("usp_select_daily_count", conn); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@project_uid", project_uid); cmd1.Parameters.AddWithValue("@day_from", fromDate); cmd1.Parameters.AddWithValue("@day_to", toDate); SqlDataReader reader = cmd1.ExecuteReader(); while (reader.Read()) { string date = reader.GetString(0); int count = reader.GetInt32(1); func(date, count); } reader.Close(); } catch (System.Exception) { return false; } } return true; }
public static bool LoadDailyCount(int project_uid, short fromDate, short toDate, ForEachDailyCount func) { if (fromDate <= 0) { fromDate = (short)kSampleBegin; } if (toDate < 0) { toDate = (short)kSampleEnd; } using (SqlConnection conn = new SqlConnection(connectionString)) { try { conn.Open(); SqlCommand cmd1 = new SqlCommand("usp_select_daily_count", conn); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@project_uid", project_uid); cmd1.Parameters.AddWithValue("@day_from", fromDate); cmd1.Parameters.AddWithValue("@day_to", toDate); SqlDataReader reader = cmd1.ExecuteReader(); while (reader.Read()) { string date = reader.GetString(0); int count = reader.GetInt32(1); func(date, count); } reader.Close(); } catch (System.Exception) { return(false); } } return(true); }