コード例 #1
0
        public GetTripRequest WithMeansOfTransport(MeansOfTransport meansOfTransport)
        {
            Guard.Argument(meansOfTransport, nameof(meansOfTransport)).Defined();

            MeansOfTransport = meansOfTransport;
            return(this);
        }
コード例 #2
0
 public FavStopDialog(MeansOfTransport meanOfTrans)
 {
     meameanOfTransport = meanOfTrans;
     InitializeComponent();
     Task.Run(async() => { TestItems = await NewFavoriteStop.GetStaionNames(meameanOfTransport); }).Wait();
     StopName.ItemsSource = TestItems;
 }
コード例 #3
0
        public static string GetStringFromMeansOfTransport(MeansOfTransport input)
        {
            var returnString = "";

            switch (input)
            {
            case MeansOfTransport.Metro:
                returnString = Metro;
                break;

            case MeansOfTransport.Tram:
                returnString = Tram;
                break;

            case MeansOfTransport.TramWlb:
                returnString = TramWlb;
                break;

            case MeansOfTransport.Bus:
                returnString = Bus;
                break;

            case MeansOfTransport.NightBus:
                returnString = NightBus;
                break;
            }

            return(returnString);
        }
コード例 #4
0
        public CarrierBlock(IList<MergeField> mergeFields, MeansOfTransport meansOfTransport, CarrierCollection carrierCollection)
        {
            CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName);

            data = CarrierViewModel.CreateCarrierViewModelsForNotification(meansOfTransport, carrierCollection, new MeansOfTransportFormatter());

            AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName);
        }
コード例 #5
0
        public CarrierBlock(IList <MergeField> mergeFields, MeansOfTransport meansOfTransport, CarrierCollection carrierCollection)
        {
            CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName);

            data = CarrierViewModel.CreateCarrierViewModelsForNotification(meansOfTransport, carrierCollection, new MeansOfTransportFormatter());

            AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName);
        }
コード例 #6
0
        public void NotificationAddMeans_StoresMeans()
        {
            var notification = CreateNotificationApplication();

            var means = new MeansOfTransport[] { MeansOfTransport.Road, MeansOfTransport.Sea, MeansOfTransport.Road };

            notification.SetMeansOfTransport(means);

            Assert.Equal(means, notification.MeansOfTransport);
        }
コード例 #7
0
        public void NotificationAddMeans_StoresMeans()
        {
            var notification = CreateNotificationApplication();

            var means = new MeansOfTransport[] { MeansOfTransport.Road, MeansOfTransport.Sea, MeansOfTransport.Road };

            notification.SetMeansOfTransport(means);

            Assert.Equal(means, notification.MeansOfTransport);
        }
コード例 #8
0
        public static async Task <List <string> > GetStaionNames(MeansOfTransport type)
        {
            if (stations == null)
            {
                stations = await Stations.GetAllStationsAsync();
            }
            var mot            = type;
            var listOfStations = (from v in stations
                                  from p in v.Platforms
                                  where p.MeansOfTransport == type
                                  select v.Name).Distinct().ToList();

            return(listOfStations);
        }
コード例 #9
0
        public async Task <Guid> HandleAsync(SetMeansOfTransportForNotification message)
        {
            var meansOfTransport = await repository.GetByNotificationId(message.Id);

            if (meansOfTransport == null)
            {
                meansOfTransport = new MeansOfTransport(message.Id);

                repository.Add(meansOfTransport);
            }

            meansOfTransport.SetRoute(message.MeansOfTransport);

            await context.SaveChangesAsync();

            return(meansOfTransport.NotificationId);
        }
コード例 #10
0
        public static IList<CarrierViewModel> CreateCarrierViewModelsForNotification(
            MeansOfTransport meansOfTransport,
            CarrierCollection carrierCollection,
            MeansOfTransportFormatter meansOfTransportFormatter)
        {
            if (meansOfTransport == null
                || carrierCollection == null
                || carrierCollection.Carriers == null
                || !carrierCollection.Carriers.Any())
            {
                return new CarrierViewModel[0];
            }

            var meansOfTransportDisplay = meansOfTransportFormatter.MeansOfTransportAsString(meansOfTransport.Route);

            return carrierCollection.Carriers.Select(c => new CarrierViewModel(c, meansOfTransportDisplay))
                .ToArray();
        }
コード例 #11
0
ファイル: CarrierViewModel.cs プロジェクト: DEFRA/prsd-iws
        public static IList <CarrierViewModel> CreateCarrierViewModelsForNotification(
            MeansOfTransport meansOfTransport,
            CarrierCollection carrierCollection,
            MeansOfTransportFormatter meansOfTransportFormatter)
        {
            if (meansOfTransport == null ||
                carrierCollection == null ||
                carrierCollection.Carriers == null ||
                !carrierCollection.Carriers.Any())
            {
                return(new CarrierViewModel[0]);
            }

            var meansOfTransportDisplay = meansOfTransportFormatter.MeansOfTransportAsString(meansOfTransport.Route);

            return(carrierCollection.Carriers.Select(c => new CarrierViewModel(c, meansOfTransportDisplay))
                   .ToArray());
        }
コード例 #12
0
        public CarrierViewModelTests()
        {
            firstCarrier = new TestableCarrier
            {
                Address  = TestableAddress.AddlestoneAddress,
                Business = TestableBusiness.WasteSolutions,
                Contact  = TestableContact.BillyKnuckles
            };

            secondCarrier = new TestableCarrier
            {
                Address  = TestableAddress.WitneyAddress,
                Business = TestableBusiness.CSharpGarbageCollector,
                Contact  = TestableContact.MikeMerry
            };

            var notificationId = new Guid("1EB00552-0589-4AB2-804E-16CF9B8286BA");

            carrierCollection = new TestableCarrierCollection(notificationId);
            meansOfTransport  = new MeansOfTransport(notificationId);
        }
コード例 #13
0
        public CarrierViewModelTests()
        {
            firstCarrier = new TestableCarrier
            {
                Address = TestableAddress.AddlestoneAddress,
                Business = TestableBusiness.WasteSolutions,
                Contact = TestableContact.BillyKnuckles
            };

            secondCarrier = new TestableCarrier
            {
                Address = TestableAddress.WitneyAddress,
                Business = TestableBusiness.CSharpGarbageCollector,
                Contact = TestableContact.MikeMerry
            };

            var notificationId = new Guid("1EB00552-0589-4AB2-804E-16CF9B8286BA");

            carrierCollection = new TestableCarrierCollection(notificationId);
            meansOfTransport = new MeansOfTransport(notificationId);
        }
コード例 #14
0
 public void Add(MeansOfTransport meansOfTransport)
 {
     context.MeansOfTransports.Add(meansOfTransport);
 }
コード例 #15
0
ファイル: TestCityApp.cs プロジェクト: Beia55/city_model
 public void removeMeansOfTransport(MeansOfTransport m)
 {
     meansOfTransportList.Remove(m);
 }
コード例 #16
0
ファイル: TestCityApp.cs プロジェクト: Beia55/city_model
 public void addMeansOfTransport(MeansOfTransport m)
 {
     meansOfTransportList.Add(m);
 }
コード例 #17
0
 public void Add(MeansOfTransport meansOfTransport)
 {
     context.MeansOfTransports.Add(meansOfTransport);
 }
コード例 #18
0
        public static async Task <List <string> > GetLinesFromStation(string station, MeansOfTransport type)
        {
            if (stations == null)
            {
                stations = await Stations.GetAllStationsAsync();
            }
            var lines = (from v in stations
                         where v.Name.Equals(station)
                         from p in v.Platforms
                         where p.MeansOfTransport == type
                         group p by p.Name
                         into linesList
                         select linesList.Key).ToList();

            return(lines);
        }