Exemplo n.º 1
0
        internal static Dictionary<int, ItemStatistics> GetMarketplaceCategoryStats(int categoryID)
        {
            Dictionary<int, ItemStatistics> stats = new Dictionary<int, ItemStatistics>();
            using (SqlConnection connection = new SqlConnection(GraffitiConnString))
            {
                using (SqlCommand command = new SqlCommand("dbo.marketplace_ItemStats_Get_ByCat", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("@categoryID", SqlDbType.Int)).Value = categoryID;

                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);

                    while (reader.Read())
                    {
                        ItemStatistics s = new ItemStatistics();
                        s.DownloadCount = Convert.ToInt32(reader["DownloadCount"]);
                        int postID = Convert.ToInt32(reader["PostId"]);
                        stats.Add(postID, s);
                    }
                    reader.Close();

                }
            }

            return stats;
        }
Exemplo n.º 2
0
        internal static Dictionary <int, ItemStatistics> GetMarketplaceCategoryStats(int categoryID)
        {
            Dictionary <int, ItemStatistics> stats = new Dictionary <int, ItemStatistics>();

            using (SqlConnection connection = new SqlConnection(GraffitiConnString))
            {
                using (SqlCommand command = new SqlCommand("dbo.marketplace_ItemStats_Get_ByCat", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("@categoryID", SqlDbType.Int)).Value = categoryID;

                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);

                    while (reader.Read())
                    {
                        ItemStatistics s = new ItemStatistics();
                        s.DownloadCount = Convert.ToInt32(reader["DownloadCount"]);
                        int postID = Convert.ToInt32(reader["PostId"]);
                        stats.Add(postID, s);
                    }
                    reader.Close();
                }
            }

            return(stats);
        }
Exemplo n.º 3
0
        internal static ItemStatistics GetMarketplacePostStats(int postID)
        {
            ItemStatistics stats = new ItemStatistics();
            using (SqlConnection connection = new SqlConnection(GraffitiConnString))
            {
                using (SqlCommand command = new SqlCommand("dbo.marketplace_ItemStats_Get_ByPost", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("@postId", SqlDbType.Int)).Value = postID;

                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);

                    while (reader.Read())
                    {
                        stats.DownloadCount = Convert.ToInt32(reader["DownloadCount"]);
                    }
                    reader.Close();

                }
            }

            return stats;
        }
Exemplo n.º 4
0
        internal static ItemStatistics GetMarketplacePostStats(int postID)
        {
            ItemStatistics stats = new ItemStatistics();

            using (SqlConnection connection = new SqlConnection(GraffitiConnString))
            {
                using (SqlCommand command = new SqlCommand("dbo.marketplace_ItemStats_Get_ByPost", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("@postId", SqlDbType.Int)).Value = postID;

                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);

                    while (reader.Read())
                    {
                        stats.DownloadCount = Convert.ToInt32(reader["DownloadCount"]);
                    }
                    reader.Close();
                }
            }

            return(stats);
        }