Example #1
0
        public void AddBusStop(Client sender, string name)
        {
            if (!sender.HasRank(ServerRank.AdministratorRozgrywki2))
            {
                sender.SendError("Nie posiadasz uprawnień do usuwania przystanku autobusowego.");
                return;
            }

            sender.SendInfo("Ustaw się w wybranej pozycji, a następnie wpisz tu użyj ctrl + alt + shift + d aby poznać swoją obecną pozycję.");

            Vector3 center = null;

            void Handler(Client o, string command)
            {
                if (center == null && o == sender && command == "tu")
                {
                    center = o.Position;
                    BusStopModel data = new BusStopModel
                    {
                        Name             = name,
                        Center           = center,
                        CreatorForumName = o.GetAccountEntity().DbModel.Name,
                    };
                    XmlHelper.AddXmlObject(data, Path.Combine(Utils.XmlDirectory, nameof(BusStopModel), data.Name));

                    sender.SendError("Dodawanie przystanku zakończyło się pomyślnie.");
                    BusStopEntity busStop = new BusStopEntity(data);
                    busStop.Spawn();
                    EntityHelper.Add(busStop);
                }
            }
        }
Example #2
0
        public BusStopModel MapToBusStopModel()
        {
            var result = new BusStopModel
            {
                Id      = this.Id,
                Name    = this.Name,
                Address = this.Address
            };

            return(result);
        }
Example #3
0
        public BaseContractResponse UpdateBusStop(BusStopModel busStopModel)
        {
            return(ExecuteAction <BaseContractResponse>(r =>
            {
                var busStop = _dbContext.BusStops.FirstOrDefault(u => u.Id == busStopModel.Id);
                busStop.Id = busStopModel.Id;
                busStop.Name = busStopModel.Name;
                busStop.Address = busStopModel.Address;

                _dbContext.BusStops.Update(busStop);
                _dbContext.SaveChanges();
            }));
        }
Example #4
0
 public CreateBusStopResponse CreateBusStop(BusStopModel busStopModel)
 {
     return(ExecuteAction <CreateBusStopResponse>(r =>
     {
         var busStop = new BusStop()
         {
             Id = busStopModel.Id,
             Name = busStopModel.Name,
             Address = busStopModel.Address
         };
         _dbContext.BusStops.Add(busStop);
         _dbContext.SaveChanges();
         r.Id = busStop.Id;
     }));
 }
Example #5
0
 public BusStopOnRouteModel(BusStopOnRoute busStopOnRoute)
 {
     if (busStopOnRoute == null)
     {
         Id        = busStopOnRoute.Id;
         RouteId   = busStopOnRoute.RouteId;
         BusStopId = busStopOnRoute.BusStopId;
         PreviousBusStopOnRouteId = busStopOnRoute.PreviousBusStopOnRouteId;
         Route   = new RouteModel(busStopOnRoute.Route);
         BusStop = new BusStopModel(busStopOnRoute.BusStop);
         PreviousBusStopOnRoute = new BusStopOnRouteModel(busStopOnRoute.PreviousBusStopOnRoute);
         NextBusStopOnRoute     = new BusStopOnRouteModel(busStopOnRoute.NextBusStopOnRoute);
         if (busStopOnRoute.Arrivals != null && busStopOnRoute.Arrivals.Any())
         {
             Arrivals = busStopOnRoute.Arrivals.Select(a =>
             {
                 return(new ArrivalModel(a));
             }).ToList();
         }
     }
 }
Example #6
0
        public JsonResult Index(BusStopModel busmodel, string Prefix, string pos)
        {
            List <StopDTO> stops = new CustomerBL().getStops();

            //Searching records from list using LINQ query
            if (pos == "first")
            {
                var CityList = (from N in stops
                                where N.StopName.StartsWith(Prefix)
                                select new { N.StopName });
                return(Json(CityList, JsonRequestBehavior.AllowGet));
            }
            else if (pos == "end")
            {
                var CityList = (from N in stops
                                where N.StopName.StartsWith(Prefix)
                                select new { N.StopName });
                return(Json(CityList, JsonRequestBehavior.AllowGet));
            }
            return(Json(""));
        }
Example #7
0
        private async void WhenBus()
        {
            if (_busStopsList == null)
            {
                if (!CheckSettings(SettingsToCheck.Internet))
                {
                    await _textToSpeechService.Speak("Do poprawnego dzia³ania tej funkcji potrzebne jest po³¹czenie z internetem");

                    return;
                }

                _busStopsList = await _publicTransportServices.GetBusStops();
            }

            await _textToSpeechService.Speak("Podaj nazwê przystanku");

            _whenBusModeFrom = true;

            await Task.Delay(2000);

            await _speechToTextService.Speak();
        }
Example #8
0
 public BusStopEntity(BusStopModel data)
 {
     Data = data;
 }