Пример #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Label1Nombre.Text != "" & LabelPregunta.Text != "" & LabelPregunta.Text != "" & LabelRespuesta.Text != "")
            {
                Usuario           MiUsuario = new Usuario();
                ConexionBDUsuario Miconex   = new ConexionBDUsuario();

                MiUsuario.Nombre     = Label1Nombre.Text;
                MiUsuario.Contrasena = TextBoxpassword.Text;
                MiUsuario.Pregunta   = LabelPregunta.Text;
                MiUsuario.Respuesta  = LabelRespuesta.Text;
                MiUsuario.FkRol      = Convert.ToInt32(DropDownRol.SelectedValue);
                MiUsuario.FkPersona  = Convert.ToInt32(DropDownPersona.SelectedValue);


                if (Miconex.AgregarUsuario(MiUsuario))
                {
                    LabelNotificacion.Visible = true;
                    LabelNotificacion.Text    = "Usuario Agregado Correctamente.";
                }
                else
                {
                    LabelNotificacion.Visible = true;
                    LabelNotificacion.Text    = "Error, el usuario no pudo ser agregado.";
                }
            }

            else
            {
                LabelNotificacion.Visible = true;
                LabelNotificacion.Text    = "Error, Campos Vacios.";
            }
        }