public string GetAllResultsAsJSON(ServiceProvider serviceProvider, string apiKey, string apiPwd)
        {
            if (serviceProvider == ServiceProvider.CoulombChargePoint)
            {
                //Coulomb notes: logdata.endTime field in Reference.cs autocreated as DateTime but needs to be serialized as string as value is often 24:00, change property type to string
                OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.coulombservicesClient svc = new Import.NetworkServices.ThirdPartyServices.Coulomb.coulombservicesClient();
                svc.ClientCredentials.UserName.UserName = apiKey;
                svc.ClientCredentials.UserName.Password = apiPwd;

                string output = "";
                OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.logdata[] stationData = { new OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.logdata() { } };
                string result = svc.getAllUSStations(new OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.stationSearchRequest()
                {
                   // Geo = new Import.NetworkServices.ThirdPartyServices.Coulomb.stationSearchRequestGeo { lat = "38.5846", @long = "-121.4961" },
                    Country = "USA",
                    Proximity = 50000,
                    postalCode = "95816"
                },
                out output, out stationData);

                JavaScriptSerializer js = new JavaScriptSerializer();
                js.MaxJsonLength = 10000000;
                string outputJS = js.Serialize(stationData);
                System.Diagnostics.Debug.WriteLine("<json>"+outputJS+"</json>");
                return outputJS;
            }
            return null;
        }
Exemple #2
0
        public string GetAllResultsAsJSON(ServiceProvider serviceProvider, string apiKey, string apiPwd)
        {
            if (serviceProvider == ServiceProvider.CoulombChargePoint)
            {
                //Coulomb notes: logdata.endTime field in Reference.cs autocreated as DateTime but needs to be serialized as string as value is often 24:00, change property type to string
                OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.coulombservicesClient svc = new Import.NetworkServices.ThirdPartyServices.Coulomb.coulombservicesClient();
                svc.ClientCredentials.UserName.UserName = apiKey;
                svc.ClientCredentials.UserName.Password = apiPwd;

                string output = "";
                OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.logdata[] stationData = { new OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.logdata()
                                                                                                {
                                                                                                } };
                string result = svc.getAllUSStations(new OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.stationSearchRequest()
                {
                    // Geo = new Import.NetworkServices.ThirdPartyServices.Coulomb.stationSearchRequestGeo { lat = "38.5846", @long = "-121.4961" },
                    Country    = "USA",
                    Proximity  = 50000,
                    postalCode = "95816"
                },
                                                     out output, out stationData);

                JavaScriptSerializer js = new JavaScriptSerializer();
                js.MaxJsonLength = 10000000;
                string outputJS = js.Serialize(stationData);
                System.Diagnostics.Debug.WriteLine("<json>" + outputJS + "</json>");
                return(outputJS);
            }
            return(null);
        }