protected void btnGuardar_Click(object sender, EventArgs e) { try { DTO.Articulo articulo = new DTO.Articulo(); articulo.Articulo_ID = txtArticuloID.Text; articulo.Descripcion = txtDescripcion.Text; articulo.StockMaximo = Convert.ToInt32(txtMaximo.Text); articulo.StockMinimo = Convert.ToInt32(txtMinimo.Text); articulo.StockCritico = Convert.ToInt32(txtCritico.Text); articulo.Categoria_ID = Convert.ToInt32(ddlArticulo.SelectedValue); articulo.Create(); } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { FormsAuthentication.SignOut(); Response.Redirect("~/web/Login/Default.aspx"); } if (!IsPostBack) { DTO.Articulo articulos = new DTO.Articulo(); DTO.Bodega bodegas = new DTO.Bodega(); if (articulos.ReadAll()) { foreach (var tmp in articulos.Coleccion) { ddArticulo.Items.Add(new ListItem() { Text = tmp.Articulo_ID, Value = tmp.Articulo_ID }); } } if (bodegas.ReadAll()) { foreach (var tmp in bodegas.Coleccion) { ddBodegaEntrada.Items.Add(new ListItem() { Text = tmp.Nombre, Value = tmp.Bodega_ID.ToString() }); ddBodegaSalida.Items.Add(new ListItem() { Text = tmp.Nombre, Value = tmp.Bodega_ID.ToString() }); } } } }