private void button1_Click(object sender, EventArgs e) { bodegas bodega = new bodegas(); bodega.id_bodega = idBodega; bodega.nombre_bodega = txtBodega.Text; bodega.id_sucursal = Int32.Parse(cbxsucursal.SelectedValue.ToString()); bodega.id_tipo_bodega = Int32.Parse(cbxtipo.SelectedValue.ToString()); BodegasBL.EditarBodega(bodega); MessageBox.Show("Bodega Editado Correctamente", "Registro Editado", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
public static bodegas CrearBodega(bodegas bodegas) { using (inventarioEntities bd = new inventarioEntities()) { bodegas nuevabodega = new bodegas(); nuevabodega.nombre_bodega = bodegas.nombre_bodega; nuevabodega.id_sucursal = bodegas.id_sucursal; nuevabodega.id_tipo_bodega = bodegas.id_tipo_bodega; nuevabodega.estado = bodegas.estado; bd.bodegas.Add(nuevabodega); bd.SaveChanges(); } return(bodegas); }
public static bodegas EditarBodega(bodegas bodegat) { using (inventarioEntities bd = new inventarioEntities()) { var bg = bd.bodegas.First(x => x.id_bodega == bodegat.id_bodega);//obtenemos registro por medio de id bg.id_bodega = bodegat.id_bodega; bg.nombre_bodega = bodegat.nombre_bodega; bg.id_sucursal = bodegat.id_sucursal; bg.id_tipo_bodega = bodegat.id_tipo_bodega; bd.Entry(bg).State = System.Data.Entity.EntityState.Modified; bd.SaveChanges(); } return(bodegat); }
public static bodegas ObtenerIdBodega(int id) { bodegas bod = new bodegas(); using (inventarioEntities bd = new inventarioEntities()) { var bodega = bd.bodegas.First(x => x.id_bodega == id); bodega.id_bodega = bodega.id_bodega; bodega.nombre_bodega = bodega.nombre_bodega; bodega.id_sucursal = bodega.id_sucursal; bodega.id_tipo_bodega = bodega.id_tipo_bodega; bodega.estado = bodega.estado; return(bodega); } }
private void btnAgregar_Click(object sender, EventArgs e) { bodegas bdg = new bodegas(); bdg.nombre_bodega = txtBodega.Text; bdg.id_sucursal = Int32.Parse(cbxsucursal.SelectedValue.ToString()); bdg.id_tipo_bodega = Int32.Parse(cbxbodega.SelectedValue.ToString()); if (rdbactivo.Checked) { bdg.estado = 1; } else { bdg.estado = 0; } BodegasBL.CrearBodega(bdg); MessageBox.Show("Bodega registrada Correctamente", "Registro Agregado", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void FormEditarBodega_Load(object sender, EventArgs e) { //lenar datos bodegas bodega = BodegasBL.ObtenerIdBodega(idBodega); txtBodega.Text = bodega.nombre_bodega; //Cargar tipo de sucursales cbxsucursal.DisplayMember = "sucursal"; cbxsucursal.ValueMember = "id_sucursal"; cbxsucursal.DataSource = SucursalBL.CargarSucursales(); string idsucursal = bodega.id_sucursal.ToString(); cbxsucursal.SelectedIndex = Int32.Parse(idsucursal) - 1; //Cargar tipo de bodegas cbxtipo.DisplayMember = "tipo"; cbxtipo.ValueMember = "id_tipo_bodega"; cbxtipo.DataSource = TipoBodegasBL.CargarTipoBodega(); string idtipo = bodega.id_tipo_bodega.ToString(); cbxtipo.SelectedIndex = Int32.Parse(idtipo) - 1; }
public static bodegas EditarBodega(bodegas bodega) { return(BodegaDAL.EditarBodega(bodega)); }
public static bodegas CrearBodega(bodegas nuevabodega) { return(BodegaDAL.CrearBodega(nuevabodega)); }