public void eliminar() { BO.Usuario obj = (BO.Usuario)Session["frmUsuarioBO"]; Servicios.UsuarioCtrl objCtrl = new Servicios.UsuarioCtrl(); obj.Id_usuario = Convert.ToInt32(txtId.Text.Trim()); string mensaje = objCtrl.eliminaObj(obj); if (mensaje == "La operación se realizó de manera correcta") { Response.Redirect("wfTablaUsuario.aspx"); } else { Mensaje(mensaje); } }
public void DoOpen() { BO.Usuario oUsuario = new BO.Usuario(); Servicios.UsuarioCtrl oUsuarioCtrl = new Servicios.UsuarioCtrl(); //el .length sirve para que cuente cuantos caracteres hay. if (txtNombre.Text.Trim().Length != 0) { oUsuario.Nombre = txtNombre.Text.Trim(); } if (txtCorreo.Text.Trim().Length != 0) { oUsuario.Correo = txtCorreo.Text.Trim(); } if (txtTelefono.Text.Trim().Length != 0) { oUsuario.Telefono = txtTelefono.Text.Trim(); } DataTable dt = oUsuarioCtrl.devuelveObj(oUsuario); gvUsuarios.DataSource = dt; gvUsuarios.DataBind(); }
public void buscar() { BO.Usuario obj = (BO.Usuario)Session["frmUsuarioBO"]; Servicios.UsuarioCtrl objCtrl = new Servicios.UsuarioCtrl(); DataTable dt = objCtrl.devuelveObj(obj); if (dt.Rows.Count != 0) { txtId.Text = dt.Rows[0]["id_usuario"].ToString(); txtNombre.Text = dt.Rows[0]["nombre"].ToString(); txtApellidoMat.Text = dt.Rows[0]["apellido_mat"].ToString(); txtApellidoPat.Text = dt.Rows[0]["apellido_pat"].ToString(); txtAvatar.Text = dt.Rows[0]["avatar"].ToString(); txtCorreo.Text = dt.Rows[0]["correo"].ToString(); txtTelefono.Text = dt.Rows[0]["telefono"].ToString(); input_municipio.Text = dt.Rows[0]["municipio"].ToString(); txtSitioWeb.Text = dt.Rows[0]["sitio_web"].ToString(); txtUsername.Text = dt.Rows[0]["username"].ToString(); input_tipoUser.Text = dt.Rows[0]["tipo_usuario"].ToString(); txtPassword.Text = dt.Rows[0]["contrasenia"].ToString(); txtBiografia.Text = dt.Rows[0]["biografia"].ToString(); } }
public void modificar() { string mensaje = ""; if (txtId.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce la Clave \n"; } if (txtNombre.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el nombre\n"; } if (txtApellidoPat.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el apellido paterno \n"; } if (txtCorreo.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Correo \n"; } if (input_municipio.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el municipio \n"; } if (txtUsername.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Username \n"; } if (input_tipoUser.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el tipo de usuario \n"; } if (txtPassword.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce la contraseña \n"; } if (mensaje.Trim().Length == 0) { BO.Usuario obj = new BO.Usuario(); Servicios.UsuarioCtrl objCtrl = new Servicios.UsuarioCtrl(); obj.Id_usuario = Convert.ToInt32(txtId.Text.Trim().ToUpper()); obj.Nombre = txtNombre.Text.Trim().ToUpper(); obj.Avatar = txtAvatar.Text.Trim().ToUpper(); obj.Apellido_pat = txtApellidoPat.Text.Trim().ToUpper(); obj.Apellido_mat = txtApellidoMat.Text.Trim().ToUpper(); obj.Correo = txtCorreo.Text.Trim().ToUpper(); obj.Telefono = txtTelefono.Text.Trim().ToUpper(); obj.Municipio = input_municipio.Text.Trim().ToUpper(); obj.Sitio_web = txtSitioWeb.Text.Trim().ToUpper(); obj.Username = txtUsername.Text.Trim().ToUpper(); obj.Tipo_usuario = Convert.ToInt32(input_tipoUser.Text.Trim().ToUpper()); obj.Contrasenia = txtPassword.Text.Trim().ToUpper(); obj.Biografia = txtBiografia.Text.Trim().ToUpper(); string msn = objCtrl.actualizaObj(obj); if (msn == "La operación se realizó de manera correcta") { Response.Redirect("wfTablaUsuario.aspx"); } else { Mensaje(msn); } } else { Mensaje("Favor de ingresar los siguientes datos:\n" + mensaje); } }