Ejemplo n.º 1
0
        public void PushPedestrianRequestInfo(IPedestrianRequestInfo requestInfo)
        {
            CityLogic city = _cities.Items.FirstOrDefault(c => c.Pedestrians.Any(p => p.Id == requestInfo.PedestrianId));

            if (city != null)
            {
                city.ModifyPedestrianRequestsCollection(col => col.Add(requestInfo));
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <IPedestrianRequestInfo> EnumeratePedestrianRequests(Guid cityId)
        {
            IList <PedestrianRequestDA> requests = _dataProxy.Session.CreateCriteria <PedestrianRequestDA>() /*.Add(Restrictions.Where<PedestrianRequestDA>(p => p.Author.PersonInfo.City.Id == cityId))*/.List <PedestrianRequestDA>();

            foreach (PedestrianRequestDA request in requests.Where(r => r.Author.PersonInfo.City.Id == cityId).ToArray())
            {
                IPedestrianRequestInfo requestInfo = _server.CreatePedestrianRequestInfo(request.Id, request.Author.PersonInfo.Person.Id, request.Target.PersonInfo.Person.Id);
                requestInfo.Comment = request.Comment;
                yield return(requestInfo);
            }
        }
Ejemplo n.º 3
0
        public void PushPedestrianRequest(PedestrianRequestDataContract request)
        {
            IPedestrianInfo pedestrian = _server.Cities.SelectMany(c => c.Pedestrians).FirstOrDefault(p => p.Id == request.PedestrianId);
            IDriverInfo     driver     = _server.Cities.SelectMany(c => c.Drivers).FirstOrDefault(d => d.Id == request.DriverId);

            if (pedestrian != null && driver != null)
            {
                IPedestrianRequestInfo requestInfo = _server.CreatePedestrianRequestInfo(pedestrian, driver);
                ConvertHelper.FillPedestrianRequestInfo(requestInfo, request);
                _server.PushPedestrianRequestInfo(requestInfo);
            }
        }
Ejemplo n.º 4
0
        public void RemovePedestrianRequest(Guid requestId)
        {
            ICityLogic city = _server.Cities.FirstOrDefault(c => c.PedestrianRequests.Any(r => r.Id == requestId));

            if (city != null)
            {
                IPedestrianRequestInfo request = city.PedestrianRequests.FirstOrDefault(r => r.Id == requestId);
                if (request != null)
                {
                    city.ModifyPedestrianRequestsCollection(col => col.Remove(request));
                }
            }
        }
Ejemplo n.º 5
0
 public static void FillPedestrianRequestInfo(IPedestrianRequestInfo requestInfo, PedestrianRequestDataContract request)
 {
     requestInfo.Comment = request.Comment;
 }
Ejemplo n.º 6
0
 public static PedestrianRequestDataContract CreatePedestrianRequestDataContract(IPedestrianRequestInfo request)
 {
     return(new PedestrianRequestDataContract
     {
         Id = request.Id,
         DriverId = request.DriverId,
         PedestrianId = request.PedestrianId,
         Comment = request.Comment
     });
 }