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);
            }
        }
示例#2
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);
            }
        }