예제 #1
0
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            bool paso = false;

            if (string.IsNullOrWhiteSpace(ProductoIdTextBox.Text) || ProductoIdTextBox.Text == "0")
            {
                paso = ProductoBLL.Guardar(producto);
            }
            else
            {
                if (!ExisteBD())
                {
                    MessageBox.Show("No Se puede Modificar porque no existe", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                paso = ProductoBLL.Modificar(producto);
            }

            if (paso)
            {
                Limpiar();
                MessageBox.Show("Guardado!!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public void BuscarTest()
        {
            Producto producto = new Producto();

            producto = ProductoBLL.Buscar(1);
            Assert.IsNotNull(producto);
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "prd_id,cat_id,prm_id,prd_nom,prd_img,prd_tal,prd_crt,prd_cnt,prd_prc,prd_dateOfCreated")] Producto producto)
        {
            HttpPostedFileBase fileBase = Request.Files[0];
            string             path     = SubirImagen(fileBase);

            if (path != "")
            {
                producto.prd_img = path;
            }
            else
            {
                producto.prd_img = "default";
            }

            if (ModelState.IsValid)
            {
                ProductoBLL.Create(producto);
                return(RedirectToAction("Index"));
            }
            //ViewBag.Menssage = file.FileName;
            ViewBag.cat_id = new SelectList(CategoriaBLL.List(), "cat_id", "cat_nom", producto.cat_id);
            ViewBag.prm_id = new SelectList(PromocionBLL.List(), "prm_id", "prm_nom", producto.prm_id);
            ViewBag.file   = fileBase;
            //producto.prd_img = SubirImagen(file);
            return(View(producto));
        }
예제 #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                int id;

                id = Convert.ToInt32(txtId.Text);

                ProductoBLL.getProductoByDescription(id);

                bool IsDelete = ProductoBLL.deleteProducto(id);

                if (IsDelete)
                {
                    MessageBox.Show("El registro se elimino correctamente.");
                }
                else
                {
                    MessageBox.Show("El registro no se pudo eliminar.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void txtCantidadDetalle_KeyUp(object sender, KeyEventArgs e)
        {
            long buscado = (long)cboProductos.SelectedValue;
            List <ProductoBLL> listado = new ProductoBLL().ListarTodo();
            int precio = (from pr in listado
                          where pr.Id_producto == buscado
                          select pr.Precio_Compra).FirstOrDefault();

            txtPrecio.Text = precio.ToString();
            try
            {
                int montoTotal = int.Parse(txtPrecio.Text);
                int cantidad   = int.Parse(txtCantidadDetalle.Text);
                if (cantidad > 0)
                {
                    montoTotal     = montoTotal * cantidad;
                    txtPrecio.Text = montoTotal.ToString();
                }
                else
                {
                }
            }
            catch (Exception)
            {
            }
        }
예제 #6
0
 private void btnOnClick(object sender, EventArgs e)
 {
     if (TxtProductoNombre.Text != null)
     {
         ProductoBLL.UpdateProducto(TxtProductoNombre.Text);
     }
 }
예제 #7
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Producto>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:    //todo
                    listado = ProductoBLL.GetList(p => true);
                    break;

                case 1:    //ID
                    int id = Convert.ToInt32(CriterioTextBox.Text);
                    listado = ProductoBLL.GetList(p => p.ProductoId == id);
                    break;

                case 2:    //Nombre Producto
                    listado = ProductoBLL.GetList(p => p.Nombre.Contains(CriterioTextBox.Text));
                    break;
                }
            }
            else
            {
                listado = ProductoBLL.GetList(p => true);
            }

            ConsultaDataGrid.ItemsSource = null;
            ConsultaDataGrid.ItemsSource = listado;
        }
예제 #8
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));
        }
예제 #9
0
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            bool paso = false;

            if (!Validar())
            {
                return;
            }

            if (String.IsNullOrEmpty(ProductoIdTextBox.Text) || ProductoIdTextBox.Text == "0")
            {
                paso = ProductoBLL.Guardar(producto);
            }

            else
            {
                if (!ExisteEnDb())
                {
                    MessageBox.Show("Persona no Valida", "Error", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                paso = ProductoBLL.Modificar(producto);
            }

            if (paso)
            {
                MessageBox.Show("Accion Realizada ", "Guardado", MessageBoxButton.OK, MessageBoxImage.Information);
                Limpiar();
            }
            else
            {
                MessageBox.Show(" No guardado", "Error", MessageBoxButton.OKCancel, MessageBoxImage.Information);
            }
        }
예제 #10
0
        private void FrmProducto_Load(object sender, EventArgs e)
        {
            try
            {
                ProductoBLL miProductoBLL = new ProductoBLL();

                DataSet ds = miProductoBLL.listado();
                dt = ds.Tables[0];

                dgvProducto.DataSource = dt;


                // dgvClientes.Enabled = false;
                if (dt.Rows.Count > 0)
                {
                    dgvProducto.Columns["Imagen"].Visible = false;
                    lblDatosNoEncontrados.Visible         = false;
                    dgvProducto_CellClick(null, null);
                }
                else
                {
                    lblDatosNoEncontrados.Visible = true;
                }

                MostrarGuardarCancelar(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
예제 #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));
        }
예제 #12
0
        private void dgvProducto_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            this.dgvListaMateriales.Rows.Clear();
            Producto    miProducto    = new Producto();
            ProductoBLL miProductoBLL = new ProductoBLL();

            if (dgvProducto.CurrentRow != null)
            {
                //
                txtId.Text                   = dgvProducto.CurrentRow.Cells["Id"].Value.ToString();
                txtCategoriaId.Text          = dgvProducto.CurrentRow.Cells["CategoriaId"].Value.ToString();
                txtCategoriaDescripcion.Text = dgvProducto.CurrentRow.Cells["CategoriaDescripcion"].Value.ToString();

                txtDescripcion.Text = dgvProducto.CurrentRow.Cells["Descripcion"].Value.ToString();
                txtPrecioVenta.Text = dgvProducto.CurrentRow.Cells["PrecioVenta"].Value.ToString();

                Imagen.BackgroundImage = null;
                byte[]       b  = (byte[])dgvProducto.CurrentRow.Cells["Imagen"].Value;
                MemoryStream ms = new MemoryStream(b);
                Imagen.Image    = Image.FromStream(ms);
                Imagen.SizeMode = PictureBoxSizeMode.StretchImage;


                miProducto = miProductoBLL.ObtenerProducto(Convert.ToInt32(dgvProducto.CurrentRow.Cells["Id"].Value));
                foreach (var item in miProducto.Req_Productos)
                {
                    string[] item2 = { item.Material.Id.ToString(),     item.Material.Descripcion, item.Material.Uni_Medida,
                                       item.Material.Precio.ToString(), item.Cantidad.ToString(),  item.Costo.ToString() };

                    dgvListaMateriales.Rows.Add(item2);
                }
            }
        }
예제 #13
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("¿Realmente desea eliminar los productos seleccionados?", "Eliminacion de Productos",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    foreach (DataGridViewRow row in dgvProducto.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells["Eliminar"].Value))
                        {
                            Producto producto = new Producto();
                            producto.Id = Convert.ToInt32(row.Cells["Id"].Value);

                            ProductoBLL miProductoBLL      = new ProductoBLL();
                            int         registrosAfectados = miProductoBLL.eliminar(producto);

                            if (registrosAfectados != 1)
                            {
                                MessageBox.Show("El Producto no pudo ser eliminado", "Eliminacion de Producto",
                                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }

                    FrmProducto_Load(null, null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
예제 #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtProducto.Text == "" || txtCodigo.Text == "" || txtPrecio.Text == "")
            {
                MessageBox.Show("No puedes dejar campos en blanco", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                Producto p = new Producto()
                {
                    Codigo         = txtCodigo.Text,
                    NombreProducto = txtProducto.Text,
                    Precio         = Convert.ToDouble(txtPrecio.Text)
                };

                Resultado r = ProductoBLL.AgregarProducto(p);

                if (r.Codigo == 1)
                {
                    MessageBox.Show("Producto agregado correctamente", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(r.Mensaje, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                control.AbrirFormProductos();
            }
        }
예제 #15
0
        public ActionResult Crear()
        {
            if (!PermisosModulo.ObtenerPermiso(Modulo.PRODUCTOS, Permiso.CREAR))
            {
                TempData["message"] = "danger,No tiene permisos.";
                return(RedirectToAction("Index"));
            }
            ProductoModel model   = new ProductoModel();
            ProductoBLL   prodBLL = new ProductoBLL();
            producto      entity  = null;

            try
            {
                model.UnidadNegocioList    = db.unidad_de_negocio.Where(m => m.ACTIVO);
                model.LineaNegocioList     = db.linea_negocio.Where(m => m.ACTIVO);
                model.disenioList          = db.disenio.Where(m => m.ACTIVO);
                model.FamilaProductoList   = db.familia_producto.Where(m => m.ACTIVO);
                model.EstatusSkuList       = db.estatus_sku.Where(m => m.ACTIVO);
                model.lineaProductoList    = db.linea_producto.Where(m => m.ACTIVO);
                model.conceptoProductoList = db.concepto_producto.Where(m => m.ACTIVO);
                model.segmentoList         = db.segmento.Where(m => m.ACTIVO);
                model.estiloList           = db.estilo_producto.Where(m => m.ACTIVO);
                //  model.Piezas = prodBLL.ObtenerPiezas(entity, db);
                model.Editable = true;
            }
            catch (Exception e)
            {
                LogUtil.ExceptionLog(e);
                model = null;
            }
            ViewBag.Editar = true;
            return(View(CREAR_ABSOLUTE_PATH, model));
        }
예제 #16
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Productos>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltrarComboBox.SelectedIndex)
                {
                case 0:
                    listado = ProductoBLL.GetList(x => true);
                    break;

                case 1:
                    int id;
                    id      = int.Parse(CriterioTextBox.Text);
                    listado = ProductoBLL.GetList(x => x.ProductoId == id);
                    break;

                case 2:
                    listado = ProductoBLL.GetList(x => x.Descripcion == CriterioTextBox.Text);
                    break;

                case 3:
                    int cantidad = Convert.ToInt32(CriterioTextBox.Text);
                    listado = ProductoBLL.GetList(c => c.Cantidad == cantidad);
                    break;
                }
            }
            else
            {
                listado = ProductoBLL.GetList(p => true);
            }
            ConsultarDataGrid.ItemsSource = null;
            ConsultarDataGrid.ItemsSource = listado;
        }
        public IHttpActionResult PutProducto(int id, Producto producto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != producto.idProducto)
            {
                return(BadRequest());
            }
            try
            {
                ProductoBLL.Update(producto);
                return(Content(HttpStatusCode.OK, "Producto actualizado correctamente"));
            }
            catch (Exception ex)
            {
                Producto pro = ProductoBLL.Get(id);
                if (pro == null)
                {
                    return(NotFound());
                }
                else
                {
                    return(StatusCode(HttpStatusCode.NoContent));
                }
            }
        }
예제 #18
0
        public void Actualizar()
        {
            try
            {
                metodo = new ProductoBLL();
                var resp = new Repository <FacturaDetalle>().Search(x => x.Estado == true && (x.Siclo == "C" || x.Siclo == "I") && x.EnBodega > 0);

                var indices = (from a in resp
                               select a.IDProducto).Distinct();

                datosProductos = new List <Producto>();

                foreach (var aux in indices)
                {
                    long IDp = aux.Value;
                    var  row = repositoryPro.Find(x => x.IDProducto == IDp);
                    row.EnBodega = resp.Where(x => x.IDProducto == IDp).Sum(x => x.EnBodega);
                    datosProductos.Add(row);
                }

                //datosProductos = metodo.Lista.Where(x => x.EnBodega>0).ToList();
                //foreach (var a in datosProductos)
                //    a.Iva = false;

                gCProductos.DataSource = datosProductos;
            }
            catch {  }
        }
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            bool paso = false;

            if (!Validar())
            {
                return;
            }

            if (productos.ProductoId == 0)
            {
                paso = ProductoBLL.Guardar(productos);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatosProducto())
                {
                    MessageBox.Show("No se puede Modificar un Producto que no existe", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                paso = ProductoBLL.Modificar(productos);
            }
            if (paso)
            {
                Limpiar();
                MessageBox.Show("Guardado!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "Fallo");
            }
        }
예제 #20
0
    public void cargarDatosProductos()
    {
        Producto theData = null;

        try
        {
            theData = ProductoBLL.GetProductoById(Convert.ToInt32(ProductoIdHiddenField.Value));

            if (theData == null)
            {
                Response.Redirect("~/Administracion/inventario/Producto/ListaProducto.aspx");
            }

            if (theData.ProductoId != 0)
            {
                NombreTextBox.Text                 = theData.Nombre;
                DescripcionTextBox.Text            = theData.Descripcion;
                UnidadMedidaComboBox.SelectedValue = theData.UnidadMedidaId;
                PrecioTextBox.Text                 = Convert.ToString(theData.Precio);
                stockTextBox.Text             = Convert.ToString(theData.Stock);
                FamiliaComboBox.SelectedValue = Convert.ToString(theData.FamiliaId);
                SaveProducto.Visible          = false;
                UpdateProductoButton.Visible  = true;
            }
        }
        catch
        {
            log.Error("Error al obtener la información del producto");
        }
    }
예제 #21
0
        private void button3_Click(object sender, EventArgs e)
        {
            Producto pro = new Producto();


            pro.IdProducto       = Convert.ToInt32(txtId.Text.ToString());
            pro.IdCategoria      = Convert.ToInt32(cbxCategoria.SelectedValue.ToString());
            pro.Nombre           = txtProducto.Text.Trim();
            pro.Marca            = txtMarca.Text.Trim();
            pro.Stock            = Convert.ToInt32(txtStock.Text.ToString());
            pro.PrecioCompra     = Convert.ToDecimal(txtPCompra.Text.ToString());
            pro.PrecioVenta      = Convert.ToDecimal(txtPVenta.Text.ToString());
            pro.FechaVencimiento = Convert.ToDateTime(dateTimePicker1.Value.ToString());
            pro.Foto             = imageToByteArray(pbImagen.Image);

            bool IsUpdate = ProductoBLL.updateProducto(pro);

            if (IsUpdate)
            {
                MessageBox.Show("El registro se modifico correctamente.");
            }
            else
            {
                MessageBox.Show("El registro no se pudo modificar .");
            }
        }
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            bool paso = false;

            if (!Validar())
            {
                return;
            }

            if (String.IsNullOrEmpty(ProductoIdTextBox.Text) || ProductoIdTextBox.Text == "0")
            {
                paso = ProductoBLL.Guardar(producto);
            }

            else
            {
                if (!ExisteEnDb())
                {
                    MessageBox.Show("No existe el cliente en la base de " +
                                    "datos", "Informacion", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                paso = ProductoBLL.Modificar(producto);
            }

            if (paso)
            {
                MessageBox.Show("Guardado!!", "EXITO", MessageBoxButton.OK, MessageBoxImage.Information);
                Limpiar();
            }
            else
            {
                MessageBox.Show(" No guardado!!", "Informacion", MessageBoxButton.OKCancel, MessageBoxImage.Information);
            }
        }
예제 #23
0
    private void cargarProductoLista()
    {
        try
        {
            string ordenar = "order by p.[nombre] asc";

            List <Producto> _cache        = new List <Producto>();
            string          armadoDeQuery = "@familiaId in(" + familiaIdHiddenField.Value + ")";
            string          query         = consultaSql(armadoDeQuery).SqlQuery();
            _totalRows = ProductoBLL.SearchProductoPaginacion(ref _cache, query, Pager1.PageSize, Pager1.CurrentRow, ordenar);
            familiaForIdRepeater.DataSource = _cache;
            familiaForIdRepeater.DataBind();

            Pager1.TotalRows = _totalRows;
            if (_cache.Count == 0)
            {
                noResult.Visible     = true;
                Pager1.Visible       = false;
                PagesButtons.Visible = true;
                return;
            }
            noResult.Visible = false;
            Pager1.Visible   = true;
            Pager1.BuildPagination();
        }
        catch (Exception ex)
        {
            log.Error("error al cargar la lista de articulos", ex);
            throw ex;
            //return;
        }
    }
예제 #24
0
        public void ObtenerProductos()
        {
            ProductoBLL bllProd = new ProductoBLL();

            comboProducto.DataSource = null;
            comboProducto.DataSource = bllProd.ListarProductosActivos();
        }
예제 #25
0
        private void btnBuscarCodigo_Click(object sender, EventArgs e)
        {
            try
            {
                ProductoBLL _ProductoBLL = new ProductoBLL();

                _Producto = _ProductoBLL.ObtenerProducto(int.Parse(this.mskCodigoProducto.Text));

                if (_Producto != null)
                {
                    this.txtNombreProducto.Text = _Producto.Descripcion;
                    this.txtPrecio.Text         = _Producto.Precio.ToString("0.00");
                    this.mskCantidad.Focus();
                }
                else
                {
                    MessageBox.Show("El Producto No existe !", "Anteción", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);


                MessageBox.Show(msg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #26
0
 public static int EliminarInventario(int idInventario)
 {
     try
     {
         InventarioBLL.Delete(idInventario);
         Inventario objInventario             = InventarioBLL.SelectById(idInventario);
         string     tipo                      = objInventario.Tipo;
         List <DetalleInventario> listDetalle = DetalleInventarioBLL.SelectByInventario(idInventario);
         foreach (DetalleInventario detalle in listDetalle)
         {
             Producto objProducto = ProductoBLL.SelectById(detalle.IdProducto);
             int      stock       = objProducto.Stock;
             int      cant        = detalle.Cantidad;
             if (tipo == "Ingreso")
             {
                 stock = stock - cant;
             }
             else
             {
                 stock = stock + cant;
             }
             ProductoBLL.UpdateStock(Convert.ToString(objProducto.IdProducto), stock);
         }
         return(idInventario);
     }
     catch (Exception)
     {
         return(-1);
     }
 }
        public void GetListTest()
        {
            var lista = new List <Producto>();

            lista = ProductoBLL.GetList(p => true);
            Assert.IsNotNull(lista);
        }
        private void Button_Guardar(object sender, RoutedEventArgs e)
        {
            Producto producto;
            bool     paso = false;

            producto = LlenaClase();

            if (IdTextbox.Text == "0")
            {
                paso = ProductoBLL.Guardar(producto);
            }

            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MessageBox.Show("Personas No Existe!!");
                }
                MessageBox.Show("Persona Modificada!!");
                paso = ProductoBLL.Modificar(producto);
            }

            if (paso)
            {
                MessageBox.Show("¡¡Guardado!!");
            }
            else
            {
                MessageBox.Show("No se Guardo!!");
            }
        }
예제 #29
0
        // GET: Remision/Create
        public ActionResult Create()
        {
            var almacenes   = new RemisionBLL().GetAllAlmacenes();
            var proveedores = new ProveedorBLL().GetAllProveedor();
            var productos   = new ProductoBLL().GetAllProductos();

            this.ViewData["Almacenes"]   = almacenes;
            this.ViewData["Proveedores"] = proveedores;
            this.ViewData["Productos"]   = productos;

            Producto prod = new Producto();

            // Build your models (example)
            List <SelectListItem> models = new List <SelectListItem>();

            models.Add(new SelectListItem()
            {
                Text = prod.Nombre, Value = prod.Descripcion
            });
            //models.Add(new SelectListItem() { Text = "Maruti Suzuki", Value = "Maruti Suzuki" });
            // Store your model in the ViewBag
            ViewBag.ProductList = models;

            return(View());
        }
예제 #30
0
        private void btnAgregarProducto_Click(object sender, EventArgs e)
        {
            try
            {
                Producto producto = new Producto();

                if (Valido())
                {
                    producto.codigo              = Convert.ToInt64(TxtCodigo.Text.ToString());
                    producto.nombreProducto      = TxtNombreProducto.Text.ToString();
                    producto.descripcionProducto = txtDescripcion.Text.ToString();
                    producto.precio              = Convert.ToDouble(TxtPrecio.Text.ToString());
                    producto.precioCompra        = Convert.ToDouble(TxtPrecioCompra.Text.ToString());
                    producto.cantidadExistencia  = Convert.ToInt64(TxtCantidadExistencia.Text.ToString());

                    Result      resultado   = new Result();
                    ProductoBLL productoBLL = new ProductoBLL();
                    resultado = productoBLL.AgregarProducto(producto);
                    Utilidades.MuestraInfo(resultado.mensaje);

                    if (resultado.estatus == 200)
                    {
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Utilidades.MuestraErrores(ex.Message);
            }
        }