Beispiel #1
0
        public static DetallePedido MapToEntity(DtoDetallePedido dto)
        {
            DetallePedido entity = new DetallePedido();

            entity.CantidadPreparar = dto.CantidadPreparar;
            entity.idPedido         = dto.idPedido;
            entity.idProducto       = dto.idProducto;
            entity.PrecioU          = dto.PrecioU;
            entity.UbicacionPro     = dto.UbicacionPro;

            return(entity);
        }
Beispiel #2
0
        public static DtoDetallePedido MapToDto(DetallePedido entity)
        {
            DtoDetallePedido dto = new DtoDetallePedido();

            dto.CantidadPreparar = entity.CantidadPreparar;
            dto.idPedido         = entity.idPedido;
            dto.idProducto       = entity.idProducto;
            dto.PrecioU          = entity.PrecioU;
            dto.UbicacionPro     = entity.UbicacionPro;

            return(dto);
        }
Beispiel #3
0
        //Cliente/Empleado
        public List <DtoDetallePedido> GetDetalle(int id)
        {
            List <DtoDetallePedido> colDtoDetalle = new List <DtoDetallePedido>();
            List <DetallePedido>    colDetalleDB  = new List <DetallePedido>();

            using (AliyavaEntities context = new AliyavaEntities())
            {
                colDetalleDB = context.DetallePedido.Where(w => w.idPedido == id).ToList();

                foreach (DetallePedido item in colDetalleDB)
                {
                    DtoDetallePedido detalle = MDetalle.MapToDto(item);
                    colDtoDetalle.Add(detalle);
                }
            }


            return(colDtoDetalle);
        }
Beispiel #4
0
        public ClassResultV Usp_InsertDetallePedido(DtoB dtoBase)
        {
            DtoDetallePedido dto = (DtoDetallePedido)dtoBase;
            ClassResultV     cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[4];
            try
            {
                pr[0] = new SqlParameter("@idPedido", SqlDbType.Int)
                {
                    Value = dto.@idPedido
                };
                pr[1] = new SqlParameter("@idProducto", SqlDbType.Int)
                {
                    Value = dto.idProducto
                };
                pr[2] = new SqlParameter("@cantidad", SqlDbType.Int)
                {
                    Value = dto.cantidad
                };
                pr[3] = new SqlParameter("@precioCompra", SqlDbType.Int)
                {
                    Value = dto.precioCompra
                };

                _ = SqlHelper.ExecuteNonQuery(objCn, CommandType.StoredProcedure, "SP_Insert_DetallePedido", pr);
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al registrar el detalle del Pedido.";
            }
            objCn.Close();
            return(cr);
        }