private bool GetProviders(string url, string username, string password, ref StringBuilder result)
        {
            result.AppendLine("Calling GetProviders for url :" + url + "IStaticData");

            var staticService = new StaticDataservice {
                Url = url + "IStaticData"
            };

            try
            {
                var company = staticService.GetProviders(username, password);
                result.AppendLine("Call sucessfull, found " + company.Count() + " providers");
                if (company.Any(c => c.isDefault))
                {
                    _defaultProvider = company.First(c => c.isDefault).ProviderNum;
                    return(true);
                }
                result.AppendLine("No default provider found");
                return(false);

                ;
            }
            catch (Exception ex)
            {
                result.AppendLine("Error calling get providers : " + ex.Message);
                result.AppendLine("Error details : " + ex.StackTrace);
            }
            return(false);
        }
        private bool GetChargeTypes(string url, string username, string password, ref StringBuilder result)
        {
            result.AppendLine("Calling GetChargeTypes for url :" + url + "IStaticData");

            var staticService = new StaticDataservice {
                Url = url + "IStaticData"
            };

            try
            {
                var company = staticService.GetProviders(username, password);
                int c       = 0;
                foreach (var providerItem in company)
                {
                    c += staticService.GetChargeTypes(username, password, providerItem.ProviderNum).Count();
                }

                result.AppendLine("Call sucessfull, found " + c + " charge types");
                return(c > 0);
            }
            catch (Exception ex)
            {
                result.AppendLine("Error calling get charge types : " + ex.Message);
                result.AppendLine("Error details : " + ex.StackTrace);
            }
            return(false);
        }
示例#3
0
        private static void CallGetVehicleTypes(string baseUrl)
        {
            Console.WriteLine("Calling CallGetVehicleTypes web service " + baseUrl);


            var staticService = new StaticDataservice {
                Url = baseUrl + "IStaticData"
            };


            try
            {
                var company = staticService.GetProviders("taxi", "test");

                foreach (var co in company)
                {
                    var vehicles = staticService.GetVehicleTypes("taxi", "test", Convert.ToInt32(co.ProviderNum));


                    foreach (var v in vehicles)
                    {
                        Console.WriteLine(v.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#4
0
        private static void CallGetZoneForCompany(string baseUrl)
        {
            Console.WriteLine("Calling CallGetZoneForCompany web service " + baseUrl);


            var staticService = new StaticDataservice {
                Url = baseUrl + "IStaticData"
            };


            try
            {
                var company = staticService.GetProviders("taxi", "test");

                foreach (var co in company)
                {
                    var zone = staticService.GetCompanyZoneByGPS("taxi", "test", co.ProviderNum, 45.42159, -75.6477);

                    Console.WriteLine(zone);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#5
0
        private static void CallGetCompanyZoneByGPS(string baseUrl)
        {
            Console.WriteLine("Calling CallGetCompanyZoneByGPS web service " + baseUrl);


            var staticService = new StaticDataservice {
                Url = baseUrl + "IStaticData"
            };


            try
            {
                var company = staticService.GetProviders("taxi", "test").FirstOrDefault(p => p.isDefault);

                var zone = staticService.GetCompanyZoneByGPS("taxi", "test", company.ProviderNum, 45.3417, -75.9233);

                if (string.IsNullOrEmpty(zone))
                {
                    Console.WriteLine("Call made sucesfully but no zone found");
                }
                else
                {
                    Console.WriteLine("Zone found " + zone);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 public void Setup()
 {
     Sut = new StaticDataservice
     {
         Url = "http://apcurium.drivelinq.com:16928/IBSCab/IBSCab.dll/soap//IStaticData"
     };
 }