public TYPESTATION TypeStation(TypeStation item)
        {
            TYPESTATION newTypeStation = new TYPESTATION()
            {
                IdTypeStation   = item.IdTypeStation,
                NameTypeStation = item.NameTypeStation
            };

            return(newTypeStation);
        }
Example #2
0
        public TypeStation TypeStationToObject(TYPESTATION item)
        {
            TypeStation newTypeStation = new TypeStation()
            {
                IdTypeStation   = item.IdTypeStation,
                NameTypeStation = item.NameTypeStation
            };

            return(newTypeStation);
        }
Example #3
0
        private async void AddStation(Station sta, TypeStation typeStation)
        {
            var stations = database.Collection("Stations");

            if (typeStation.Equals(TypeStation.DEPARTURE))
            {
                stations = database.Collection("StationsDeparture");
            }
            else if (typeStation.Equals(TypeStation.ARRIVAL))
            {
                stations = database.Collection("StationsArrival");
            }

            if (sta != null)
            {
                try
                {
                    var stationRef = stations.Document(sta.number.ToString());
                    await stationRef.UpdateAsync("occurence", FieldValue.Increment(1));
                }
                catch (Exception)
                {
                    var stationStatistics = new StationStatistics
                    {
                        type    = typeStation,
                        station = new Config.Station
                        {
                            address      = sta.address,
                            contractName = sta.contractName,
                            name         = sta.name,
                            number       = sta.number
                        },
                        occurence = 1
                    };
                    await stations.Document(sta.number.ToString()).SetAsync(stationStatistics);
                }
            }
        }