Example #1
0
    private void Retrieve()
    {
        t02_usuario t02 = new t02_usuario();
        {
            t02.t02_cd_usuario = cd_usuario;
            t02.Retrieve();
            if (t02.Found)
            {
                this.txtnm_nome.Text = t02.nm_nome;
                this.txtnm_email.Text = t02.nm_email;
                this.txtnm_cargo.Text = t02.nm_cargo;
                if (t02.nu_telefone.ToString().Length == 10)
                {
                    this.txtnu_dddt.Text = t02.nu_telefone.ToString().Substring(0, 2);
                    this.txtnu_telefone.Text = t02.nu_telefone.ToString().Substring(2, 8);
                }
                if (t02.nu_celular.ToString().Length == 10)
                {
                    this.txtnu_celular.Text = t02.nu_celular.ToString().Substring(2, 8);
                    this.txtnu_dddc.Text = t02.nu_celular.ToString().Substring(0, 2);
                }

            }
        }
    }
Example #2
0
 private void ddlUsuarioBind(DropDownList ddl)
 {
     t02_usuario t02 = new t02_usuario();
     {
         t02.fl_ativa = true;
         t02.order = " and t02.t05_cd_parceiro in (select t05_cd_parceiro from t05_parceiro where t01_cd_entidade = " + pb.cd_entidade() + ") and t02.t02_cd_usuario not in (select t02_cd_usuario from t32_usuariolinha where t01_cd_entidade =" + pb.cd_entidade() + ")";
         ddl.DataSource = t02.List();
         ddl.DataTextField = "nm_nome";
         ddl.DataValueField = "t02_cd_usuario";
         ddl.DataBind();
         pb.AddEmptyItem(ddl, "Selecione");
     }
 }
Example #3
0
    protected void FormBind()
    {
        t08_acao t08 = new t08_acao();
        {
            t08.t08_cd_acao = pb.cd_acao();
            t08.Retrieve();
            if (t08.Found)
            {
                lblds_acao.Text = t08.ds_acao;
                lblnm_acao.Text = t08.nm_acao;
                lbldt_inicio.Text = t08.dt_inicio.ToShortDateString();
                lbldt_fim.Text = t08.dt_fim.ToShortDateString();
                lblds_palvo.Text = t08.ds_palvo;
                lblds_latuacao.Text = t08.ds_latuacao;
                lblds_andamento.Text = t08.ds_andamento;

                t02_usuario t02 = new t02_usuario();
                {
                    t02.fl_ativa = true;
                    t02.order = " and t02.t02_cd_usuario = '" + t08.t02_cd_usuario + "'";
                    foreach (DataRow dr in t02.ListParceiro().Tables[0].Rows)
                    {
                        lblnm_nome.Text = dr["nm_nome"].ToString();
                        if ((int)dr["t05_cd_parceiro"] == 0)
                        {
                            lblnm_parceiro.Text = dr["nm_entidade"].ToString();
                        }
                        else
                        {
                            lblnm_parceiro.Text = dr["nm_parceiro"].ToString();
                        }
                    }
                }
            }
            t11_financeiro t11 = new t11_financeiro();
            {
                t11.order = "where t08_cd_acao="+ t08.t08_cd_acao;
                string financiadores = "";
                foreach (DataRow dr in t11.ListInvestimento().Tables[0].Rows)
                {
                    financiadores += dr["nm_parceiro"] + ", ";
                }
                if (financiadores.Length > 1)
                {
                    lblfinanciadores.Text = financiadores.Substring(0, financiadores.Length - 2) + ".";
                }
            }
        }
    }
Example #4
0
    protected void btnAcao_Click(object sender, System.EventArgs e)
    {
        t02_usuario t02 = new t02_usuario();
        bool result = false;
        bool erro = false;
        string msg = "";
        {
            t02.nm_nome = this.txtnm_nome.Text;
            t02.nm_email = this.txtnm_email.Text;
            t02.nm_cargo = txtnm_cargo.Text;
            if (txtnu_dddt.Text != "" && txtnu_telefone.Text != "") t02.nu_telefone = Int64.Parse(txtnu_dddt.Text + txtnu_telefone.Text);
            if (txtnu_dddc.Text != "" && txtnu_celular.Text != "") t02.nu_celular = Int64.Parse(txtnu_dddc.Text + txtnu_celular.Text);
            t02.dt_alterado = DateTime.Now;

            if ((txtnu_dddt.Text + txtnu_telefone.Text).Length != 10 && (txtnu_dddt.Text + txtnu_telefone.Text).Length > 0)
            {
                msg = pb.Message("Formato de telefone inválido! ", "erro");
                erro = true;
            }
            if ((txtnu_dddc.Text + txtnu_celular.Text).Length != 10 && (txtnu_dddc.Text + txtnu_celular.Text).Length > 0)
            {
                msg += pb.Message("Formato de celular inválido! ", "erro");
                erro = true;
            }
            if (!(erro))
            {
                if (cod.Value != "")
                {
                    t02.t02_cd_usuario = cd_usuario;
                    result = t02.UpdateDados();
                    msg = pb.Message("Alteração realizada com sucesso!", "ok");
                    pb.saveLog(cd_usuario, 0, "", "t02_usuario", "update", t02.t02_cd_usuario);
                }
                if (result)
                {
                    Retrieve();
                }
            }
            lblMsg.Text = msg;
            lblMsg.Visible = true;
        }
    }
Example #5
0
    protected void btnAlterar_Click(object sender, System.EventArgs e)
    {
        t02_usuario t02 = new t02_usuario();

        if (this._senhaAtual == true)
        {
            {
                t02.t02_cd_usuario = _usuario;
                t02.pw_senha = this.txtSenhaAtual.Text;
                t02.RetrieveLogin();

                if (t02.Found)
                {
                    t02.pw_senha = this.txtNovaSenha2.Text;
                    t02.UpdateSenha();
                    Response.Redirect(this._destino + "?altersenha=1");
                }
                else
                {
                    pageBase pb = new pageBase();
                    this.lblMsg.Text = pb.Message("Senha atual incorreta, tente novamente!", "erro");
                    this.lblMsg.Visible = true;
                }

            }
        }

        else
        {

            {
                t02.t02_cd_usuario = _usuario;
                t02.pw_senha = this.txtNovaSenha2.Text;
                t02.UpdateSenha();
                Response.Redirect(this._destino + "?altersenha=1");
            }

        }
    }
    private void GridBind()
    {
        t17_colaborador t17 = new t17_colaborador();
        {
            t17.t03_cd_projeto = pb.cd_projeto();
            GridView1.DataSource = t17.List();
            GridView1.DataBind();
        }

        t02_usuario t02 = new t02_usuario();
        {

            t02.order = "and t02_cd_usuario not in (select t02_cd_usuario from t17_colaborador where t03_cd_projeto="+ pb.cd_projeto() +") order by nm_nome";
            int cd_entidade = pb.cd_entidade();
            if (cd_entidade == 0)
            {
                t05_parceiro t05 = new t05_parceiro();
                {
                    t05.t05_cd_parceiro = pb.cd_parceiro();
                    t05.Retrieve();
                    if (t05.Found)
                    {
                        cd_entidade = t05.t01_cd_entidade;
                    }
                }
            }
            t02.t01_cd_entidade = cd_entidade;
            t02.fl_ativa = true;
            DropDownList ddl = ddlt02_cd_usuario;
            ddl.DataSource = t02.ListComboProjeto();
            ddl.DataTextField = "nm_nome";
            ddl.DataValueField = "t02_cd_usuario";
            ddl.DataBind();
            pb.AddEmptyItem(ddl, "Selecione");

            //Response.Write(t02.order);
        }
    }
Example #7
0
 protected void FormBind()
 {
     t02_usuario t02 = new t02_usuario();
     {
         t02.order = "order by nm_nome";
         t02.t01_cd_entidade = pb.cd_entidade_projeto();
         t02.fl_ativa = true;
         ddlt02_cd_usuario.DataSource = t02.ListComboProjeto();
         ddlt02_cd_usuario.DataTextField = "nm_nome";
         ddlt02_cd_usuario.DataValueField = "t02_cd_usuario";
         ddlt02_cd_usuario.DataBind();
         pb.AddEmptyItem(ddlt02_cd_usuario, "Selecione");
     }
 }
Example #8
0
    public void criarEmail(int cod, string msg)
    {
        string bcc = "*****@*****.**";
        string projeto = "";

               MailMessage mail = new MailMessage();
               {
                   t03_projeto t03 = new t03_projeto();
                   {
                       t03.order = "where t03_cd_projeto =" + cod;
                       foreach (DataRow dr2 in t03.List().Tables[0].Rows)
                       {
                           projeto = dr2["nm_projeto"].ToString();
                       }
                   }

                   t02_usuario t02 = new t02_usuario();
                   {
                       t02.t01_cd_entidade = cd_entidade();
                       foreach (DataRow dr in t02.ListLinha().Tables[0].Rows)
                       {
                           string email = dr["nm_email"].ToString();
                           mail.From = new MailAddress("Agenda Bahia - Nova Restrição <*****@*****.**>");
                           mail.To.Add(new MailAddress(email));
                           //mail.Bcc.Add(new MailAddress(bcc));
                           mail.SubjectEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
                           mail.BodyEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
                           mail.Subject = "Agenda Bahia";

                           System.Text.StringBuilder sb = new System.Text.StringBuilder();
                           {
                               sb.Append("<body style=margin:0px;>");
                               sb.Append("<div style=text-align:left><img hspace=0 src=\"http://www.sigeorparceiros.com.br/images/interna_04_06_2008.jpg\" align=baseline border=0></div><br />");
                               sb.Append("<font face=Verdana, Arial, Helvetica, sans-serif size=2>");
                               sb.Append("<div style=padding:10px; >Prezado(a) <b>" + dr["nm_nome"].ToString() + "</b>,<br /><br /></div>");
                               sb.Append("<div style=padding:10px; >Há uma nova restrição para o projeto: <b>" + projeto + ".</b><br /><br /></div>");
                               sb.Append("<div style=padding:10px; ><b>Restrição:</b><br>" + ReplaceNewLines(msg) + "</div>");
                               sb.Append("<div style=padding:10px; ><p style=color:#999999>Sigeor Parceiros - Restrição</p>");
                               sb.Append("<p><a href='http://www.sigeorparceiros.com.br'>www.sigeorparceiros.com.br</a></p></div>");
                               sb.Append("</body>");

                           }
                           AlternateView htmlView = AlternateView.CreateAlternateViewFromString(sb.ToString(), System.Text.Encoding.GetEncoding("ISO-8859-1"), "text/html");
                           mail.AlternateViews.Add(htmlView);
                           enviarEmail(mail);
                       }

                       //Response.Write(cod, msg);
                   }
               }
    }
Example #9
0
    private void Retrieve()
    {
        t02_usuario t02 = new t02_usuario();
        {
            t02.t02_cd_usuario = GridView1.SelectedValue.ToString();
            t02.Retrieve();
            if (t02.Found)
            {
                this.txtnm_nome.Text = t02.nm_nome;
                this.txtnm_email.Text = t02.nm_email;
                this.txtnm_cargo.Text = t02.nm_cargo;
                txtnm_cpf.Text = t02.nm_cpf;
                if (t02.nu_telefone.ToString().Length == 10)
                {
                    this.txtnu_dddt.Text = t02.nu_telefone.ToString().Substring(0, 2);
                    this.txtnu_telefone.Text = t02.nu_telefone.ToString().Substring(2, 8);
                }
                if (t02.nu_celular.ToString().Length == 10)
                {
                    this.txtnu_celular.Text = t02.nu_celular.ToString().Substring(2, 8);
                    this.txtnu_dddc.Text = t02.nu_celular.ToString().Substring(0, 2);
                }

                //Response.Write(String.Format("t02.t05_cd_parceiro = {0}, t02.t01_cd_entidade={1}<br>", t02.t05_cd_parceiro, t02.t01_cd_entidade));

                if (t02.t05_cd_parceiro > 0)
                {
                    cblt25_cd_perfil.Items.FindByValue("1").Enabled = false;
                    cblt25_cd_perfil.Items.FindByValue("2").Enabled = false;

                   DropDownList ddl = ddlt05_cd_parceiro;
                    t05_parceiro t05 = new t05_parceiro();
                    {
                        t05.t05_cd_parceiro = t02.t05_cd_parceiro;
                        t05.Retrieve();
                        if (t05.Found)
                        {
                            t05.order = "order by nm_parceiro";
                            //t05.t01_cd_entidade = pb.cd_entidade();
                            ddl.DataSource = t05.List();
                            ddl.DataTextField = "nm_parceiro";
                            ddl.DataValueField = "t05_cd_parceiro";
                            ddl.DataBind();
                            pb.AddEmptyItem(ddl, "Selecione");
                        }
                    }

                    trEntidade.Visible = false; trParceiro.Visible = true;
                    this.ddlt05_cd_parceiro.ClearSelection();
                    ListItem li2 = this.ddlt05_cd_parceiro.Items.FindByValue(t02.t05_cd_parceiro.ToString());
                    if (li2 != null)
                        li2.Selected = true;
                }
                else
                {
                    cblt25_cd_perfil.Items.FindByValue("1").Enabled = true;
                    cblt25_cd_perfil.Items.FindByValue("2").Enabled = true;

                    trEntidade.Visible = true; trParceiro.Visible = false;
                    this.ddlt01_cd_entidade.ClearSelection();
                    ListItem li = this.ddlt01_cd_entidade.Items.FindByValue(t02.t01_cd_entidade.ToString());
                    if (li != null)
                        li.Selected = true;
                }
                //Response.Write(String.Format("trEntidade.Visible = {0}; trParceiro.Visible = {1};", trEntidade.Visible, trParceiro.Visible));
            }

            t26_usuarioperfil t26 = new t26_usuarioperfil();
            {
                t26.t02_cd_usuario = t02.t02_cd_usuario;
                foreach (DataRow dr in t26.List().Tables[0].Rows)
                {
                    ListItem li = cblt25_cd_perfil.Items.FindByValue(dr["t25_cd_perfil"].ToString());
                    if (li != null) li.Selected = true;
                }
            }
        }
    }
Example #10
0
    private void GridBind(string order)
    {
        string query = "";
        if (!pb.fl_admin())
        {
            query = " and t02.t05_cd_parceiro <> 0 ";
           // query = " and t02.t05_cd_parceiro in (select t05_cd_parceiro from t05_parceiro where t01_cd_entidade = " + pb.cd_entidade() +")";
            //GridView1.Columns[7].Visible = false;
        }
        t02_usuario t02 = new t02_usuario();
        {
            t02.fl_ativa = true;
            lbltotal.Text = "(total: "+ t02.List().Tables[0].Rows.Count +" usuários)";
            t02.order = query + ViewState["pesquisa"] + order;
            if (ViewState["pesquisa"] != null)
            {
                if (ViewState["pesquisa"].ToString() != "")
                { lblfindtotal.Text = t02.List().Tables[0].Rows.Count + " encontrados "; }
                else { lblfindtotal.Text = ""; }
            }

            GridView1.DataSource = t02.List();
            GridView1.DataBind();
        }
    }
Example #11
0
    protected void btnAcao_Click(object sender, System.EventArgs e)
    {
        t02_usuario t02 = new t02_usuario();
        bool result=false;
        bool erro=false;
        string msg="";
        {
            t02.nm_nome = this.txtnm_nome.Text;
            t02.nm_email = this.txtnm_email.Text;
            t02.nm_cargo = txtnm_cargo.Text;
            t02.nm_cpf = txtnm_cpf.Text;
            t02.pw_senha = this.txtpw_senha.Text;
            if (txtnu_dddt.Text != "" && txtnu_telefone.Text != "") t02.nu_telefone = Int64.Parse(txtnu_dddt.Text + txtnu_telefone.Text);
            if (txtnu_dddc.Text != "" && txtnu_celular.Text != "") t02.nu_celular = Int64.Parse(txtnu_dddc.Text + txtnu_celular.Text);

            //if (trParceiro.Visible)
            //{
                if (ddlt05_cd_parceiro.SelectedValue != "")
                    t02.t05_cd_parceiro = Int32.Parse(ddlt05_cd_parceiro.SelectedValue);
            //}
            //else if (trEntidade.Visible)
            //{
                if (ddlt01_cd_entidade.SelectedValue != "")
                    t02.t01_cd_entidade = Int32.Parse(ddlt01_cd_entidade.SelectedValue);
            //}

            t02.fl_ativa = true;
            t02.dt_cadastro = DateTime.Now;
            t02.dt_alterado = DateTime.Now;

            if ((txtnu_dddt.Text + txtnu_telefone.Text).Length != 10 && (txtnu_dddt.Text + txtnu_telefone.Text).Length > 0)
            {
                msg = pb.Message("Formato de telefone inválido! ", "erro");
                erro = true;
            }
            if ((txtnu_dddc.Text + txtnu_celular.Text).Length != 10 && (txtnu_dddc.Text + txtnu_celular.Text).Length > 0)
            {
                msg += pb.Message("Formato de celular inválido! ", "erro");
                erro = true;
            }
            if (!(erro))
            {
                if (cod.Value != "0")
                {
                    t02.t02_cd_usuario = GridView1.SelectedValue.ToString();
                    result = t02.Update();
                    msg = pb.Message("Alteração realizada com sucesso!", "ok");
                    pb.saveLog(pb.cd_usuario(), 0, "", "t02_usuario", "update", t02.t02_cd_usuario);
                    cod.Value = "0";
                }
                else
                {
                    if (this.txtt02_cd_usuario.Text != "")
                    {
                        t02.t02_cd_usuario = pb.ReplaceAspas(txtt02_cd_usuario.Text.Replace(" ", ""));
                        t02.Retrieve();
                        if (!t02.Found)
                        {
                            result = t02.Save();
                            msg = pb.Message("Cadastro realizado com sucesso!", "ok");
                            pb.saveLog(pb.cd_usuario(), 0, "", "t02_usuario", "insert", t02.t02_cd_usuario);
                        }
                        else
                        {
                            msg = pb.Message("\"" + txtt02_cd_usuario.Text + "\" não está disponível. Por favor, tente outro login de usuário.", "erro");
                            txtt02_cd_usuario.BackColor = System.Drawing.Color.Yellow;
                            PanelCad.Visible = true;
                        }
                    }
                    else
                    {
                        msg = pb.Message("Campo usuário é obrigatório.", "erro");
                        txtt02_cd_usuario.BackColor = System.Drawing.Color.Yellow;
                        PanelCad.Visible = true;
                    }

                }

                if (result)
                {
                    if (pb.fl_admin())
                    {
                        t26_usuarioperfil t26 = new t26_usuarioperfil();
                        {
                            t26.t02_cd_usuario = t02.t02_cd_usuario;
                            t26.Delete();
                            foreach (ListItem li in cblt25_cd_perfil.Items)
                            {
                                if (li.Selected)
                                {
                                    t26.t25_cd_perfil = Int32.Parse(li.Value);
                                    t26.dt_cadastro = DateTime.Now;
                                    t26.dt_alterado = DateTime.Now;
                                    t26.Save();
                                }
                            }
                        }
                    }
                    Ocultar();
                    GridBind("order by nm_nome");
                    ddlt01_cd_entidade.ClearSelection();
                    ddlt05_cd_parceiro.ClearSelection();
                }
            }
            lblMsg.Text = msg;
            lblMsg.Visible = true;
        }
    }
Example #12
0
 protected void Delete_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     ImageButton btn = (ImageButton)sender;
     //bool excluir = true;
     t02_usuario t02 = new t02_usuario();
     {
             t02.t02_cd_usuario = btn.CommandArgument.ToString();
             t02.Delete();
             pb.saveLog(pb.cd_usuario(), 0, "", "t02_usuario", "delete", t02.t02_cd_usuario);
     }
     GridBind("order by nm_nome");
     lblMsg.Text = pb.Message("Exclusão realizada com sucesso!", "ok");
     lblMsg.Visible = true;
 }
Example #13
0
    protected void FormBind()
    {
        DropDownList ddl = ddlt04_cd_tipologia;
        t04_tipologia t04 = new t04_tipologia();
        {
            t04.fl_ativa = true;
            ddl.DataSource = t04.List();
            ddl.DataTextField = "nm_tipologia";
            ddl.DataValueField = "t04_cd_tipologia";
            ddl.DataBind();
            pb.AddEmptyItem(ddl, "Selecione");
        }

        t02_usuario t02 = new t02_usuario();
        {
            t02.order = "order by nm_nome";
            t02.t01_cd_entidade = cd_entidade;
            t02.fl_ativa = true;

            ddl = ddlt02_cd_usuario;
            ddl.DataSource = t02.ListComboProjeto();
            ddl.DataTextField = "nm_nome";
            ddl.DataValueField = "t02_cd_usuario";
            ddl.DataBind();
            pb.AddEmptyItem(ddl, "Selecione");

            ddl = ddlt02_cd_usuario_monitoramento;
            ddl.DataSource = t02.ListComboProjeto();
            ddl.DataTextField = "nm_nome";
            ddl.DataValueField = "t02_cd_usuario";
            ddl.DataBind();
            pb.AddEmptyItem(ddl, "Selecione");
        }
    }
Example #14
0
 private void GridBind()
 {
     t02_usuario t02 = new t02_usuario();
     {
         t02.t01_cd_entidade = pb.cd_entidade();
         GridView1.DataSource = t02.ListLinha();
         GridView1.DataBind();
     }
 }