Ejemplo n.º 1
0
        public static bool LoadTrendCount(int callstack_uid, short fromDate, short toDate, ForEachTrendCount 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_per_version", conn);
                    cmd1.CommandType = CommandType.StoredProcedure;

                    cmd1.Parameters.AddWithValue("@callstack_uid", callstack_uid);
                    cmd1.Parameters.AddWithValue("@day_from", fromDate);
                    cmd1.Parameters.AddWithValue("@day_to", toDate);

                    SqlDataReader reader = cmd1.ExecuteReader();

                    while (reader.Read())
                    {
                        string version = reader.GetString(0);
                        string date = reader.GetString(1);
                        int count = reader.GetInt32(2);

                        func(version, date, count);
                    }

                    reader.Close();
                }
                catch (System.Exception)
                {
                    return false;
                }
            }

            return true;
        }
Ejemplo n.º 2
0
        public static bool LoadTrendCount(int callstack_uid, short fromDate, short toDate, ForEachTrendCount 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_per_version", conn);
                    cmd1.CommandType = CommandType.StoredProcedure;

                    cmd1.Parameters.AddWithValue("@callstack_uid", callstack_uid);
                    cmd1.Parameters.AddWithValue("@day_from", fromDate);
                    cmd1.Parameters.AddWithValue("@day_to", toDate);

                    SqlDataReader reader = cmd1.ExecuteReader();

                    while (reader.Read())
                    {
                        string version = reader.GetString(0);
                        string date    = reader.GetString(1);
                        int    count   = reader.GetInt32(2);

                        func(version, date, count);
                    }

                    reader.Close();
                }
                catch (System.Exception)
                {
                    return(false);
                }
            }

            return(true);
        }