Exemplo n.º 1
0
 public int InsertDeliveryTruckTrip(DeliveryTruckTrip deliveryTruckTrip)
 {
     using (var connection = OpenConnection())
     {
         return(connection.QuerySingleOrDefault <int>(INSERT_DELIVERY_TRUCK_TRIP, deliveryTruckTrip));
     }
 }
Exemplo n.º 2
0
 public static DeliveryTruckTripDto CreateDto(this DeliveryTruckTrip deliveryTruckTrip)
 {
     return(new DeliveryTruckTripDto()
     {
         deliveryTruckTripId = deliveryTruckTrip.DeliveryTruckTripId,
         deliveryId = deliveryTruckTrip.DeliveryId,
         productType = deliveryTruckTrip.ProductType,
         quantityProduct = deliveryTruckTrip.QuantityProduct,
         timeTrip = deliveryTruckTrip.TimeTrip,
         timeArrivalClient = deliveryTruckTrip.TimeArrivalClient
     });
 }
Exemplo n.º 3
0
        private List <DeliveryTruckTrip> AllocateQuantityOfProductToTruckTrips(Delivery delivery)
        {
            var deliveriesTruckTrips = new List <DeliveryTruckTrip>();

            int    numberOfTrips = (int)Math.Ceiling(delivery.QuantityProduct / 10);
            double quantityOfProductToDelivery = delivery.QuantityProduct;

            for (int i = 0; i < numberOfTrips; i++)
            {
                var newTrip = new DeliveryTruckTrip()
                {
                    DeliveryId      = delivery.DeliveryId,
                    ClientId        = delivery.Client.ClientId,
                    ProductType     = delivery.ProductType,
                    QuantityProduct = GetDeliveryTruckTripQuantityOfProductToDelivery(ref quantityOfProductToDelivery)
                };
                deliveriesTruckTrips.Add(newTrip);
            }

            return(deliveriesTruckTrips);
        }