Exemplo n.º 1
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                Personal user = new Personal();
                user.nombre   = txtName.Text;
                user.apellido = txtLastname.Text;
                user.telefono = txtPhone.Text;
                user.correo   = txtEmail.Text;
                user.password = txtPassword.Text;
                user.area     = userArea.SelectedValue;
                user.rol      = Convert.ToInt32(userRole.SelectedValue);

                PersonalController.insertUser(user);
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Nuevo usuario agregado');", true);
                Response.Redirect("Users.aspx");
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + ex.Message + "');", true);
            }
        }