Ejemplo n.º 1
0
        public void CreateTrip(int orderId, int driverId)
        {
            Account driver = AccountDAO.GetAccountById(driverId);
            Order   order  = OrderDAO.GetOrderById(orderId);
            Car     car    = CarDAO.GetById((int)driver.CarId);

            driver.Car = car;
            Trip trip = new Trip();

            trip.TripDate  = DateTime.Now;
            trip.OrderId   = order.OrderId;
            trip.TripName  = order.OrderName;
            trip.CarId     = driver.Car.CarId;
            trip.AccountId = driver.AccountId;
            TripDAO.Create(trip);
            order.Status = TripStatusEnum.IN_PROCESS;
            OrderDAO.Update(order);
        }