コード例 #1
0
 private void CargarSeleccion()
 {
     cod_categorias oCategorias=new cod_categorias();
     CategoriaImplement oCategoriaImplement=new CategoriaImplement();
     DataGridViewRow row = this.dgvCategoria.CurrentRow;
     int id = Convert.ToInt32(row.Cells[0].Value);
     oCategorias=oCategoriaImplement.Get(id);
     this.lblCodigo.Text = oCategorias.id_categoria.ToString();
     this.txtNombre.Text = oCategorias.categoria;
     this.gbCategorias.Enabled = false;
     Deshabilitar();
 }
コード例 #2
0
 private void Guardar()
 {
     cod_categorias oCategoria=new cod_categorias();
     CategoriaImplement oCategoriaImplement=new CategoriaImplement();
     if (this.lblCodigo.Text == "")
     {
         oCategoria.categoria=this.txtNombre.Text;
         oCategoriaImplement.Save(oCategoria);
     }
     else
     {
         DataGridViewRow row = this.dgvCategoria.CurrentRow;
         int id = Convert.ToInt32(row.Cells[0].Value);
         oCategoria = oCategoriaImplement.Get(id);
         oCategoria.categoria = this.txtNombre.Text;
         oCategoriaImplement.Update(oCategoria);
     }
     Deshabilitar();
     this.txtNombre.Text = "";
     CargarGrid();
 }
コード例 #3
0
 private void ModificarCategoria()
 {
     HabilitarBotones();
     this.gbCategorias.Enabled = true;
     cod_categorias oCategoria=new cod_categorias();
     CategoriaImplement oCategoriaImplement=new CategoriaImplement();
     DataGridViewRow row = this.dgvCategoria.CurrentRow;
     int id = Convert.ToInt32(row.Cells[0].Value);
     oCategoria = oCategoriaImplement.Get(id);
     this.lblCodigo.Text = oCategoria.id_categoria.ToString();
     this.txtNombre.Text = oCategoria.categoria;
     this.dgvCategoria.Enabled = false;
 }