public int InsertDeliveryTruckTrip(DeliveryTruckTrip deliveryTruckTrip) { using (var connection = OpenConnection()) { return(connection.QuerySingleOrDefault <int>(INSERT_DELIVERY_TRUCK_TRIP, deliveryTruckTrip)); } }
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 }); }
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); }