Esempio n. 1
0
        public object Any(InitGateway request)
        {
            try
            {
                Logger.OpenLog("TripThruGateway");

                StorageManager.OpenStorage(new SqliteStorage("~/../../Db/db.sqlite".MapHostAbsolutePath()));
                PartnerAccount partnerAccount = new PartnerAccount
                {
                    UserName            = "******",
                    Password            = "******",
                    Email               = "",
                    AccessToken         = "iUaySN4P1v3a1m5kQ3K1XvCIa8NkV1Psr",
                    RefreshToken        = "",
                    ClientId            = "*****@*****.**",
                    ClientSecret        = "",
                    TripThruAccessToken = ""
                };
                StorageManager.CreatePartnerAccount(partnerAccount);

                GatewayService.gateway = new TripThru();
                //Logger.OpenLog("TripThruGateway", "c:\\Users\\Edward\\");

                foreach (PartnerAccount account in StorageManager.GetPartnerAccounts())
                {
                    if (account.CallbackUrl != null && account.PartnerName != null)
                    {
                        GatewayService.gateway.RegisterPartner(
                            new GatewayClient(
                                account.ClientId,
                                account.PartnerName,
                                account.TripThruAccessToken,
                                account.CallbackUrl
                                )
                            );
                    }
                }

                MapTools.SetGeodataFilenames("~/App_Data/Geo-Location-Names.csv".MapHostAbsolutePath(), "~/App_Data/Geo-Routes.csv".MapHostAbsolutePath(), "~/App_Data/Geo-Location-Addresses.csv".MapHostAbsolutePath());
                MapTools.LoadGeoData();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
            return(new InitGatewayResponse());
        }