public ActionResult Index(string id) { var allMarkets = new MongoRepository <Market>().OrderBy(x => x.Name).ToList(); var company = new MongoRepository <Company>().First(x => x.Id == id); if (company != null) { var network = Repository.FirstOrDefault(x => x.Id == company.CompanyKey); if (network == null) { network = new TaxiHailNetworkSettings { Id = company.CompanyKey }; } return(PartialView(new TaxiHailNetworkSettingsModel { AvailableMarkets = allMarkets, TaxiHailNetworkSettings = network })); } return(PartialView(new TaxiHailNetworkSettingsModel { AvailableMarkets = allMarkets, TaxiHailNetworkSettings = new TaxiHailNetworkSettings { Id = id } })); }
public Company() { AppDescription = Resources.SampleAppDescription; IBS = new IBSSettings(); Application = new Questionnaire(); Store = new StoreSettings(); Network = new TaxiHailNetworkSettings(); Vehicles = new List <CompanyVehicle>(); PaymentSettings = new PaymentSettings(); AppleAppStoreCredentials = new AppleStoreCredentials(); GooglePlayCredentials = new AndroidStoreCredentials(); Versions = new List <Version>(); CompanySettings = new List <CompanySetting>(); Style = new Style(); Payment = new Payment(); LayoutRejected = new Dictionary <DateTime, string>(); Errors = new Dictionary <string, string>(); }
public void Setup() { NetworkRepository = new InMemoryRepository <TaxiHailNetworkSettings>(); CompanyRepository = new InMemoryRepository <Company>(); Sut = new RoamingApiController(NetworkRepository, CompanyRepository, GetMockedMarketRepo()); _chrisTaxi = new TaxiHailNetworkSettings { Id = "ChrisTaxi", IsInNetwork = true, Market = "MTL", FleetId = 424242, WhiteListedFleetIds = "987564,321674,23134,88784,99999", // ChrisBis, Tom, Tony, Pilou, Last. Bob exclued Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxiBis", CanAccept = true, CanDispatch = true, Order = 2 }, new CompanyPreference { CompanyKey = "TomTaxi", CanAccept = true, CanDispatch = false, Order = 0 }, new CompanyPreference { CompanyKey = "PilouTaxi", CanAccept = true, CanDispatch = true, Order = 1 } } }; _chrisTaxiBis = new TaxiHailNetworkSettings { Id = "ChrisTaxiBis", IsInNetwork = true, Market = "MTL", FleetId = 987564, Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxi", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "TomTaxi", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "PilouTaxi", CanAccept = true, CanDispatch = true }, } }; _tonyTaxi = new TaxiHailNetworkSettings { Id = "TonyTaxi", IsInNetwork = true, Market = "CHI", FleetId = 321674 }; _tomTaxi = new TaxiHailNetworkSettings { //same Longitude as TonyTaxi Id = "TomTaxi", Market = "CHI", FleetId = 23134, IsInNetwork = true, Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxiBis", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "ChrisTaxi", CanAccept = false, CanDispatch = true }, new CompanyPreference { CompanyKey = "PilouTaxi", CanAccept = true, CanDispatch = true }, } }; _pilouTaxi = new TaxiHailNetworkSettings { //Same Latitude as ChrisTaxi and Chris TaxiBis Id = "PilouTaxi", IsInNetwork = true, Market = "NYC", FleetId = 88784, WhiteListedFleetIds = "444444", // Random one to test BobTaxi exclusion Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxiBis", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "ChrisTaxi", CanAccept = false, CanDispatch = true }, new CompanyPreference { CompanyKey = "TomTaxi", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "BobTaxi", CanAccept = true, CanDispatch = true }, } }; _lastTaxi = new TaxiHailNetworkSettings { //Overlap ChrisTaxi and ChrisTaxiBis Id = "LastTaxi", IsInNetwork = true, Market = "SYD", FleetId = 99999, BlackListedFleetIds = "10101019, 666, 010101" }; _bobTaxi = new TaxiHailNetworkSettings { Id = "BobTaxi", IsInNetwork = true, Market = "NYC", FleetId = 587564, Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxi", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "TomTaxi", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "PilouTaxi", CanAccept = true, CanDispatch = true } } }; _taxiWhenBlacklistedProhibited = new TaxiHailNetworkSettings { Id = "TaxiWhenBlacklistedProhibited", IsInNetwork = true, Market = "SYD", FleetId = 88784, BlackListedFleetIds = "666", Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "BlacklistedTaxi", CanAccept = true, CanDispatch = true } } }; _blacklistedTaxi = new TaxiHailNetworkSettings() { Id = "BlacklistedTaxi", IsInNetwork = true, Market = "SYD", FleetId = 666, Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "TaxiWhenBlacklistedProhibited", CanAccept = true, CanDispatch = true } } }; _chrisTaxiCompany = new Company { Id = "ChrisTaxi", CompanyKey = "ChrisTaxi", CompanyName = "ChrisTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _chrisTaxiBisCompany = new Company { Id = "ChrisTaxiBis", CompanyKey = "ChrisTaxiBis", CompanyName = "ChrisTaxiBis", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://altavista.com" } }; _lastTaxiCompany = new Company { Id = "LastTaxi", CompanyKey = "LastTaxi", CompanyName = "LastTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _pilouTaxiCompany = new Company { Id = "PilouTaxi", CompanyKey = "PilouTaxi", CompanyName = "PilouTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _tomTaxiCompany = new Company { Id = "TomTaxi", CompanyKey = "TomTaxi", CompanyName = "TomTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _tonyTaxiCompany = new Company { Id = "TonyTaxi", CompanyKey = "TonyTaxi", CompanyName = "TonyTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _bobTaxiCompany = new Company { Id = "BobTaxi", CompanyKey = "BobTaxi", CompanyName = "BobTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://altavista.com" } }; _blacklistedTaxiCompany = new Company() { Id = "BlacklistedTaxi", CompanyKey = "BlacklistedTaxi", CompanyName = "BlacklistedTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _taxiWhenBlacklistedProhibitedCompany = new Company() { Id = "TaxiWhenBlacklistedProhibited", CompanyKey = "TaxiWhenBlacklistedProhibited", CompanyName = "TaxiWhenBlacklistedProhibited", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; NetworkRepository.DeleteAll(); NetworkRepository.Add(_chrisTaxi); NetworkRepository.Add(_chrisTaxiBis); NetworkRepository.Add(_tonyTaxi); NetworkRepository.Add(_tomTaxi); NetworkRepository.Add(_pilouTaxi); NetworkRepository.Add(_lastTaxi); NetworkRepository.Add(_bobTaxi); NetworkRepository.Add(_blacklistedTaxi); NetworkRepository.Add(_taxiWhenBlacklistedProhibited); CompanyRepository.DeleteAll(); CompanyRepository.Add(_chrisTaxiCompany); CompanyRepository.Add(_chrisTaxiBisCompany); CompanyRepository.Add(_tonyTaxiCompany); CompanyRepository.Add(_tomTaxiCompany); CompanyRepository.Add(_pilouTaxiCompany); CompanyRepository.Add(_lastTaxiCompany); CompanyRepository.Add(_bobTaxiCompany); CompanyRepository.Add(_blacklistedTaxiCompany); CompanyRepository.Add(_taxiWhenBlacklistedProhibitedCompany); }
public void Setup() { NetworkRepository = new InMemoryRepository <TaxiHailNetworkSettings>(); CompanyRepository = new InMemoryRepository <Company>(); Sut = new NetworkApiController(NetworkRepository, CompanyRepository, GetMockedMarketRepo()); _chrisTaxi = new TaxiHailNetworkSettings() { Id = "ChrisTaxi", IsInNetwork = true, Market = "MTL", WhiteListedFleetIds = "123456,564321", // And excluding PilouTaxi and TomTaxi Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxiBis", CanAccept = true, CanDispatch = true, Order = 2 }, new CompanyPreference { CompanyKey = "TomTaxi", CanAccept = true, CanDispatch = false, Order = 0 }, new CompanyPreference { CompanyKey = "PilouTaxi", CanAccept = true, CanDispatch = true, Order = 1 }, } }; _chrisTaxiBis = new TaxiHailNetworkSettings() { Id = "ChrisTaxiBis", IsInNetwork = true, Market = "MTL", FleetId = 123456, Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxi", CanAccept = false, CanDispatch = true }, new CompanyPreference { CompanyKey = "TomTaxi", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "PilouTaxi", CanAccept = true, CanDispatch = true }, } }; _tonyTaxi = new TaxiHailNetworkSettings() { Id = "TonyTaxi", IsInNetwork = true, Market = "CHI", FleetId = 564321 }; _tomTaxi = new TaxiHailNetworkSettings() { //same Longitude as TonyTaxi Id = "TomTaxi", Market = "CHI", IsInNetwork = true, FleetId = 99999, Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxiBis", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "ChrisTaxi", CanAccept = false, CanDispatch = true }, new CompanyPreference { CompanyKey = "PilouTaxi", CanAccept = true, CanDispatch = true }, } }; _pilouTaxi = new TaxiHailNetworkSettings() { //Same Latitude as ChrisTaxi and Chris TaxiBis Id = "PilouTaxi", IsInNetwork = true, Market = "NYC", FleetId = 44444, Preferences = new List <CompanyPreference> { new CompanyPreference { CompanyKey = "ChrisTaxiBis", CanAccept = true, CanDispatch = true }, new CompanyPreference { CompanyKey = "ChrisTaxi", CanAccept = false, CanDispatch = true }, new CompanyPreference { CompanyKey = "TomTaxi", CanAccept = true, CanDispatch = true }, } }; _lastTaxi = new TaxiHailNetworkSettings() { //Overlap ChrisTaxi and ChrisTaxiBis Id = "LastTaxi", IsInNetwork = true, Market = "SYD", BlackListedFleetIds = "10101019, 666, 010101" }; _blacklistedTaxi = new TaxiHailNetworkSettings() { Id = "TaxiBlacklisted", IsInNetwork = true, Market = "SYD", FleetId = 666 }; _chrisTaxiCompany = new Company() { Id = "ChrisTaxi", CompanyKey = "ChrisTaxi", CompanyName = "ChrisTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _chrisTaxiBisCompany = new Company() { Id = "ChrisTaxiBis", CompanyKey = "ChrisTaxiBis", CompanyName = "ChrisTaxiBis", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _lastTaxiCompany = new Company() { Id = "LastTaxi", CompanyKey = "LastTaxi", CompanyName = "LastTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _pilouTaxiCompany = new Company() { Id = "PilouTaxi", CompanyKey = "PilouTaxi", CompanyName = "PilouTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _tomTaxiCompany = new Company() { Id = "TomTaxi", CompanyKey = "TomTaxi", CompanyName = "TomTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _tonyTaxiCompany = new Company() { Id = "TonyTaxi", CompanyKey = "TonyTaxi", CompanyName = "TonyTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; _blacklistedTaxiCompany = new Company() { Id = "BlacklistedTaxi", CompanyKey = "BlacklistedTaxi", CompanyName = "BlacklistedTaxi", IBS = new IBSSettings { Password = "******", Username = "******", ServiceUrl = "http://google.com" } }; NetworkRepository.DeleteAll(); NetworkRepository.Add(_chrisTaxi); NetworkRepository.Add(_chrisTaxiBis); NetworkRepository.Add(_tonyTaxi); NetworkRepository.Add(_tomTaxi); NetworkRepository.Add(_pilouTaxi); NetworkRepository.Add(_lastTaxi); NetworkRepository.Add(_blacklistedTaxi); CompanyRepository.DeleteAll(); CompanyRepository.Add(_chrisTaxiCompany); CompanyRepository.Add(_chrisTaxiBisCompany); CompanyRepository.Add(_tonyTaxiCompany); CompanyRepository.Add(_tomTaxiCompany); CompanyRepository.Add(_pilouTaxiCompany); CompanyRepository.Add(_lastTaxiCompany); CompanyRepository.Add(_blacklistedTaxiCompany); }