예제 #1
0
        public IHttpActionResult Post(int distritoId, int baseId, [FromBody] OrderSelectionModel orderSelectionModel)
        {
            var routeCode = BuildRouteCode(orderSelectionModel.StartDateTime,
                                           orderSelectionModel.IdVehicle,
                                           orderSelectionModel.IdVehicleType,
                                           orderSelectionModel.LogisticsCycleType,
                                           distritoId,
                                           baseId);

            // Agrupo por OrderId
            var odByOrderId = orderSelectionModel.OrderDetailList.Where(od => od.Cuaderna != 0).GroupBy(od => od.OrderId);

            //

            foreach (var group in odByOrderId)
            {
                var order = EntityDao.FindById(group.Key);
                group.ToList().ForEach(od =>
                {
                    // Se asigna el ajuste y la cuaderna asignada
                    var orderDetail      = order.OrderDetails.Single(item => item.Id == od.Id);
                    orderDetail.Ajuste   = od.Ajuste;
                    orderDetail.Cuaderna = od.Cuaderna;
                    orderDetail.Estado   = OrderDetail.Estados.Ruteado;
                });

                // Programo por Orden
                RoutingService.Programming(order, routeCode, orderSelectionModel.IdVehicle,
                                           orderSelectionModel.StartDateTime, orderSelectionModel.LogisticsCycleType, orderSelectionModel.IdVehicleType);
            }

            return(Ok());
        }
예제 #2
0
        public IHttpActionResult PutItem(int id, TicketRechazoModel rechazoModel)
        {
            var ticketEntity = EntityDao.FindById(id);

            ticketEntity.ChangeEstado((TicketRechazo.Estado)Enum.Parse(typeof(TicketRechazo.Estado), rechazoModel.Estado), rechazoModel.Observacion, Usuario.Empleado);
            EntityDao.SaveOrUpdate(ticketEntity);

            return(Ok());
        }
예제 #3
0
        public IEnumerable <ItemModel> GetNextEstado(int ticketId)
        {
            var ticket  = EntityDao.FindById(ticketId);
            var estados = TicketRechazo.Next(ticket.UltimoEstado);

            return(estados.Select(e => new ItemModel {
                Key = (int)e, Value = CultureManager.GetLabel(TicketRechazo.GetEstadoLabelVariableName(e))
            }));
        }
예제 #4
0
        public IHttpActionResult GetItem(int id)
        {
            var rechazo      = EntityDao.FindById(id);
            var rechazoModel = new TicketRechazoModel();

            Mapper.EntityToModel(rechazo, rechazoModel);

            return(Json(rechazoModel));
        }
예제 #5
0
 public virtual TModel Get(int id)
 {
     return(new TEntityMapper().EntityToModel(EntityDao.FindById(id), new TModel()));
 }