Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ObjAdm"] == null)
        {
            Response.Redirect("/");
        }

        if (Page.RouteData.Values["id"] == null)
        {
            Response.Redirect("/404");
        }

        long id = 0;

        try
        {
            id = Convert.ToInt64(Page.RouteData.Values["id"]);
        }
        catch
        {
            Response.Redirect("/404");
        }

        Estabelecimento estabelecimento = EstabelecimentoDB.Select(id);

        if (estabelecimento == null)
        {
            Response.Redirect("/404");
        }

        usuario = UsuarioDB.SelectByEstabelecimento(estabelecimento);

        if (usuario != null)
        {
            lblEmail.Text           = usuario.Email;
            lblNomeResponsavel.Text = usuario.Estabelecimento.Responsavel;
            lblTelefone.Text        = usuario.Estabelecimento.Telefone;
            lblCelular.Text         = usuario.Estabelecimento.Celular;
            lblNomeFantasia.Text    = usuario.Estabelecimento.Fantasia;
            lblRazaoSocial.Text     = usuario.Estabelecimento.RazaoSocial;
            lblCnpj.Text            = usuario.Estabelecimento.Cnpj;
            lblCep.Text             = usuario.Estabelecimento.Endereco.Cep;
            lblLogradouro.Text      = usuario.Estabelecimento.Endereco.Logradouro;
            lblNumero.Text          = usuario.Estabelecimento.Endereco.Numero;
            lblBairro.Text          = usuario.Estabelecimento.Endereco.Bairro;
            lblCidade.Text          = usuario.Estabelecimento.Endereco.Cidade.Nome;
            lblEstado.Text          = usuario.Estabelecimento.Endereco.Cidade.Estado.Nome;
        }
        else
        {
            Response.Redirect("/404");
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ((HtmlHead)Master.FindControl("headMaster")).Title += " Plus";

        if (Session["ObjAdm"] == null)
        {
            Response.Redirect("/");
        }

        if (Page.RouteData.Values["id"] == null)
        {
            Response.Redirect("/404");
        }

        long id = 0;

        try
        {
            id = Convert.ToInt64(Page.RouteData.Values["id"]);
        }
        catch
        {
            Response.Redirect("/404");
        }

        Estabelecimento estabelecimento = EstabelecimentoDB.Select(id);

        if (estabelecimento == null)
        {
            Response.Redirect("/404");
        }

        usuario = UsuarioDB.SelectByEstabelecimento(estabelecimento);

        if (usuario != null)
        {
            lblNomeResponsavel.Text = usuario.Estabelecimento.Responsavel;
            lblTelefone.Text        = usuario.Estabelecimento.Telefone;
            lblCelular.Text         = usuario.Estabelecimento.Celular;
            lblNomeFantasia.Text    = usuario.Estabelecimento.Fantasia;
        }
        else
        {
            Response.Redirect("/404");
        }
    }
    protected void btnEnviar_Click(object sender, EventArgs e)
    {
        string assunto  = dpdAssunto.SelectedItem.Text;
        string email    = txbEmail.Text;
        string nome     = txbNome.Text;
        string telefone = txbTelefone.Text;
        string texto    = txbMensagem.Value;

        long    id      = Convert.ToInt64(Page.RouteData.Values["codigo"]);
        Usuario usuario = UsuarioDB.SelectByEstabelecimento(id);

        int retorno = Email.EnviarEmail(usuario.Email, assunto, texto, nome, email, telefone);

        if (retorno == 1)
        {
            //Utils.CleanControls(Page);
            Response.Redirect("/?y=");
        }
    }
Exemple #4
0
    protected void btnEditSenhaConfirmar_Click(object sender, EventArgs e)
    {
        if (txbNovaSenha.Text != txbConfirmarSenha.Text)
        {
            lblErro.Text = "* Os campos Nova Senha e Digite Novamente devem ser iguais";
            return;
        }

        Usuario userValid   = new Usuario();
        var     EstabLogado = (Estabelecimento)Session["ObjEst"];

        userValid = UsuarioDB.SelectByEstabelecimento(EstabLogado);

        UsuarioCrypto user            = new UsuarioCrypto();
        UsuarioCrypto userNewPassword = new UsuarioCrypto();

        user.Senha            = txbSenha.Text;
        user.Codigo           = userValid.Codigo;
        userNewPassword.Senha = txbNovaSenha.Text;

        if (!UsuarioDB.SenhaIsValid(user))
        {
            lblErro.Text = "* Campo Senha está incorreto";
            return;
        }

        userValid.Senha = userNewPassword.Senha;

        if (UsuarioDB.UpdateSenha(userValid) != -2)
        {
            Response.Redirect("/estabelecimento/" + EstabLogado.Codigo + "?n=b");
        }
        else
        {
            Response.Redirect("/editar/conta?n=B");
        }
    }