Ejemplo n.º 1
0
        protected void btnCriar_ServerClick(object sender, EventArgs e)
        {
            string Nome = txtNome.Text.ToPrepare();
            string Login = txtLogin.Text.ToPrepare();
            string Senha = txtSenha.Text.ToPrepare();
            string Apartamento = txtApartamento.Text.ToPrepare();
            string Torre = ddlTorre.SelectedValue;

            Entity.Usuario usuario = new Entity.Usuario();
            usuario.Nome = Nome;
            usuario.Login = Login;
            usuario.Senha = Senha;
            usuario.Apartamento = Convert.ToInt32(Apartamento);
            usuario.Torre = Torre;

            Entity.Retorno ret = new Business.Usuario().InserirUsuario(usuario);
            if (!ret.Status)
            {
                Response.Write(ret.Erro);
                return;
            }

            usuario.IDUsuario = ret.Identity;
            Session[Constante.Sessions.LOGIN] = usuario;
            Response.Redirect("~/");
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[Constante.Sessions.LOGIN] == null)
                Response.Redirect("~/login.aspx");

            usuario = (Entity.Usuario)Session[Constante.Sessions.LOGIN];
        }
Ejemplo n.º 3
0
 protected void Page_Init(object sender, EventArgs e)
 {
     usuario = (Entity.Usuario)Session[Constante.Sessions.LOGIN];
 }