Exemple #1
0
        public void TestGuardarVenta2()

        {
            bool                datoEsperado    = true;
            DetalleOrden        unDetalleOrden  = new DetalleOrden();
            OrdenDeVenta        objOrdenDeVenta = new OrdenDeVenta();
            List <Producto>     ListaProducto   = ProductoBLL.BuscarProducto("Vino");
            List <DetalleOrden> ListaDetalles   = new List <DetalleOrden>();
            Tarjeta             objTarjeta      = new Tarjeta();
            Usuario             unUSuario       = new Usuario();

            objTarjeta.CVC = "121";
            objTarjeta.FechaVencimiento = "1/1/2022";
            objTarjeta.NumeroTarjeta    = "9898989898989899";
            objTarjeta.NombreTarjeta    = "Denis Lemes";
            Producto objProducto = ListaProducto[0];

            unDetalleOrden.Producto = objProducto;
            unDetalleOrden.Cantidad = 2;

            ListaDetalles.Add(unDetalleOrden);
            objOrdenDeVenta.Detalles = ListaDetalles;

            objOrdenDeVenta.MetodoDePago = objTarjeta;
            List <Cliente> Clientes = ClienteBLL.BuscarClientesPorDNI("23564500");

            Cliente ObjCliente = Clientes[0];

            objOrdenDeVenta.Cliente = ObjCliente;

            unUSuario.ID = 1;
            objOrdenDeVenta.UsuarioCreador = unUSuario;
            Assert.AreEqual(datoEsperado, VentaBLL.GuardaOrdenVenta(objOrdenDeVenta));
        }
Exemple #2
0
        protected void btnGenerar_Click(object sender, EventArgs e)
        {
            Orden orden = new Orden();

            orden.ID_ORDEN = orden.getLastId() + 1;
            //orden.ID_USUARIO = 123456;
            orden.CREADO_EN = DateTime.Now;
            var proveedor = con.ListadoIdProveedor().First(p => p.NOMBRE == DropDownList1.SelectedItem.Text);

            //orden.PROVEEDOR_ID_PROVEEDOR = proveedor.ID_PROVEEDOR;
            orden.ESTADO_ORDEN = 0;
            if (orden.Create()) //Se inserta la Orden en la base de datos
            {
                foreach (var producto in con.carrito)
                {
                    DetalleOrden detalleOrden = new DetalleOrden();
                    detalleOrden.ID_DETALLE_ORDEN = detalleOrden.getLastId() + 1;
                    //detalleOrden.DESCRIPCION = producto.Descripcion;
                    //detalleOrden.ORDEN_ID_ORDEN = (int)orden.ID_ORDEN;
                    //detalleOrden.CANT_DETALLE_O = (int)producto.Cantidad;
                    //detalleOrden.PRODUCTO_ID_PRODUCTO = producto.Id_producto;
                    detalleOrden.Create(); // Se inserta cada detalle en la base de datos
                }
                con.carrito     = new List <Producto>();
                lblMensaje.Text = "Orden generada exitosamente!";
            }
            else
            {
                lblMensaje.Text = "Hubo un error al generar la orden";
            }
        }
Exemple #3
0
        private void AgregarLibro()
        {
            if (instanciaLibro == null)
            {
                MessageBox.Show(this, "No hay libro cargado");
                return;
            }

            if (instanciaLibro.Prohibido)
            {
                MessageBox.Show(this, "Este libro esta prohibido");
                return;
            }

            if (instanciaLibro.Restringido && instanciaCliente == null)
            {
                MessageBox.Show(this, "Este libro esta restringido, debe de ser un cliente inscrito para poder comprarlo");
                return;
            }

            int cantidadSeleccionada = Convert.ToInt32(nud_cantidad_libro_venta.Value);

            if (instanciaLibro.Cantidad_Stock < cantidadSeleccionada)
            {
                MessageBox.Show("No hay suficientes para esta cantidad.");
                return;
            }

            DetalleOrden articulo = CrearArticulo();

            _articulos.Add(articulo);
            LimpiarLibro();
            RefrescarVenta();
        }
        public ActionResult listaDetalle(int codigo)
        {
            List <DetalleOrden> lista = new List <DetalleOrden>();
            DetalleOrden        orden = null;
            SqlConnection       cn    = new Acceso().getConnection();
            SqlCommand          cmd   = new SqlCommand("SP_LISTAR_DETALLE_POR_CODIGO", cn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@CODORDEN", codigo);
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                orden = new DetalleOrden()
                {
                    codDetalle = Int32.Parse(dr[0].ToString()),
                    codOrden   = Int32.Parse(dr[1].ToString()),
                    codProd    = Int32.Parse(dr[2].ToString()),
                    desProd    = dr[3].ToString(),
                    cantidad   = Int32.Parse(dr[4].ToString()),
                    preUnit    = Decimal.Parse(dr[5].ToString()),
                    importe    = Decimal.Parse(dr[6].ToString()),
                    estDet     = Int32.Parse(dr[7].ToString())
                };
                lista.Add(orden);
            }
            return(Json(lista, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        private void AceptarBtn_Click(object sender, EventArgs e)
        {
            try
            {
                // validar cantidad
                if (this.operacion == OperacionForm.frmAlta)
                {
                    detalle_orden = new DetalleOrden();
                }
                /* Comprobar que esten los datos obligatorios*/
                detalle_orden.OrdenId    = Convert.ToInt32(OrdenIdTxt.Text);
                detalle_orden.DetalleId  = Convert.ToInt32(DetalleId.Text);
                detalle_orden.ProductoId = (ProductoCbo.SelectedItem as Producto).ProductoId;
                detalle_orden.Cantidad   = Convert.ToInt32(CantidadTxt.Text);

                if (!detalle_orden.saveObj())
                {
                    MessageBox.Show(operacion == OperacionForm.frmAlta ? "Error al intentar ingresar nuevo detalle " : "Error al intentar editar informacion de Cliente", "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                MessageBox.Show(operacion == OperacionForm.frmAlta ? "Nueva Orden  dado de alta" : "Actualizacion de informacion de Orden", operacion == OperacionForm.frmAlta ? "Ingreso de Orden..." : "Actualizacion de informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al intentar " + (operacion == OperacionForm.frmAlta ? "ingresar nueva Orden" : "actualizar informacion") + ex.Message, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (_frmGrid != null)
            {
                _frmGrid.ReloadGrid();
            }
            this.Dispose();
        }
Exemple #6
0
        public IHttpActionResult PutDetalleOrden(long id, DetalleOrden detalleOrden)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != detalleOrden.Id)
            {
                return(BadRequest());
            }

            db.Entry(detalleOrden).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DetalleOrdenExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #7
0
        public JsonResult GuardarInventarioo(DetalleOrden model)
        {
            var rm = new ResponseModel();

            //Usuario user = new Usuario();

            //var getemp = user.ObtenerPerfil(SessionHelper.GetUser());

            //var correousuario = getemp.correo.ToString();

            var res = "";
            int id  = model.Orden_Id;

            if (ModelState.IsValid)
            {
                rm = model.Guardar();

                if (rm.response)
                {
                    rm.function = "closeCurrentWindow()";
                }
            }

            return(Json(rm));
        }
Exemple #8
0
        public async Task <IActionResult> PutDetalleOrden(int id, DetalleOrden detalleOrden)
        {
            if (id != detalleOrden.IdOrden)
            {
                return(BadRequest());
            }

            _context.Entry(detalleOrden).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DetalleOrdenExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult> Post(DetalleOrden detalle)
        {
            _context.DetalleOrdenes.Add(detalle);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetById), new { id = detalle.Id }, detalle));
        }
Exemple #10
0
        public bool Save(Orden entity)
        {
            Orden orden = new Orden {
                PacienteId = entity.PacienteId,
                OrdenNro   = entity.OrdenNro,
                PagoMetodo = entity.PagoMetodo,
                Total      = entity.Total
            };

            try {
                context.Ordenes.Add(orden);
                context.SaveChanges();
                var ordenId = orden.Id;
                if (entity.DetalleOrden != null)
                {
                    foreach (var item in entity.DetalleOrden.ToList())
                    {
                        DetalleOrden detalle = new DetalleOrden
                        {
                            OrdenId       = ordenId,
                            MedicamentoId = item.MedicamentoId,
                            Cantidad      = item.Cantidad
                        };
                        context.DetalleOrdenes.Add(detalle);
                    }
                }
                context.SaveChanges();
            } catch (Exception ex) {
                return(false);
            }
            return(true);
        }
Exemple #11
0
        public void TestGuardarVenta()

        {
            bool                datoEsperado    = true;
            DetalleOrden        unDetalleOrden  = new DetalleOrden();
            OrdenDeVenta        objOrdenDeVenta = new OrdenDeVenta();
            List <Producto>     ListaProducto   = ProductoBLL.BuscarProducto("Vino");
            List <DetalleOrden> ListaDetalles   = new List <DetalleOrden>();
            Efectivo            objEfectivo     = new Efectivo();
            Usuario             unUSuario       = new Usuario();
            Producto            objProducto     = ListaProducto[0];

            unDetalleOrden.Producto = objProducto;
            unDetalleOrden.Cantidad = 2;
            ListaDetalles.Add(unDetalleOrden);
            objOrdenDeVenta.Detalles = ListaDetalles;

            objOrdenDeVenta.MetodoDePago = objEfectivo;
            List <Cliente> Clientes = ClienteBLL.BuscarClientesPorDNI("38567566");

            Cliente ObjCliente = Clientes[0];

            objOrdenDeVenta.Cliente = ObjCliente;

            unUSuario.ID = 1;
            objOrdenDeVenta.UsuarioCreador = unUSuario;
            Assert.AreEqual(datoEsperado, VentaBLL.GuardaOrdenVenta(objOrdenDeVenta));
        }
        public ActionResult GenerarOrden()
        {
            Usuario            usuario        = (Usuario)Session["login"];
            OrdenRecepcion     ordenRecepcion = new OrdenRecepcion();
            List <CarritoItem> carrito        = (List <CarritoItem>)Session["carrito_prov"];
            Orden_Compra       oc             = new Orden_Compra();
            DetalleOrden       detalle        = null;

            oc.flag   = "Y";
            oc.codCli = usuario.idCliEmp.ToString();
            int codOrden = new AdminOrdenCompraDAO().insertarOrdenCompra(oc);
            int items    = 0;

            foreach (CarritoItem item in carrito)
            {
                detalle = new DetalleOrden()
                {
                    codOrden = codOrden,
                    codProd  = item.idProducto,
                    cantidad = item.cantProd,
                    preUnit  = item.preProd,
                    importe  = item.subtotal()
                };
                items += new DetalleOrdenDAO().insertarDetalleOrden(detalle);
            }

            ordenRecepcion.IdOrdencompra = codOrden;
            ordenRecepcion.IdEmple       = usuario.idCliEmp;

            AdminOrdenRecepcionDAO daorecep = new AdminOrdenRecepcionDAO();

            daorecep.registrarOrdenRecepcion(ordenRecepcion);

            return(Json(items, JsonRequestBehavior.AllowGet));
        }
Exemple #13
0
        public ActionResult procesarCompra()
        {
            Usuario      usu     = (Usuario)Session["login"];
            Orden_Compra oc      = new Orden_Compra();
            DetalleOrden detalle = null;

            oc.codCli = usu.idCliEmp.ToString();
            oc.flag   = "N";
            int codOrden             = new AdminOrdenCompraDAO().insertarOrdenCompra(oc);
            List <CarritoItem> lista = (List <CarritoItem>)Session["carrito"];

            foreach (CarritoItem item in lista)
            {
                detalle = new DetalleOrden()
                {
                    codOrden = codOrden,
                    codProd  = item.idProducto,
                    cantidad = item.cantProd,
                    preUnit  = item.preProd,
                    importe  = item.subtotal()
                };
                new DetalleOrdenDAO().insertarDetalleOrden(detalle);
            }
            Cliente_Direccion cli = new ClienteDireccionDAO().listarClienteDireccion(usu.idCliEmp).ToList().Where(p => p.flag.Equals("Y")).FirstOrDefault();

            ViewBag.direc = cli.desDirec;
            ViewBag.orden = codOrden;
            return(View());
        }
        private static IDbDataParameter[] CrearParametrosDetalleOrden(int idOrden, DetalleOrden articulo, RegistroCaja registroCaja, IDbCommand cmdArticulo)
        {
            IDbDataParameter[] parameters;
            var p1 = cmdArticulo.CreateParameter();
            var p2 = cmdArticulo.CreateParameter();
            var p3 = cmdArticulo.CreateParameter();
            var p4 = cmdArticulo.CreateParameter();
            var p5 = cmdArticulo.CreateParameter();
            var p6 = cmdArticulo.CreateParameter();
            var p7 = cmdArticulo.CreateParameter();

            p1.ParameterName = "@ORDEN_FK";
            p1.Value         = idOrden;

            p2.ParameterName = "@LIBRO_FK";
            p2.Value         = articulo.Libro_Fk;

            p3.ParameterName = "@PRECIO_UNITARIO";
            p3.Value         = articulo.Precio_Unitario;

            p4.ParameterName = "@DESCUENTO";
            p4.Value         = (object)articulo.Descuento ?? DBNull.Value;

            p5.ParameterName = "@CANTIDAD";
            p5.Value         = articulo.Cantidad;

            p6.ParameterName = "@DETALLE_DESCUENTO_FK";
            p6.Value         = (object)articulo.Detalle_Descuento_Fk ?? DBNull.Value;

            p7.ParameterName = "@REGISTRO_CAJA_FK";
            p7.Value         = registroCaja.Id;

            parameters = new IDbDataParameter[] { p1, p2, p3, p4, p5, p6, p7 };
            return(parameters);
        }
Exemple #15
0
        private void Aceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.operacion == OperacionForm.frmAlta)
                {
                    detalleOrden = new DetalleOrden();
                }
                /* Comprobar que esten los datos obligatorios*/
                detalleOrden.ProductoId = ((Producto)ProductoCbo.SelectedItem).ProductoId;
                detalleOrden.ProductoId = this.DetalleId;
                detalleOrden.OrdenId    = this.OrdenId;

                /*orden.EmpleadoId = ((Empleado)EmpleadoCbo.SelectedItem).EmpleadoId;
                 * orden.FechaOrden = FechaOrdenDtp.Value;
                 * orden.Descuento = Convert.ToInt32(this.DescuentoTxt.Text);*/
                if (!detalleOrden.saveObj())
                {
                    MessageBox.Show(operacion == OperacionForm.frmAlta ? "Error al intentar ingresar nueva Orden" : "Error al intentar editar informacion de Cliente", "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                MessageBox.Show(operacion == OperacionForm.frmAlta ? "Nueva Orden  dado de alta" : "Actualizacion de informacion de Orden", operacion == OperacionForm.frmAlta ? "Ingreso de Orden..." : "Actualizacion de informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al intentar " + (operacion == OperacionForm.frmAlta ? "ingresar nueva Orden" : "actualizar informacion") + ex.Message, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (_frmGrid != null)
            {
                _frmGrid.ReloadGrid();
            }
        }
Exemple #16
0
        public ActionResult DeleteConfirmed(int id)
        {
            DetalleOrden detalleOrden = db.DetalleOrden.Find(id);

            db.DetalleOrden.Remove(detalleOrden);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #17
0
 public Main(MySqlConnection xConnection)
 {
     InitializeComponent();
     this.xConnection = xConnection;
     xOrdenes         = new Ordenes(this.xConnection);
     xProd            = new Productos(this.xConnection);
     xDetProd         = new DetalleOrden(this.xConnection);
     xDetNota         = new DetalleNota(this.xConnection);
 }
Exemple #18
0
        private void btnOrd_Click(object sender, EventArgs e)
        {   //orden a insertar
            Orden ord = new Orden();

            ord.idOrden    = 1;
            ord.mesero     = "mesero1";
            ord.mesa       = "mesa1";
            ord.cliente    = "cliente";
            ord.fecha      = new DateTime(2018, 05, 31, 08, 59, 00);
            ord.comentario = "comentario";
            ord.total      = 10;
            ord.activa     = true;

            //productos que iran dentro de la orden
            producto prod = new producto();

            prod.idProducto            = 4;
            prod.nombre                = "prueba1";
            prod.precio                = 1.0;
            prod.categoria.idCategoria = 1;
            prod.area = 'b';

            producto prod2 = new producto();

            prod2.idProducto            = 5;
            prod2.nombre                = "prueba2";
            prod2.precio                = 2.0;
            prod2.categoria.idCategoria = 2;
            prod2.area = 'c';


            ord.detalle = new List <DetalleOrden>();
            DetalleOrden det = new DetalleOrden();

            DetalleOrden det2 = new DetalleOrden();

            det.producto = prod;
            det.cantidad = 4;
            ord.detalle.Add(det);

            det2.producto = prod2;
            det2.cantidad = 5;
            ord.detalle.Add(det2);

            try
            {
                if (ManejadorOrdenes.Insertar(ord) > 0)
                {
                    MessageBox.Show("Registro Insertado");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #19
0
        private static DetalleOrden ConvertirDeDataTableADetalleOrden(DataRow objDataRow)
        {
            DetalleOrden unDetalle = new DetalleOrden();

            unDetalle.Producto.PrecioVenta = (float)objDataRow["p.precio_venta"];
            unDetalle.Cantidad             = Convert.ToInt32(objDataRow["o._usuario_creador"]);
            unDetalle.Producto.Nombre      = objDataRow["producto"].ToString();

            return(unDetalle);
        }
        public static int sqlActualizar(DetalleOrden detalleOrden)
        {
            int respuesta = BD.BD.getInstance().sqlEjecutar(String.Format("update Detalle_Orden set Cantidad = {1} , Producto_id = {2}, Orden_producto_id = {3} where Id = {0}",
                                                                          detalleOrden.Id,
                                                                          detalleOrden.Cantidad,
                                                                          detalleOrden.Producto_id,
                                                                          detalleOrden.Orden_producto_id));

            return(respuesta);
        }
Exemple #21
0
        private void button75_Click(object sender, EventArgs e)
        {
            Orden ord = new Orden();

            ord.idOrden    = 4;
            ord.mesero     = "','mesero4";
            ord.mesa       = "','mesa4";
            ord.cliente    = "','cliente4";
            ord.fecha      = new DateTime(2018, 05, 31, 08, 59, 00);
            ord.comentario = "comentario_Actualizado";
            ord.total      = 3.0;
            ord.activa     = true;

            //productos que iran dentro de la orden
            producto prod = new producto();

            prod.idProducto            = 4;
            prod.nombre                = "prueba1_actualizado";
            prod.precio                = 1.0;
            prod.categoria.idCategoria = 1;
            prod.area = 'b';

            producto prod2 = new producto();

            prod2.idProducto            = 5;
            prod2.nombre                = "prueba2_Actualizado";
            prod2.precio                = 2.0;
            prod2.categoria.idCategoria = 2;
            prod2.area = 'c';

            //añadir registros a lista ord.detalle
            ord.detalle = new List <DetalleOrden>();
            DetalleOrden det  = new DetalleOrden();
            DetalleOrden det2 = new DetalleOrden();

            det.producto = prod;
            det.cantidad = 4;
            ord.detalle.Add(det);

            det2.producto = prod2;
            det2.cantidad = 5;
            ord.detalle.Add(det2);

            try
            {
                if (ManejadorOrdenes.Actualizar(ord) > 0)
                {
                    MessageBox.Show("Registro Actualizado");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #22
0
        public async Task <ActionResult <DetalleOrden> > GetDetalleOrden(int id)
        {
            DetalleOrden detalleOrden = await _context.DetalleOrden.FindAsync(id);

            if (detalleOrden == null)
            {
                return(NotFound());
            }

            return(detalleOrden);
        }
Exemple #23
0
 public void ShowDetalleOrden(DetalleOrden detordenIvk, IFormGridReload frmGrid)
 {
     _frmGrid                 = frmGrid;
     this.operacion           = OperacionForm.frmModificacion;
     this.Text                = "Modificacion de informacion de detalle de orden";
     detalle_orden            = detordenIvk;
     this.OrdenIdTxt.Text     = detalle_orden.OrdenId.ToString();
     DetalleId.Text           = detalle_orden.DetalleId.ToString();
     ProductoCbo.SelectedItem = detalle_orden.ProductoObj;
     CantidadTxt.Text         = detalle_orden.Cantidad.ToString();
 }
        public async Task <ActionResult> Put(int id, DetalleOrden detalle)
        {
            if (id == detalle.Id)
            {
                _context.Entry(detalle).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(NoContent());
            }
            return(BadRequest());
        }
Exemple #25
0
        public IHttpActionResult GetDetalleOrden(long id)
        {
            DetalleOrden detalleOrden = db.DetalleOrdenes.Find(id);

            if (detalleOrden == null)
            {
                return(NotFound());
            }

            return(Ok(detalleOrden));
        }
        public static int sqlAgregar(DetalleOrden detalleOrden)
        {
            String sql = string.Format("Insert into Detalle_Orden (Cantidad, Producto_id, Orden_producto_id) values('{0}','{1}','{2}')",
                                       detalleOrden.Cantidad,
                                       detalleOrden.Producto_id,
                                       detalleOrden.Orden_producto_id
                                       );
            int respuesta = BD.BD.getInstance().sqlEjecutar(sql);

            return(respuesta);
        }
Exemple #27
0
        public IHttpActionResult PostDetalleOrden(DetalleOrden detalleOrden)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DetalleOrdenes.Add(detalleOrden);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = detalleOrden.Id }, detalleOrden));
        }
        //public static DataTable sqlLeerConRubro()
        //{
        //    String sql = String.Format("SELECT p.Id, p.Nombre, p.Direccion, p.Telefono, p.Activo, r.Descripcion FROM Proveedor p JOIN Rubro r ON (p.Rubro_id = r.id)");
        //    return BD.BD.getInstance().sqlLeer(sql);
        //}

        public static bool sqlExiste(DetalleOrden detalleOrden)
        {
            String sql = String.Format("SELECT * FROM Detalle_Orden WHERE Id = {0}", detalleOrden.Id);

            DataTable respuesta = BD.BD.getInstance().sqlLeer(sql);

            if (respuesta.Rows.Count == 0)
            {
                return(false);
            }
            return(true);
        }
Exemple #29
0
 /// <summary>
 /// Mapears the detalle orden.
 /// </summary>
 /// <param name="read">The read.</param>
 /// <param name="detalle">The detalle.</param>
 /// <returns></returns>
 private DetalleOrden MapearDetalleOrden(SqlDataReader read, DetalleOrden detalle)
 {
     detalle                 = new DetalleOrden();
     detalle.Producto        = new Producto();
     detalle.Id              = Convert.ToInt32(read["IdDetalle"]);
     detalle.Producto.Id     = Convert.ToInt32(read["Id"]);
     detalle.Producto.Nombre = read["Nombre"].ToString();
     detalle.PrecioUnitario  = Convert.ToDecimal(read["PrecioUnitario"]);
     detalle.Cantidad        = Convert.ToInt32(read["Cantidad"]);
     detalle.ValorTotal      = Convert.ToDecimal(read["ValorTotal"]);
     return(detalle);
 }
Exemple #30
0
 public ActionResult Edit([Bind(Include = "iddetalleorden,Orden_Id,Hardware_Id,seriedt,usuariof,telefonof,ubicacion,cableseg,mouse,maleta,accesorio,valor,IGV,total,obscambio,estadodetalleorden,fregistro, gremision, grecepcion, codigontb, typedevice, seriehw, nmbrand, nmmodel, partnumberhw, snbatery, sncharger, nmprocessor, ghzprocessor, mcapacity, capacitystorage, lic, nmequipo, obshw")] DetalleOrden detalleOrden)
 {
     if (ModelState.IsValid)
     {
         db.Entry(detalleOrden).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Hardware_Id = new SelectList(db.Hardware, "idhw", "seriehw", detalleOrden.Hardware_Id);
     ViewBag.Orden_Id    = new SelectList(db.Orden, "idorden", "codigoorden", detalleOrden.Orden_Id);
     return(View(detalleOrden));
 }