public void modificar() { string mensaje = ""; if (txtId.Text == string.Empty) { mensaje = mensaje + "Introduce la Clave \n"; } if (txtNombre.Text == string.Empty) { mensaje = mensaje + "Introduce el nombre\n"; } if (mensaje.Trim().Length == 0) { BO.Categoria obj = new BO.Categoria(); Servicios.CategoriaCtrl objCtrl = new Servicios.CategoriaCtrl(); obj.Id_categoria = Convert.ToInt32(txtId.Text); obj.Nombre_cat = txtNombre.Text; string msn = objCtrl.actualizaObj(obj); if (msn == "La operación se realizó de manera correcta") { Response.Redirect("wfTablaCategoria.aspx"); } else { Mensaje(msn); } } else { Mensaje("Favor de ingresar los siguientes datos:\n" + mensaje); } }
public void buscar() { BO.Categoria obj = (BO.Categoria)Session["frmCategoriaBO"]; Servicios.CategoriaCtrl objCtrl = new Servicios.CategoriaCtrl(); DataTable dt = objCtrl.devuelveObj(obj); if (dt.Rows.Count != 0) { txtId.Text = dt.Rows[0]["id_categoria"].ToString(); txtNombre.Text = dt.Rows[0]["nombre_cat"].ToString(); } }
public void DoOpen() { BO.Categoria oCategoria = new BO.Categoria(); Servicios.CategoriaCtrl oCategoriaCtrl = new Servicios.CategoriaCtrl(); //el .length sirve para que cuente cuantos caracteres hay. if (txtNombre.Text.Trim().Length != 0) { oCategoria.Nombre_cat = txtNombre.Text.Trim(); } DataTable dt = oCategoriaCtrl.devuelveObj(oCategoria); gvCategorias.DataSource = dt; gvCategorias.DataBind(); }
public void eliminar() { BO.Categoria obj = (BO.Categoria)Session["frmCategoriaBO"]; Servicios.CategoriaCtrl objCtrl = new Servicios.CategoriaCtrl(); obj.Id_categoria = Convert.ToInt32(txtId.Text.Trim()); string mensaje = objCtrl.eliminaObj(obj); if (mensaje == "La operación se realizó de manera correcta") { Response.Redirect("wfTablaCategoria.aspx"); } else { Mensaje(mensaje); } }