Ejemplo n.º 1
0
        public List <TypeTwo_ArticleTwo> TypeTwo_ArticleTwo()
        {
            var result = new List <TypeTwo_ArticleTwo>();

            var response = (from taxi in FirebaseOperationDal.GetAll()
                            group taxi by taxi.tpep_pickup_datetime.Date
                            into g
                            select new
            {
                PUDatetime = g.Key,
                total_amount_average = g.Sum(p => p.total_amount) / g.Select(p => p.passenger_count).Count()
            }
                            ).OrderBy(p => p.total_amount_average).ToList();

            var response2 = response.Take(2).OrderBy(p => p.PUDatetime).ToList();

            var response3 = (from a in response
                             where a.PUDatetime.Date >= response2[0].PUDatetime.Date &&
                             a.PUDatetime.Date <= response2[1].PUDatetime.Date
                             select new
            {
                a.PUDatetime, a.total_amount_average
            }).ToList();

            response3.ForEach(p =>
            {
                result.Add(new TypeTwo_ArticleTwo
                {
                    PUDatetime           = p.PUDatetime,
                    total_amount_average = p.total_amount_average
                });
            });
            return(result);
        }
Ejemplo n.º 2
0
        public List <TypeTwo_ArticleThree> TypeTwo_ArticleThree(TypeTwo_ArticleThree_Input input)
        {
            var result = new List <TypeTwo_ArticleThree>();

            var response = (from taxi in FirebaseOperationDal.GetAll()
                            where taxi.tpep_pickup_datetime.Date >= input.FirstDate.Date &&
                            taxi.tpep_pickup_datetime.Date <= input.SecondDate.Date
                            select new
            {
                PUDatetime = taxi.tpep_pickup_datetime,
                DODatetime = taxi.tpep_dropoff_datetime,
                taxi.trip_distance
            }).OrderBy(p => p.trip_distance).Take(5).ToList();

            response.ForEach(p =>
            {
                result.Add(new TypeTwo_ArticleThree
                {
                    PUDatetime    = p.PUDatetime,
                    DODatetime    = p.DODatetime,
                    trip_distance = p.trip_distance
                });
            });
            return(result);
        }
Ejemplo n.º 3
0
        public List <TypeThree_ArticleTwo> TypeThree_ArticleTwo(TypeThree_ArticleTwo_Input input)
        {
            var result   = new List <TypeThree_ArticleTwo>();
            var response = (from taxi in FirebaseOperationDal.GetAll()
                            where taxi.tpep_pickup_datetime.Date == input.FirstDate.Date &&
                            taxi.PULocationID == input.PULocationID
                            select new
            {
                taxi.PULocationID, taxi.DOLocationID
            }).Take(5).ToList();

            response.ForEach(p =>
            {
                var puLocation           = _operationLocation.GetByLocationId(p.PULocationID);
                var doLocation           = _operationLocation.GetByLocationId(p.DOLocationID);
                var puLocationCoordinate = _coordinateDal.GetCoordinate(puLocation);
                var doLocationCoordinate = _coordinateDal.GetCoordinate(doLocation);

                result.Add(new TypeThree_ArticleTwo
                {
                    PULocation           = string.Join(" - ", puLocation.Borough, puLocation.Zone),
                    PULocationCoordinate = puLocationCoordinate,
                    DOLocation           = string.Join(" - ", doLocation.Borough, doLocation.Zone),
                    DOLocationCoordinate = doLocationCoordinate
                });
            });
            return(result);
        }
Ejemplo n.º 4
0
        public List <TypeThree_ArticleOne> TypeThree_ArticleOne(TypeThree_ArticleOne_Input input)
        {
            var result = new List <TypeThree_ArticleOne>();

            var response = (from taxi in FirebaseOperationDal.GetAll()
                            where taxi.tpep_pickup_datetime.Date == input.FirstDate.Date
                            select new
            {
                PUDatetime = taxi.tpep_pickup_datetime,
                DODatetime = taxi.tpep_dropoff_datetime,
                taxi.PULocationID,
                taxi.DOLocationID,
                taxi.trip_distance
            }).OrderByDescending(p => p.trip_distance).Take(1).ToList();

            response.ForEach(p =>
            {
                var puLocation           = _operationLocation.GetByLocationId(p.PULocationID);
                var doLocation           = _operationLocation.GetByLocationId(p.DOLocationID);
                var puLocationCoordinate = _coordinateDal.GetCoordinate(puLocation);
                var doLocationCoordinate = _coordinateDal.GetCoordinate(doLocation);
                result.Add(new TypeThree_ArticleOne
                {
                    PUDatetime           = p.PUDatetime,
                    DODatetime           = p.DODatetime,
                    PULocation           = string.Join(" - ", puLocation.Borough, puLocation.Zone),
                    DOLocationCoordinate = doLocationCoordinate,
                    PULocationCoordinate = puLocationCoordinate,
                    DOLocation           = string.Join(" - ", doLocation.Borough, doLocation.Zone),
                    trip_distance        = p.trip_distance
                });
            });
            return(result);
        }
Ejemplo n.º 5
0
        public List <TypeThree_ArticleThree> TypeThree_ArticleThree()
        {
            var result = new List <TypeThree_ArticleThree>();

            var response = (from taxi in FirebaseOperationDal.GetAll()
                            where taxi.passenger_count >= 3
                            select new
            {
                taxi.PULocationID,
                taxi.DOLocationID,
                taxi.trip_distance
            }).OrderByDescending(p => p.trip_distance).ToList();

            result.Add(new TypeThree_ArticleThree
            {
                longest_trip = new row
                {
                    PULocationCoordinate =
                        _coordinateDal.GetCoordinate(_operationLocation.GetByLocationId(response.First().PULocationID)),
                    DOLocationCoordinate =
                        _coordinateDal.GetCoordinate(_operationLocation.GetByLocationId(response.First().DOLocationID)),

                    PULocation = string.Join(" - ",
                                             _operationLocation.GetByLocationId(response.First().PULocationID).Borough,
                                             _operationLocation.GetByLocationId(response.First().PULocationID).Zone),
                    DOLocation = string.Join(" - ",
                                             _operationLocation.GetByLocationId(response.First().DOLocationID).Borough,
                                             _operationLocation.GetByLocationId(response.First().DOLocationID).Zone),
                    trip_distance = response.First().trip_distance
                },
                shortest_trip = new row
                {
                    PULocationCoordinate =
                        _coordinateDal.GetCoordinate(_operationLocation.GetByLocationId(response.Last().PULocationID)),
                    DOLocationCoordinate =
                        _coordinateDal.GetCoordinate(_operationLocation.GetByLocationId(response.Last().DOLocationID)),

                    PULocation = string.Join(" - ",
                                             _operationLocation.GetByLocationId(response.Last().PULocationID).Borough,
                                             _operationLocation.GetByLocationId(response.Last().PULocationID).Zone),
                    DOLocation = string.Join(" - ",
                                             _operationLocation.GetByLocationId(response.Last().DOLocationID).Borough,
                                             _operationLocation.GetByLocationId(response.Last().DOLocationID).Zone),
                    trip_distance = response.Last().trip_distance
                }
            });
            return(result);
        }
Ejemplo n.º 6
0
        public List <TypeTwo_ArticleOne> TypeTwo_ArticleOne(TypeTwo_ArticleOne_Input input)
        {
            var result = new List <TypeTwo_ArticleOne>();

            var response = new
            {
                taxi_count = (from taxi in FirebaseOperationDal.GetAll()
                              where taxi.tpep_pickup_datetime >= input.FirstDate &&
                              taxi.tpep_pickup_datetime <= input.SecondDate &&
                              taxi.PULocationID == input.PULocationID
                              select new { id = taxi.passenger_count }).Count()
            };

            result.Add(new TypeTwo_ArticleOne
            {
                taxi_count = response.taxi_count
            });

            return(result);
        }
        public List <TypeOne_ArticleThree> TypeOne_ArticleThree()
        {
            var result = new List <TypeOne_ArticleThree>();

            var response = (from taxi in FirebaseOperationDal.GetAll()
                            select new
            {
                PUDatetime = taxi.tpep_pickup_datetime, taxi.trip_distance
            }).OrderByDescending(p => p.trip_distance).Take(5).ToList();

            response.ForEach(p =>
            {
                result.Add(new TypeOne_ArticleThree
                {
                    PUDatetime    = p.PUDatetime,
                    trip_distance = p.trip_distance
                });
            });

            return(result);
        }
        public List <TypeOne_ArticleOne> TypeOne_ArticleOne()
        {
            var result   = new List <TypeOne_ArticleOne>();
            var response = (from taxi in FirebaseOperationDal.GetAll()
                            group taxi by taxi.tpep_pickup_datetime.Date
                            into g
                            select new
            {
                PUDatetime = g.Key,
                passenger_count = g.Sum(p => p.passenger_count)
            }).OrderByDescending(p => p.passenger_count).Take(5).ToList();

            response.ForEach(p =>
            {
                result.Add(new TypeOne_ArticleOne
                {
                    PUDatetime      = p.PUDatetime,
                    passenger_count = p.passenger_count
                });
            });
            return(result);
        }
        public List <TypeOne_ArticleTwo> TypeOne_ArticleTwo(TypeOne_ArticleTwo_Input input)
        {
            var result = new List <TypeOne_ArticleTwo>();

            var response = (from taxi in FirebaseOperationDal.GetAll()
                            where taxi.trip_distance < input.distance
                            group taxi by taxi.tpep_pickup_datetime
                            into g
                            select new
            {
                PUDatetime = g.Key,
                trip_distance = g.Sum(p => p.trip_distance)
            }).OrderByDescending(p => p.trip_distance).Take(5).ToList();

            response.ForEach(p =>
            {
                result.Add(new TypeOne_ArticleTwo
                {
                    PUDatetime    = p.PUDatetime,
                    trip_distance = p.trip_distance
                });
            });
            return(result);
        }