Esempio n. 1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        bool result;
        string msg;
        t01_entidade t01 = new t01_entidade();
        {
            try
            {
                t01.nm_entidade = txtnm_entidade.Text;
                t01.nm_uf = ddlnm_uf.SelectedValue;
                t01.nm_arquivo = "";
                t01.nm_cnpj = "";
                t01.fl_ativa = true;
                t01.dt_cadastro = DateTime.Now;
                t01.dt_alterado = DateTime.Now;
                result = t01.Save();
                msg = pb.Message("Inclusão realizada com sucesso", "ok");
                pb.saveLog(cd_usuario, 0, "", "t01_entidade", "insert", t01.nm_entidade);
                txtnm_entidade.Text = "";

                if (result)
                {
                    t01.RetrieveCod();
                    if (t01.Found)
                    {
                        t05_parceiro t05 = new t05_parceiro();
                        {
                            t05.nm_parceiro = t01.nm_entidade;
                            t05.t01_cd_entidade = t01.t01_cd_entidade;
                            t05.fl_entidade = true;
                            t05.nm_arquivo = "";
                            t05.nm_cnpj = "";
                            t05.dt_cadastro = DateTime.Now;
                            t05.dt_alterado = DateTime.Now;
                            t05.Save();
                            pb.saveLog(cd_usuario, 0, "", "t05_parceiro", "insert", t05.nm_parceiro);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                msg = pb.Message(pb.msgerro + " <small>Descrição: "+ ex.Message + "</small>", "erro");
            }

            lblMsg.Text = msg;
            lblMsg.Visible = true;
            GridBind("order by nm_entidade");
        }
    }
Esempio n. 2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        bool result=false;
        string msg;
        t05_parceiro t05 = new t05_parceiro();
        {
            try
            {
                t05.nm_parceiro = txtnm_parceiro.Text;
                t05.t01_cd_entidade = cd_entidade;
                t05.nm_arquivo = "";
                t05.nm_cnpj = txtnm_cnpj.Text;
                t05.dt_cadastro = DateTime.Now;
                t05.dt_alterado = DateTime.Now;
                result = t05.Save();
                msg = pb.Message("Inclusão realizada com sucesso", "ok");
            }
            catch
            {
                msg = pb.Message(pb.msgerro, "erro");
            }

            if (result)
            {
                pb.saveLog(cd_usuario, 0, "", "t05_parceiro", "insert", t05.nm_parceiro);
                txtnm_parceiro.Text = "";
                txtnm_cnpj.Text = "";
                GridBind("order by nm_parceiro");
            }
            else
            {
                msg = pb.Message(pb.msgerro, "erro");
            }

            lblMsg.Text = msg;
            lblMsg.Visible = true;
        }
    }
Esempio n. 3
0
    protected void Delete_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        ImageButton btn = (ImageButton)sender;
        bool result;
        string msg;
        t05_parceiro t05 = new t05_parceiro();
        {
            try
            {
                t05.t05_cd_parceiro = Int32.Parse(btn.CommandArgument);
                result = t05.Delete();
                pb.saveLog(cd_usuario, 0, "", "t05_parceiro", "delete", t05.t05_cd_parceiro.ToString());
                msg = pb.Message("Exclusão realizada com sucesso", "ok");
            }
            catch
            {
                msg = pb.Message(pb.msgerro, "erro");
            }

            lblMsg.Text = msg;
            lblMsg.Visible = true;
            GridBind("order by nm_parceiro");
        }
    }
 protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
 {
     GridView gv = (GridView)sender;
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
          DataRowView drv = ((DataRowView)e.Row.DataItem);
          t01_entidade t01 = new t01_entidade();
          {
              t01.t01_cd_entidade = (int)drv["t01_cd_entidade"];
              t01.Retrieve();
              if (!t01.Found)
              {
                  t05_parceiro t05 = new t05_parceiro();
                  {
                      t05.t05_cd_parceiro = (int)drv["t05_cd_parceiro"];
                      t05.Retrieve();
                      if (t05.Found)
                      {
                          t01.t01_cd_entidade = t05.t01_cd_entidade;
                          t01.Retrieve();
                          if (t01.Found)
                          {
                              e.Row.Cells[2].Controls.Add(pb.GetLiteral(t01.nm_entidade + "\\" + t05.nm_parceiro));
                          }
                      }
                  }
              }
          }
      }
 }
    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);
        }
    }
Esempio n. 6
0
 public bool fl_semperfil(int cd_entidade_atual)
 {
     bool result = true;
     if (fl_visitante())
     {
         result = true;
     }
     else
     {
         if (fl_estrategico() || fl_adminparceiro() || fl_admin())
         {
             result = false;
         }
         else
         {
             if (cd_entidade() == 0)
             {
                 t05_parceiro t05 = new t05_parceiro();
                 {
                     t05.t05_cd_parceiro = cd_parceiro();
                     t05.Retrieve();
                     if (t05.Found)
                     {
                         if (t05.t01_cd_entidade == cd_entidade_atual)
                         {
                             result = false;
                         }
                         else
                         {
                             result = true;
                         }
                     }
                 }
             }
             else
             {
                 if (cd_entidade() == cd_entidade_atual)
                 {
                     result = false;
                 }
                 else
                 {
                     result = true;
                 }
             }
         }
     }
     _fl_semperfil= result;
     return _fl_semperfil;
 }
Esempio n. 7
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;
                }
            }
        }
    }
Esempio n. 8
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        GridView gv = (GridView)sender;
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView drv = ((DataRowView)e.Row.DataItem);
            t26_usuarioperfil t26 = new t26_usuarioperfil();
            {
                t26.t02_cd_usuario = drv["t02_cd_usuario"].ToString();
                foreach (DataRow dr in t26.List().Tables[0].Rows)
                {
                    e.Row.Cells[9].Controls.Add(pb.GetLiteral("- " + dr["nm_perfil"].ToString() + "<br />"));
                }
            }
            t01_entidade t01 = new t01_entidade();
            {
                t01.t01_cd_entidade = (int)drv["t01_cd_entidade"];
                t01.Retrieve();
                if (!t01.Found)
                {
                    t05_parceiro t05 = new t05_parceiro();
                    {
                        t05.t05_cd_parceiro = (int)drv["t05_cd_parceiro"];
                        t05.Retrieve();
                        if (t05.Found)
                        {
                            t01.t01_cd_entidade = t05.t01_cd_entidade;
                            t01.Retrieve();
                            if (t01.Found)
                            {
                                if (pb.fl_admin())
                                {
                                    e.Row.Cells[8].Controls.Add(pb.GetLiteral(t01.nm_entidade + "\\" + t05.nm_parceiro));
                                }
                                else
                                {
                                    e.Row.Cells[8].Controls.Add(pb.GetLiteral(t05.nm_parceiro));
                                }
                            }
                        }
                    }
                }
            }

            if ((Int64)drv["nu_telefone"] == 0)
                e.Row.Cells[5].Text = "-";

            if ((Int64)drv["nu_celular"] == 0)
                e.Row.Cells[6].Text = "-";
        }
    }
Esempio n. 9
0
 protected void FormBind()
 {
     DropDownList ddl = this.ddlt01_cd_entidade;
     t01_entidade t01 = new t01_entidade();
     {
         t01.order = "order by nm_entidade";
         t01.fl_ativa = true;
         ddl.DataSource = t01.List();
         ddl.DataTextField = "nm_entidade";
         ddl.DataValueField = "t01_cd_entidade";
         ddl.DataBind();
         pb.AddEmptyItem(ddl, "Selecione");
     }
     ddl = ddlt05_cd_parceiro;
     t05_parceiro t05 = new t05_parceiro();
     {
         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");
     }
     CheckBoxList cbl = cblt25_cd_perfil;
     t25_perfil t25 = new t25_perfil();
     {
         cbl.DataSource = t25.List();
         cbl.DataTextField = "nm_perfil";
         cbl.DataValueField = "t25_cd_perfil";
         cbl.DataBind();
     }
 }
    protected void btnFiltro_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder query = new System.Text.StringBuilder();
        string cd_entidade = "0";
        if (pb.fl_admin())
        {
            trParceiro.Visible = true;
            if (ddlt01_cd_entidade.SelectedValue != "")
            {
                cd_entidade = ddlt01_cd_entidade.SelectedValue;
            }
        }
        else
        {
            cd_entidade = pb.cd_entidade().ToString();
            trParceiro.Visible = false;
        }
        if (cd_entidade != "0")
        {
            query.Append("and (t01_cd_entidade=" + cd_entidade + ") ");
        }
        else
        {   //usuário parceiro
            query.Append("and (t01_cd_entidade in (select t01_cd_entidade from t05_parceiro where t05_cd_parceiro=" + pb.cd_parceiro() + ")) ");
        }

        if (ddlt03_cd_projeto.SelectedValue != "")
        {
            query.Append("and (t03_cd_projeto=" + ddlt03_cd_projeto.SelectedValue + ") ");
        }
        else
        {
            if (!(pb.fl_estrategico() || pb.fl_adminparceiro() || pb.fl_admin()))
             query.Append(" and (t03_cd_projeto in (select t03_cd_projeto from t03_projeto where t02_cd_usuario='" + pb.cd_usuario() + "')) ");
        }

        if (ddlt04_cd_tipologia.SelectedValue != "")
        {
            query.Append("and (t04_cd_tipologia=" + ddlt04_cd_tipologia.SelectedValue + ") ");
        }
        if (ddlt05_cd_parceiro.SelectedValue != "")
        {
            query.Append("and (t05_cd_parceiro=" + ddlt05_cd_parceiro.SelectedValue + ") ");
          // query.Append("and (t03_cd_projeto in (select t03_cd_projeto from t20_faseprojeto where t05_cd_parceiro=" + ddlt05_cd_parceiro.SelectedValue + "')) ");
        }
        if (ddlt19_cd_fase.SelectedValue != "")
        {
            query.Append("and (t03_cd_projeto in (select t03_cd_projeto from t20_faseprojeto where t19_cd_fase=" + ddlt19_cd_fase.SelectedValue + " and fl_ativa=1)) ");
        }
        //Response.Write(query.ToString());
        t03_projeto t03 = new t03_projeto();
        {
            t03.order = "select * from t03_projeto where (fl_ativa=1) " + query.ToString();
            int i = t03.ListQuery().Tables[0].Rows.Count;

            if (i > 0)
            {
                Session["sqlfiltro"] = query.ToString();

                //Detalhes do Filtro
                t03.order = "select max(dt_fim) as datafim, min(dt_inicio) as dataini from t03_projeto where (fl_ativa=1) and (dt_alterado is not null) " + query.ToString();
                foreach (DataRow drp in t03.ListQuery().Tables[0].Rows)
                {
                    if (drp["dataini"] != DBNull.Value)
                    {
                        DateTime dti = (DateTime)drp["dataini"];
                        DateTime dtf = (DateTime)drp["datafim"];
                        Session["mondti"] = dti.ToShortDateString();
                        Session["mondtf"] = dtf.ToShortDateString();
                    }
                }
                t01_entidade t01 = new t01_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.ToString();
                            }
                        }
                    }
                    t01.t01_cd_entidade = Int32.Parse(cd_entidade);
                    t01.Retrieve();
                    if (t01.Found)
                    {
                        Session["monparceiro"] = t01.nm_entidade;
                    }
                }
                Session["monquantproj"] = i.ToString();
                Session["monprojeto"] = ddlt03_cd_projeto.SelectedItem.Text;
                Session["montipologia"] = ddlt04_cd_tipologia.SelectedItem.Text;
                Session["monresponsavel"] = ddlt05_cd_parceiro.SelectedItem.Text;
                Session["monfase"] = ddlt19_cd_fase.SelectedItem.Text;
                Response.Redirect("MonPainel2.aspx");
            }
            else
            {
                lblMsg.Visible = true;
                lblMsg.Text = pb.Message("A seleção efetuada não possui informações. Tente novamente.", "erro");
            }
        }
    }
 protected void ddlBind()
 {
     if (pb.fl_admin())
     {
         t01_entidade t01 = new t01_entidade();
         {
             t01.fl_ativa = true;
             t01.order = " and t01_cd_entidade in (select t01_cd_entidade from t03_projeto where fl_ativa=1) order by nm_entidade";
             ddlt01_cd_entidade.DataSource = t01.List();
             ddlt01_cd_entidade.DataTextField = "nm_entidade";
             ddlt01_cd_entidade.DataValueField = "t01_cd_entidade";
             ddlt01_cd_entidade.DataBind();
             pb.AddEmptyItem(ddlt01_cd_entidade, "Selecione");
         }
         ddlt03_cd_projeto.Enabled = false;
         trParceiro.Visible = true;
     }
     else
     {
         trParceiro.Visible = false;
     }
     t03_projeto t03 = new t03_projeto();
     {
         if (pb.cd_entidade() != 0)
         {
             //se usuário normal
             if (pb.fl_estrategico() || pb.fl_adminparceiro())
             {
                 t03.order = "where t01_cd_entidade=" + pb.cd_entidade() + " and fl_ativa=1 order by nm_projeto";
             }
             else
             {
                 t03.order = "where t02_cd_usuario='" + pb.cd_usuario() + "' ";
             }
         }
         else
         {
             //se usuário parceiro
             t03.order = "where t02_cd_usuario='" + pb.cd_usuario() + "' ";
         }
         ddlt03_cd_projeto.Items.Clear();
         ddlt03_cd_projeto.DataSource = t03.List();
         ddlt03_cd_projeto.DataTextField = "nm_projeto";
         ddlt03_cd_projeto.DataValueField = "t03_cd_projeto";
         ddlt03_cd_projeto.DataBind();
         pb.AddEmptyItem(ddlt03_cd_projeto, "Todos");
     }
     t04_tipologia t04 = new t04_tipologia();
     {
         t04.fl_ativa = true;
         t04.order = "order by nm_tipologia";
         ddlt04_cd_tipologia.DataSource = t04.List();
         ddlt04_cd_tipologia.DataTextField = "nm_tipologia";
         ddlt04_cd_tipologia.DataValueField = "t04_cd_tipologia";
         ddlt04_cd_tipologia.DataBind();
         pb.AddEmptyItem(ddlt04_cd_tipologia, "Todas");
     }
     t05_parceiro t05 = new t05_parceiro();
     {
       //  t05.fl_entidade = true;
         t05.order = "order by nm_parceiro";
         ddlt05_cd_parceiro.DataSource = t05.List();
         ddlt05_cd_parceiro.DataTextField = "nm_parceiro";
         ddlt05_cd_parceiro.DataValueField = "t05_cd_parceiro";
         ddlt05_cd_parceiro.DataBind();
         pb.AddEmptyItem(ddlt05_cd_parceiro, "Todos");
     }
     t19_fase t19 = new t19_fase();
     {
         t19.order = "order by nm_fase";
         ddlt19_cd_fase.DataSource = t19.List();
         ddlt19_cd_fase.DataTextField = "nm_fase";
         ddlt19_cd_fase.DataValueField = "t19_cd_fase";
         ddlt19_cd_fase.DataBind();
         pb.AddEmptyItem(ddlt19_cd_fase, "Todas");
     }
 }
Esempio n. 12
0
    protected void FormBind(string str_t05)
    {
        t08_acao t08 = new t08_acao();
        {
            t08.t08_cd_acao = pb.cd_acao();
            t08.Retrieve();
            if (t08.Found)
            {
                for (int i = t08.dt_inicio.Year; i <= t08.dt_fim.Year; i++)
                {
                    TextBox txtvl_p1 = (TextBox)ucPrevisto.FindControl("txtvl_p1" + i.ToString());
                    TextBox txtvl_p4 = (TextBox)ucPrevisto.FindControl("txtvl_p2" + i.ToString());
                    TextBox txtvl_p8 = (TextBox)ucPrevisto.FindControl("txtvl_p3" + i.ToString());
                    TextBox txtvl_p12 = (TextBox)ucPrevisto.FindControl("txtvl_p4" + i.ToString());

                    TextBox txtvl_r1 = (TextBox)ucRealizado.FindControl("txtvl_r1" + i.ToString());
                    TextBox txtvl_r4 = (TextBox)ucRealizado.FindControl("txtvl_r2" + i.ToString());
                    TextBox txtvl_r8 = (TextBox)ucRealizado.FindControl("txtvl_r3" + i.ToString());
                    TextBox txtvl_r12 = (TextBox)ucRealizado.FindControl("txtvl_r4" + i.ToString());

                    if (txtvl_p1 != null)
                    {
                        txtvl_p1.Text = "";
                        txtvl_p4.Text = "";
                        txtvl_p8.Text = "";
                        txtvl_p12.Text = "";
                    }
                    if (txtvl_r1 != null)
                    {
                        txtvl_r1.Text = "";
                        txtvl_r4.Text = "";
                        txtvl_r8.Text = "";
                        txtvl_r12.Text = "";
                    }
                }
            }
        }

        t05_parceiro t05 = new t05_parceiro();
        {
            t03_projeto t03 = new t03_projeto();
            {
                t03.t03_cd_projeto = pb.cd_projeto();
                t03.Retrieve();
                if (t03.Found)
                {
                    t05.t01_cd_entidade = t03.t01_cd_entidade;
                    t05.order = "order by nm_parceiro";
                    ddlt05_cd_parceiro.DataSource = t05.List();
                    ddlt05_cd_parceiro.DataTextField = "nm_parceiro";
                    ddlt05_cd_parceiro.DataValueField = "t05_cd_parceiro";
                    ddlt05_cd_parceiro.DataBind();
                    pb.AddEmptyItem(ddlt05_cd_parceiro, "Selecione");
                }
            }
        }
    }
Esempio n. 13
0
    private void GridBind()
    {
        t06_parceiroprojeto t06 = new t06_parceiroprojeto();
        {
            t06.t03_cd_projeto = pb.cd_projeto();
            DataList1.DataSource = t06.List();
            DataList1.DataBind();
        }

        t05_parceiro t05 = new t05_parceiro();
        {
            int cd_entidade = pb.cd_entidade();
            if (cd_entidade == 0)
            {
                    t05.t05_cd_parceiro = pb.cd_parceiro();
                    t05.Retrieve();
                    if (t05.Found)
                    {
                        cd_entidade = t05.t01_cd_entidade;
                    }
            }
            t05.t01_cd_entidade = cd_entidade;
            t05.order = "and t05_cd_parceiro not in (select t05_cd_parceiro from t06_parceiroprojeto where t03_cd_projeto="+ pb.cd_projeto().ToString() +")";
            DropDownList ddl = ddlt05_cd_parceiro;
            ddl.DataSource = t05.List();
            ddl.DataTextField = "nm_parceiro";
            ddl.DataValueField = "t05_cd_parceiro";
            ddl.DataBind();
            pb.AddEmptyItem(ddl, "Selecione");
        }
    }
Esempio n. 14
0
    private void GridBind(String order)
    {
        t05_parceiro t05 = new t05_parceiro();
        {
            t05.t01_cd_entidade = cd_entidade;
            t05.order = order;
            GridView1.DataSource = t05.List();
            GridView1.DataBind();

        }
    }
Esempio n. 15
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row = GridView1.Rows[e.RowIndex];
        int cod = Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
        TextBox txt1 = (TextBox)row.FindControl("txtnm_parceiro");
        TextBox txt2 = (TextBox)row.FindControl("txtnm_cnpj");
        RadioButtonList rbl = (RadioButtonList)row.FindControl("rblFoto");
        FileUpload fu = (FileUpload)row.FindControl("FileUpload1");

        bool result;
        string msg;
        t05_parceiro t05 = new t05_parceiro();
        {
            try
            {
                t05.t05_cd_parceiro = cod;
                t05.nm_parceiro = txt1.Text;
                t05.nm_cnpj = txt2.Text;
                t05.dt_alterado = DateTime.Now;
                if (rbl.SelectedValue == "1")
                {
                    uploadArquivo up = new uploadArquivo();
                    {
                        up.pasta = "Documentos";
                        up.nomeinicial = "logo_";
                        up.fu = fu;
                        up.Save();
                        t05.order = ", nm_arquivo='"+ up.nomearquivo +"'";
                    }

                }
                pb.saveLog(cd_usuario, 0, "", "t05_parceiro", "update", t05.t05_cd_parceiro.ToString());
                result = t05.Update();
                msg = pb.Message("Alteração realizada com sucesso", "ok");
            }
            catch
            {
                msg = pb.Message(pb.msgerro, "erro");
            }

            lblMsg.Text = msg;
            lblMsg.Visible = true;

            GridView1.EditIndex = -1;
            GridBind("order by nm_parceiro");
        }
    }
Esempio n. 16
0
    private void Retrieve(int cod)
    {
        t11_financeiro t11 = new t11_financeiro();
        {
            t11.t11_cd_financeiro = cod;
            t11.Retrieve();
            if (t11.Found)
            {
                if (t11.fl_economico)
                {
                    lbltipo.Text = "Econômico";
                }
                else
                {
                    lbltipo.Text = "Financeiro";
                }
                t05_parceiro t05 = new t05_parceiro();
                {
                    t05.t05_cd_parceiro = t11.t05_cd_parceiro;
                    t05.Retrieve();
                    if (t05.Found)
                    { lblnm_parceiro.Text = t05.nm_parceiro; }
                }
                t08_acao t08 = new t08_acao();
                {
                    t08.t08_cd_acao = pb.cd_acao();
                    t08.Retrieve();
                    if (t08.Found)
                    {
                        lblnm_acao.Text = t08.nm_acao;
                        t28_vlfinanceiro t28 = new t28_vlfinanceiro();
                        {
                            for (int i = t08.dt_inicio.Year; i <= t08.dt_fim.Year; i++)
                            {
                                t28.t11_cd_financeiro = t11.t11_cd_financeiro;
                                t28.nu_ano = i;
                                t28.Retrieve();

                                TextBox txtvl_p1 = (TextBox)ucPrevisto.FindControl("txtvl_p1" + i.ToString());
                                TextBox txtvl_p4 = (TextBox)ucPrevisto.FindControl("txtvl_p2" + i.ToString());
                                TextBox txtvl_p8 = (TextBox)ucPrevisto.FindControl("txtvl_p3" + i.ToString());
                                TextBox txtvl_p12 = (TextBox)ucPrevisto.FindControl("txtvl_p4" + i.ToString());
                                TextBox txtvl_ptotal = (TextBox)ucPrevisto.FindControl("txtvl_ptotal5" + i.ToString());

                                TextBox txtvl_r1 = (TextBox)ucRealizado.FindControl("txtvl_r1" + i.ToString());
                                TextBox txtvl_r4 = (TextBox)ucRealizado.FindControl("txtvl_r2" + i.ToString());
                                TextBox txtvl_r8 = (TextBox)ucRealizado.FindControl("txtvl_r3" + i.ToString());
                                TextBox txtvl_r12 = (TextBox)ucRealizado.FindControl("txtvl_r4" + i.ToString());
                                TextBox txtvl_rtotal = (TextBox)ucRealizado.FindControl("txtvl_rtotal5" + i.ToString());

                                if (t28.Found)
                                {
                                    if (txtvl_p1 != null)
                                    {
                                        txtvl_p1.Text = t28.vl_p1.ToString("N2");
                                        txtvl_p4.Text = t28.vl_p4.ToString("N2");
                                        txtvl_p8.Text = t28.vl_p8.ToString("N2");
                                        txtvl_p12.Text = t28.vl_p12.ToString("N2");
                                        txtvl_ptotal.Text = (t28.vl_p1 + t28.vl_p4 + t28.vl_p8 + t28.vl_p12).ToString("N2");
                                    }
                                    if (txtvl_r1 != null)
                                    {
                                        txtvl_r1.Text = t28.vl_r1.ToString("N2");
                                        txtvl_r4.Text = t28.vl_r4.ToString("N2");
                                        txtvl_r8.Text = t28.vl_r8.ToString("N2");
                                        txtvl_r12.Text = t28.vl_r12.ToString("N2");
                                        txtvl_rtotal.Text = (t28.vl_r1 + t28.vl_r4 + t28.vl_r8 + t28.vl_r12).ToString("N2");
                                    }
                                }
                                else
                                {
                                    if (txtvl_p1 != null)
                                    {
                                        txtvl_p1.Text = "0,00";
                                        txtvl_p4.Text = "0,00";
                                        txtvl_p8.Text = "0,00";
                                        txtvl_p12.Text = "0,00";
                                    }
                                    if (txtvl_r1 != null)
                                    {
                                        txtvl_r1.Text = "0,00";
                                        txtvl_r4.Text = "0,00";
                                        txtvl_r8.Text = "0,00";
                                        txtvl_r12.Text = "0,00";
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
    }