Exemplo n.º 1
0
        protected void BtnRegistrar_Click(object sender, EventArgs e)

        {
            //Usuario UsuarioRgstro = (Usuario)Session["usuario"];

            //Usuario NewUsuario = new Usuario();
            //var listaUser = usuario.ToList();

            //NUsuario negocio = new NUsuario();
            Usuario oUser = new Usuario(); //usando el jmodel

            oUser.Rut      = txtRut.Text;
            oUser.Nombre   = txtNombre.Text;
            oUser.Apellido = txtApellidos.Text;
            oUser.Telefono = int.Parse(txtTelefono.Text);
            //oUser.COMUNAA = ddlUbicacion.SelectedItem.Text.ToString(); CARGAR DDL DE COMUNAS
            oUser.Password        = txtPassword.Text;
            oUser.Correo          = txtCorreo.Text;
            oUser.FechaNacimiento = DateTime.Parse(txtFechaNacimiento.Text);
            oUser.Comuna          = txtComuna.Text;

            NUsuario us        = new NUsuario();
            var      resultado = us.Create(oUser);

            if (resultado.IsSuccess)
            {
                LimpiarControles();

                //ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), "alert('Se ha Registrado Exitosamente! Felicidades!!')", true);

                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script> swal('Registro Exitoso!', 'Felicidades, Presione Ok!', 'success') </script>"); /*ésto es sweet alert llamado del script y link*/
                                                                                                                                                                       //ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "redirigir");
            }


            else
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), "alert('No se ha podido registrar :c')", true);
            }
        }