Ejemplo n.º 1
0
    protected void grdContato_RowEditing(object sender, GridViewEditEventArgs e)
    {
        grdContato.EditIndex = e.NewEditIndex;
        int n = Convert.ToInt32(Funcoes.AESDecodifica(Request.QueryString["pfl"].Replace(" ", "+")));

        CarregarTabela(n);
    }
Ejemplo n.º 2
0
    protected void grdContato_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        grdContato.EditIndex = -1;
        int x = Convert.ToInt32(Funcoes.AESDecodifica(Request.QueryString["pfl"].Replace(" ", "+")));

        CarregarTabela(x);
    }
Ejemplo n.º 3
0
    protected void EnviarEmail()
    {
        string retorno, assunto, mensagem;
        int    codigo = 0;
        string ano = "", email = "", senha = "";

        ano = DateTime.Now.ToString();
        ano = ano.Substring(6, 4);

        senha = Wistoll.RedefinirSenha.RedefinirSenha.JuntarNumeroLetras() + ano;

        senha = Funcoes.AESDecodifica(Funcoes.AESCodifica(senha));

        assunto  = "Redefinir Senha";
        mensagem = "Sua senha para logar no sistema Wistoll é: " + senha;

        codigo = FuncionarioDB.RedefinirSenhaContato(txtEmail.Text);
        email  = txtEmail.Text;

        if (codigo != 0)
        {
            FuncionarioDB.RedefinirSenha(codigo, Funcoes.HashTexto(senha));
            retorno = Email.EnviarEmail(email, assunto, mensagem);
        }
    }
Ejemplo n.º 4
0
    protected void grdContato_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int n = Convert.ToInt32(grdContato.DataKeys[e.RowIndex].Value.ToString());

        ContatoDB.Excluir(n);
        int x = Convert.ToInt32(Funcoes.AESDecodifica(Request.QueryString["pfl"].Replace(" ", "+")));

        CarregarTabela(x);
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FunMod fmp = (FunMod)Session["funcionario"];

        if (Session["funcionario"] != null)
        {
            if (!Page.IsPostBack)
            {
                DataSet ds1    = new DataSet();
                string  pagina = "";
                int     n      = 0;
                ds1 = FunModDB.SelectMenu(fmp.Funcionario.Fun_cod);
                foreach (DataRow dr in ds1.Tables[0].Rows)
                {
                    pagina = dr["mod_pagina"].ToString();
                    if (pagina == "ConsultaUsuario.aspx")
                    {
                        n = 1;
                    }
                }

                if (n != 1)
                {
                    Response.Redirect("~/paginas/Erro/Erro404.aspx");
                }

                string ativo = "";

                if (Request.QueryString["par"] != null && Request.QueryString["par"] != "")
                {
                    string par = Request.QueryString["par"].ToString().Replace(" ", "+");
                    ativo = Funcoes.AESDecodifica(par);
                }
                else
                {
                    ativo = "Ativo";
                }

                if (Request.QueryString["tip"] != null && Request.QueryString["tip"] != "")
                {
                    string tip = Request.QueryString["tip"].ToString().Replace(" ", "+");
                    ativo = Funcoes.AESDecodifica(tip);
                }

                CarregarUsuarios(ativo, fmp.Funcionario.Fun_cod);
            }
        }
        else
        {
            Session["info"] = null;
            Response.Redirect("~/paginas/Login.aspx");
        }
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FunMod fmp = (FunMod)Session["funcionario"];

        if (Session["funcionario"] != null)
        {
            if (!Page.IsPostBack)
            {
                DataSet ds1    = new DataSet();
                string  pagina = "";
                int     n      = 0;
                ds1 = FunModDB.SelectMenu(fmp.Funcionario.Fun_cod);
                foreach (DataRow dr in ds1.Tables[0].Rows)
                {
                    pagina = dr["mod_pagina"].ToString();
                    if (pagina == "ConsultaRequerente.aspx")
                    {
                        n = 1;
                    }
                }

                if (n != 1)
                {
                    Response.Redirect("~/paginas/Erro/Erro404.aspx");
                }
            }

            string ativo = "";
            if (Request.QueryString["par"] != null && Request.QueryString["par"] != "")
            {
                string par = Request.QueryString["par"].ToString().Replace(" ", "+");
                ativo = Funcoes.AESDecodifica(par);
            }
            else
            {
                ativo = "Ativo";
            }

            CarregarRequerentes(ativo);

            if (lbl.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>info();</script>", false);
            }
        }
        else
        {
            Session["info"] = null;
            Response.Redirect("~/paginas/Login.aspx");
        }
    }
Ejemplo n.º 7
0
    protected string Decodificar(FunMod fmp)
    {
        string tipo = "";

        if (Request.QueryString["par"] != null)
        {
            if (Request.QueryString["par"].ToString() != "")
            {
                try
                {
                    string user = Request.QueryString["par"].ToString().Replace(" ", "+");
                    int    cod  = Convert.ToInt32(Funcoes.AESDecodifica(Request.QueryString["cod"].ToString().Replace(" ", "+")));
                    tipo = Funcoes.AESDecodifica(user);


                    switch (tipo)
                    {
                    case "Fisica":
                        mlv.ActiveViewIndex = 0;
                        CarregarFisica(cod);
                        CarregarTabela(cod);
                        break;

                    case "Juridica":
                        mlv.ActiveViewIndex = 1;
                        CarregarJuridica(cod);
                        CarregarTabela1(cod);
                        break;
                    }

                    return(tipo);
                }
                catch (Exception erro)
                {
                    if (fmp.Funcionario.Perfil.Pfl_descricao.Equals("Administrador"))
                    {
                        Response.Redirect("~/Paginas/Admin.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/Paginas/Index.aspx");
                    }

                    tipo = "";
                }
            }
        }

        return(tipo);
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FunMod fmp = (FunMod)Session["funcionario"];

        if (Session["funcionario"] != null)
        {
            if (!Page.IsPostBack)
            {
                DataSet ds1    = new DataSet();
                string  pagina = "";
                int     n      = 0;
                ds1 = FunModDB.SelectMenu(fmp.Funcionario.Fun_cod);
                foreach (DataRow dr in ds1.Tables[0].Rows)
                {
                    pagina = dr["mod_pagina"].ToString();
                    if (pagina == "ExcluirSetor.aspx")
                    {
                        n = 1;
                    }
                }

                if (n != 1)
                {
                    Response.Redirect("~/paginas/Erro/Erro404.aspx");
                }

                if (Request.QueryString["par"] != null)
                {
                    if (Request.QueryString["par"].ToString() != "")
                    {
                        string valor = Request.QueryString["par"].ToString().Replace(" ", "+");
                        int    n1    = Convert.ToInt32(Funcoes.AESDecodifica(valor));

                        Setor set = SetorDB.Select(n1);

                        txbCodigo.Text = Convert.ToString(set.Set_cod);
                        txbDesc.Text   = Convert.ToString(set.Set_descricao);
                        txbNome.Text   = Convert.ToString(set.Set_nome);

                        txbNomeDepar.Text = set.Departamento.Dep_nome;
                    }
                }
            }
        }
        else
        {
            Session["info"] = null;
            Response.Redirect("~/paginas/Login.aspx");
        }
    }
Ejemplo n.º 9
0
    protected void grdContato_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        FunMod  fmp = (FunMod)Session["funcionario"];
        int     n   = Convert.ToInt32(grdContato.DataKeys[e.RowIndex].Value.ToString());
        TextBox txb = (TextBox)grdContato.Rows[e.RowIndex].FindControl("txbContato");
        Contato con = new Contato();

        con.Con_valor = txb.Text;
        con.Con_cod   = n;
        con.Cod_fun   = fmp.Funcionario.Fun_cod;
        ContatoDB.Atualizar(con);
        grdContato.EditIndex = -1;
        int x = Convert.ToInt32(Funcoes.AESDecodifica(Request.QueryString["pfl"].Replace(" ", "+")));

        CarregarTabela(x);
    }
Ejemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["par"] != null)
        {
            if (Request.QueryString["par"].ToString() != "")
            {
                try
                {
                    string par = Request.QueryString["par"].ToString().Replace(" ", "+");
                    n = Convert.ToInt32(Funcoes.AESDecodifica(par));
                }
                catch (Exception erro)
                {
                    Response.Redirect("~/Paginas/Login.aspx");

                    n = 0;
                }
            }
        }
    }
Ejemplo n.º 11
0
    protected void Decodificar()
    {
        if (Request.QueryString["usu"] != null)
        {
            if (Request.QueryString["usu"].ToString() != "")
            {
                try
                {
                    string usu = Request.QueryString["usu"].ToString().Replace(" ", "+");
                    int    n   = Convert.ToInt32(Funcoes.AESDecodifica(usu));

                    PerfilUsuario(n);
                }
                catch (Exception erro)
                {
                    Response.Redirect("~/Paginas/Erro/Erro404.aspx");
                }
            }
        }
    }
Ejemplo n.º 12
0
    protected int Decodificar(FunMod fmp)
    {
        int n = 0;

        if (Request.QueryString["pfl"] != null)
        {
            if (Request.QueryString["pfl"].ToString() != "")
            {
                try
                {
                    string user = Request.QueryString["pfl"].ToString().Replace(" ", "+");
                    n = Convert.ToInt32(Funcoes.AESDecodifica(user));

                    AlterarUsuario(n);
                    CarregarChecks(n, fmp);
                    CarregarTabela(n);
                    CarregarCargo(n);
                    CarregarSetor(n);
                    CarregarChecksPadrao(n);

                    return(n);
                }
                catch (Exception erro)
                {
                    if (fmp.Funcionario.Perfil.Pfl_descricao.Equals("Administrador"))
                    {
                        Response.Redirect("~/Paginas/Admin.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/Paginas/Index.aspx");
                    }

                    n = 0;
                }
            }
        }

        return(n);
    }
Ejemplo n.º 13
0
    //protected void btnEnviar_Click(object sender, EventArgs e)
    //{
    //    var caminho = @"C:\Users\Luiz Anthero\Downloads";
    //    var nome = fileAnexos.FileName;
    //    var completo = caminho + nome;

    //    fileAnexos.PostedFile.SaveAs(completo);
    //}

    protected void Decodificar()
    {
        string n = "";

        if (Request.QueryString["pro"] != null)
        {
            if (Request.QueryString["pro"].ToString() != "")
            {
                try
                {
                    string pro = Request.QueryString["pro"].ToString().Replace(" ", "+");
                    n = Convert.ToString(Funcoes.AESDecodifica(pro));

                    //return n;
                    CarregarComponentes(n);
                }
                catch (Exception e)
                {
                    n = "";
                }
            }
        }
    }
Ejemplo n.º 14
0
    protected void Decodificar()
    {
        if (Request.QueryString["dto"] != null)
        {
            if (Request.QueryString["dto"].ToString() != "")
            {
                try
                {
                    string depar = Request.QueryString["dto"].ToString().Replace(" ", "+");
                    int    n1    = Convert.ToInt32(Funcoes.AESDecodifica(depar));

                    Departamento dep = DepartamentoDB.Select(n1);

                    txbCodigo.Text = Convert.ToString(dep.Dep_cod);
                    txbDesc.Text   = Convert.ToString(dep.Dep_descricao);
                    txbNome.Text   = Convert.ToString(dep.Dep_nome);
                }
                catch (Exception erro)
                {
                    Response.Redirect("~/Paginas/ConsultaDepartamento.aspx");
                }
            }
        }
    }
Ejemplo n.º 15
0
    protected void lnkAddContato_Click(object sender, EventArgs e)
    {
        FunMod fmp   = (FunMod)Session["funcionario"];
        int    n     = Convert.ToInt32(Funcoes.AESDecodifica(Request.QueryString["pfl"].Replace(" ", "+")));
        string tipo  = "";
        string valor = "";
        int    x     = 0;

        if (ddlTipoContato.SelectedIndex != 0)
        {
            switch (ddlTipoContato.SelectedIndex)
            {
            case 1:
                if (txbEmail.Text != "")
                {
                    tipo  = ddlTipoContato.SelectedValue;
                    valor = txbEmail.Text;
                    x     = 1;
                }
                break;

            case 2:
                if (txbTelefone.Text != "")
                {
                    tipo  = ddlTipoContato.SelectedValue;
                    valor = txbTelefone.Text;
                    x     = 1;
                }
                break;

            case 3:
                if (txbCelular.Text != "")
                {
                    tipo  = ddlTipoContato.SelectedValue;
                    valor = txbCelular.Text;
                    x     = 1;
                }
                break;
            }

            if (x != 0)
            {
                Contato con = new Contato();
                con.Pessoa = new Pessoa();

                con.Con_tipo       = tipo;
                con.Con_valor      = valor;
                con.Pessoa.Pes_cod = n;
                con.Cod_fun        = fmp.Funcionario.Fun_cod;

                switch (ContatoDB.Insert(con))
                {
                case 0:
                    Response.Redirect("../paginas/AlterarPerfil.aspx?pfl=" + Request.QueryString["pfl"].Replace(" ", "+"));
                    break;

                case -2:
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>erroContato();</script>", false);
                    break;
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>erroContato();</script>", false);
            }
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>erroContato();</script>", false);
        }
    }
Ejemplo n.º 16
0
    protected void btnSalvar_Click(object sender, EventArgs e)
    {
        FunMod funCod = (FunMod)Session["funcionario"];

        string texto = Request.QueryString["pfl"].Replace(" ", "+");
        int    n     = Convert.ToInt32(Funcoes.AESDecodifica(texto));
        FunMod fmp1  = FunModDB.Select(n);

        if (txtNome1.Text != "" && txtSobrenome1.Text != "" && txtDataNas1.Text != "" && ddlCargo.SelectedIndex != 0 && txtMatricula1.Text != "" && txtCPF1.Text != "" && txtRG1.Text != "" && txtCEP1.Text != "" && ddlEstados.SelectedIndex != 0 && txtCidade1.Text != "" && txtBairro1.Text != "" && txtRua1.Text != "" && txtNumero1.Text != "" && txtComplemento1.Text != "")
        {
            FunMod      fmp = new FunMod();
            Funcionario fun = new Funcionario();
            fmp.Funcionario = fun;
            Modulo mod = new Modulo();
            fmp.Modulo = mod;
            Pessoa pes = new Pessoa();
            fmp.Funcionario.Pessoa = pes;
            Perfil pfl = new Perfil();
            fmp.Funcionario.Perfil = new Perfil();
            Setor set = new Setor();
            fmp.Funcionario.Setor = set;
            Cargo car = new Cargo();
            fmp.Funcionario.Cargo = car;
            //Contato con = new Contato();
            //con.Pessoa = pes;

            fmp.Funcionario.Pessoa.Pes_cod            = fmp1.Funcionario.Pessoa.Pes_cod;
            fmp.Funcionario.Pessoa.Pes_tipo           = "Fisica";
            fmp.Funcionario.Pessoa.Pes_ativo          = "Ativo";
            fmp.Funcionario.Pessoa.Cod_fun            = funCod.Funcionario.Pessoa.Pes_cod;
            fmp.Funcionario.Cod_fun                   = funCod.Funcionario.Pessoa.Pes_cod;
            fmp.Funcionario.Pessoa.Pes_nome           = txtNome1.Text;
            fmp.Funcionario.Pessoa.Pes_sobrenome      = txtSobrenome1.Text;
            fmp.Funcionario.Pessoa.Pes_dataNascimento = txtDataNas1.Text;
            fmp.Funcionario.Cargo.Car_cod             = Convert.ToInt32(ddlCargo.SelectedValue);
            fmp.Funcionario.Fun_cod                   = fmp1.Funcionario.Fun_cod;
            fmp.Funcionario.Fun_matricula             = txtMatricula1.Text;
            fmp.Funcionario.Pessoa.Pes_sexo           = rdbSexo.SelectedValue;
            if (rdbUsu.Visible != false)
            {
                fmp.Funcionario.Perfil.Pfl_cod = Convert.ToInt32(rdbUsu.SelectedValue);
            }
            else
            {
                fmp.Funcionario.Perfil.Pfl_cod = 1;
            }
            fmp.Funcionario.Pessoa.Pes_rg          = txtRG1.Text;
            fmp.Funcionario.Pessoa.Pes_cpf         = txtCPF1.Text;
            fmp.Funcionario.Setor.Set_cod          = Convert.ToInt32(ddlSetor.SelectedValue);
            fmp.Funcionario.Pessoa.Pes_estado      = ddlEstados.SelectedValue;
            fmp.Funcionario.Pessoa.Pes_cidade      = txtCidade1.Text;
            fmp.Funcionario.Pessoa.Pes_bairro      = txtBairro1.Text;
            fmp.Funcionario.Pessoa.Pes_rua         = txtRua1.Text;
            fmp.Funcionario.Pessoa.Pes_numero      = txtNumero1.Text;
            fmp.Funcionario.Pessoa.Pes_complemento = txtComplemento1.Text;
            fmp.Funcionario.Pessoa.Pes_cep         = txtCEP1.Text;

            if (rdbChefe.SelectedIndex == 0)
            {
                fmp.Funcionario.Fun_chefeDepartamento = false;
                fmp.Funcionario.Fun_chefeSetor        = false;
            }
            else if (rdbChefe.SelectedIndex == 1)
            {
                fmp.Funcionario.Fun_chefeDepartamento = false;
                fmp.Funcionario.Fun_chefeSetor        = true;
            }
            else if (rdbChefe.SelectedIndex == 2)
            {
                fmp.Funcionario.Fun_chefeDepartamento = true;
                fmp.Funcionario.Fun_chefeSetor        = false;
            }

            string listaPermissao = "";

            //foreach
            foreach (ListItem selecionadas in cblPadrao.Items)
            {
                if (selecionadas.Selected == true)
                {
                    listaPermissao += "('fun_per', " + selecionadas.Value + ", " + funCod.Funcionario.Pessoa.Pes_cod + "),";
                }
            }

            foreach (ListItem selecionadas in checkAdicionais.Items)
            {
                if (selecionadas.Selected == true)
                {
                    listaPermissao += "('fun_per', " + selecionadas.Value + ", " + funCod.Funcionario.Pessoa.Pes_cod + "),";
                }
            }

            listaPermissao = listaPermissao.Substring(0, listaPermissao.Length - 1);

            string retorno = "";

            retorno = FuncionarioDB.Update(fmp, listaPermissao);
            retorno = retorno.Substring(0, 4);

            if (retorno != "Erro")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>sucess();</script>", false);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>error();</script>", false);
            }
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>warning();</script>", false);
        }
    }