Exemplo n.º 1
0
        public IEnumerable <Dictionary <string, object> > LoadDB(DateTime date)
        {
            SODA.SodaClient client = new SodaClient("https://data.cityofnewyork.us", Properties.Resources.SODA_API_Key);

            SODA.Resource <Dictionary <string, object> > dataset = client.GetResource <Dictionary <string, object> >("fhrw-4uyv");
            SoqlQuery soql = this.GetQueryDate(date);
            IEnumerable <Dictionary <string, object> > results = dataset.Query <Dictionary <string, object> >(soql);

            return(results);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Assisted by code from https://dev.socrata.com/foundry/data.cityofnewyork.us/fhrw-4uyv
        /// queried DB - https://data.cityofnewyork.us
        /// API KEY - PVGjhHLj8Svy7Ryz0uJgW9IBh
        /// loadDB connects to the database, sends the query and then returns the data
        /// </summary>
        /// <returns>Returns the dataset of the query to main</returns>
        public IEnumerable <Dictionary <string, object> > LoadDB(DateTime date)
        {
            SODA.SodaClient client = new SodaClient("https://data.cityofnewyork.us", "PVGjhHLj8Svy7Ryz0uJgW9IBh");

            /// <remarks>
            /// The documentation on the web is outdated.
            /// The .NET library has been updated to no longer allow generic typing.
            /// You must use either Dictionary(String,Object) - use <> but not allowed in XML comments
            /// OR a user-defined json serializable class - their documentation does not explain how to do this
            /// well enough, however so we are sticking with the Generic Collection specified
            /// </remarks>>
            SODA.Resource <Dictionary <string, object> > dataset = client.GetResource <Dictionary <string, object> >("fhrw-4uyv");
            SoqlQuery soql = this.GetQueryDate(date);
            IEnumerable <Dictionary <string, object> > results = dataset.Query <Dictionary <string, object> >(soql);

            return(results);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Assisted by code from https://dev.socrata.com/foundry/data.cityofnewyork.us/fhrw-4uyv
        /// queried DB - https://data.cityofnewyork.us
        /// API KEY - PVGjhHLj8Svy7Ryz0uJgW9IBh
        /// loadDB connects to the database, sends the query and then returns the data
        /// </summary>
        /// <returns>Returns the da taset of the query to main</returns>
        public IEnumerable <Dictionary <string, object> > LoadDB()
        {
            /// <remarks>
            /// This requires the SODA library
            /// It can be installed from NuGet in Visual studio using
            /// Install-Package CSM.SodaDotNet
            /// </remarks>>
            SODA.SodaClient client = new SodaClient("https://data.cityofnewyork.us", "PVGjhHLj8Svy7Ryz0uJgW9IBh");

            /// <remarks>
            /// The documentation on the web is outdated.
            /// The .NET library has been updated to no longer allow generic typing.
            /// You must use either Dictionary(String,Object) - use <> but not allowed in XML comments
            /// OR a user-defined json serializable class - their documentation does not explain how to do this
            /// well enough, however so we are sticking with the Generic Collection specified
            /// </remarks>>
            SODA.Resource <Dictionary <string, object> > dataset = client.GetResource <Dictionary <string, object> >("fhrw-4uyv");

            /// <summary>
            /// instantiate our object and get our query from GetQueryDate()
            /// </summary>
            ManageDB test = new ManageDB();

            SODA.SoqlQuery soql = test.GetQueryDate();

            /// <summary>
            /// Query sends our query to our pre-defined location and returns an IEnumerable which we assign to results
            /// results now contains the results of our query
            /// </summary>
            IEnumerable <Dictionary <string, object> > results = dataset.Query <Dictionary <string, object> >(soql);

            /// <summary>
            /// Testing to make sure that our query returned results
            /// Will be changed to throw an error instead of printing a value
            /// </summary>
            int SizeOfList;

            test.TestIEnum(ref results, out SizeOfList);
            Console.WriteLine(SizeOfList);
            return(results);
        }