protected string statusAcao(int cd_acao) { string cor = ""; bool r = false; bool g = false; bool b = false; t09_marco t09 = new t09_marco(); { t09.t08_cd_acao = cd_acao; foreach (DataRow dr in t09.List().Tables[0].Rows) { switch (dr["fl_status"].ToString()) { case "R": r = true; break; case "G": g = true; break; case "B": b = true; break; } } } if (r) { cor = "<img src=\"images/R.gif\" />"; } else if (g) { cor = "<img src=\"images/G.gif\" />"; } else if (b) { cor = "<img src=\"images/B.gif\" />"; } else { cor = ""; } if (!r) { t29_acaorestricao t29 = new t29_acaorestricao(); { t29.t08_cd_acao = cd_acao; t29.RetrieveAcao(); if (t29.Found) { cor = "<img src=\"images/Y.gif\" />"; } } } return cor; }
protected string graficoAcao(int cd_acao) { StringBuilder sb1 = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); int i; double fisico=0; double financeiro = 0; double difdias = 0; double difhoje=0; double crono = 0; t08_acao t08 = new t08_acao(); { t08.t08_cd_acao = cd_acao; t08.Retrieve(); if (t08.Found) { //TEMPO difdias = t08.dt_fim.Subtract(t08.dt_inicio).Days; difhoje = t08.dt_fim.Subtract(DateTime.Now).Days; if (DateTime.Now.Date > t08.dt_inicio.Date) { crono = (((difhoje / difdias) * 100) - 100) * -1; if (crono < 0) { crono = 0; } else if (crono > 100) { crono = 100; } } else { crono = 0; } //FÍSICO (Marcos Críticos) t09_marco t09 = new t09_marco(); { t09.t08_cd_acao = t08.t08_cd_acao; //double mcprev = 0; double mcreal = 0; foreach (DataRow dr in t09.List().Tables[0].Rows) { if ((string)dr["fl_status"] == "B") { fisico += (int)dr["nu_esforco"]; } //mcprev += (int)dr["nu_esforco"]; //Response.Write(dr["fl_status"] + " - " + dr["nu_esforco"] + "<br>"); } //if (mcprev>0) // fisico = ((mcreal * 100) / mcprev); } //FÍSICO (Produto) //t10_produto t10 = new t10_produto(); //{ // i = 0; // t10.t08_cd_acao = t08.t08_cd_acao; // foreach (DataRow dr in t10.List().Tables[0].Rows) // { // double prev, real; // i++; // if (dr["vl_r"] == DBNull.Value) // { // real = 0; // } // else // { // real = double.Parse(dr["vl_r"].ToString()); // } // if (dr["vl_p"] == DBNull.Value) // { // prev = 0; // } // else // { // prev = double.Parse(dr["vl_p"].ToString()); // } // if (prev > 0) // { // fisico += ((real * 100) / prev); // } // else // { // fisico += 0; // } // } // if (i>0) fisico = fisico / i; // if (fisico > 100) // { // fisico = 100; // } // else if (fisico < 0) // { // fisico = 0; // } //} //FINANCEIRO t11_financeiro t11 = new t11_financeiro(); { i = 0; t11.t08_cd_acao = t08.t08_cd_acao; foreach (DataRow dr in t11.ListCalc().Tables[0].Rows) { double prev, real; i++; if (dr["realizado"] == DBNull.Value) { real = 0; } else { real = double.Parse(dr["realizado"].ToString()); } if (dr["previsto"] == DBNull.Value) { prev = 0; } else { prev = double.Parse(dr["previsto"].ToString()); } if (prev > 0) { financeiro = ((real * 100) / prev); } else { financeiro = 0; } } if (financeiro > 100) { financeiro = 100; } else if (financeiro < 0) { financeiro = 0; } } } } //bgColor='" + linha + "' sb1.Append("<graph chartRightMargin='23' numberSuffix='%25' chartBottomMargin='30' yAxisMaxValue='100' showAlternateVGridColor='1' alternateVGridAlpha='10' alternateVGridColor='AFD8F8' numDivLines='4' decimalPrecision='0' canvasBorderThickness='1' canvasBorderColor='114B78' baseFontColor='114B78' hoverCapBorderColor='114B78' hoverCapBgColor='E7EFF6'>"); sb1.Append("<set name='Tempo' value='" + crono.ToString().Replace(",", ".") + "' color='AFD8F8' alpha='70'/> "); sb1.Append("<set name='Físico' value='" + fisico.ToString().Replace(",", ".") + "' color='AFD8F8' alpha='70'/> "); sb1.Append("<set name='Financeiro' value='" + financeiro.ToString().Replace(",",".") + "' color='AFD8F8' alpha='70'/> "); sb1.Append("</graph>"); sb2.Append("<object id=\"FC2Column\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\""); sb2.Append("height=\"80\" width=\"250\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">"); sb2.Append("<param name=\"Movie\" value=\"Charts/FC_2_3_Bar2D.swf\">"); sb2.Append("<param name=\"FlashVars\" value=\"&chartWidth=250&chartHeight=100&dataXML=" + sb1.ToString() + "\">"); sb2.Append("<embed src=\"Charts/FC_2_3_Bar2D.swf\" flashvars=\"&chartWidth=250&chartHeight=100&dataXML=" + sb1.ToString() + "\""); sb2.Append("quality=\"high\" width=\"250\" height=\"80\" name=\"FC2Column\" type=\"application/x-shockwave-flash\" pluginspace=\"http://www.macromedia.com/go/getflashplayer\"> </embed></object>"); return sb2.ToString(); }
protected void btnAcao_Click(object sender, System.EventArgs e) { //Label lblmsg = lblme.Text; t08_acao t08 = new t08_acao(); { bool result = false; bool erro = false; string msg = ""; t08.t03_cd_projeto = pb.cd_projeto(); t08.nm_acao = pb.ReplaceAspas(txtnm_acao.Text); t08.t02_cd_usuario = ddlt02_cd_usuario.SelectedValue; t08.ds_acao = pb.ReplaceAspas(txtds_acao.Text); t08.dt_inicio = DateTime.Parse(txtdt_inicio.Text); t08.dt_fim = DateTime.Parse(txtdt_fim.Text); t08.dt_original = DateTime.Parse(txtdt_fim.Text); t08.dt_cadastro = DateTime.Now; t08.dt_alterado = DateTime.Now; t08.ds_palvo = pb.ReplaceAspas(txtds_palvo.Text); t08.ds_andamento = pb.ReplaceAspas(txtds_andamento.Text); t08.ds_latuacao = pb.ReplaceAspas(txtds_latuacao.Text); t08.ds_parceiro = pb.ReplaceAspas(txtds_parceiro.Text); t08.ds_ano = pb.ReplaceAspas(txtds_ano.Text); t08.dt_aviso = DateTime.Parse(txtdt_aviso.Text); t03_projeto t03 = new t03_projeto(); { t03.t03_cd_projeto = t08.t03_cd_projeto; t03.Retrieve(); if (t03.Found) { if ((t08.dt_inicio < t03.dt_inicio)||(t08.dt_fim > t03.dt_fim)) { erro = true; msg = pb.Message("As datas de início e término da Ação deve estar entre as "+ "datas de início (" + t03.dt_inicio .ToShortDateString() + ") "+ "e término ("+t03.dt_fim.ToShortDateString()+") do Projeto!", "erro"); } if ((t08.dt_aviso < t08.dt_inicio)||(t08.dt_aviso > t08.dt_fim)) { erro = true; msg = pb.Message("A data de aviso deve estar entre as "+ "datas de início (" + t08.dt_inicio .ToShortDateString() + ") "+ "e término ("+t08.dt_fim.ToShortDateString()+") da Ação!", "erro"); } } } if (!(erro)) { if (cod.Value != "0") { t08.t08_cd_acao = Int32.Parse(cod.Value); foreach (DataRow dr in t08.ListAlt().Tables[0].Rows) { if (dr["menor"] != DBNull.Value) { //Response.Write(dr["menor"]); if ((DateTime.Parse(txtdt_inicio.Text).Year > (int)dr["menor"]) || (DateTime.Parse(txtdt_fim.Text).Year < (int)dr["maior"])) { if (btnAcao.CommandArgument != "1") { btnAcao.Text = "Confirmar"; lblme.Text = "<b>Atenção:</b> Serão excluídos eventuais valores de Financeiros cadastrados em anos não contidos no novo prazo, clique em Confirmar para prosseguir com a alteração.<br />"; btnAcao.CommandArgument = "1"; } else { t08.order = " nu_ano not between '" + DateTime.Parse(txtdt_inicio.Text).Year + "' And '" + DateTime.Parse(txtdt_fim.Text).Year + "' "; t08.DeleteAlt(); result = t08.Update(); msg = pb.Message("Alteração realizada com sucesso!", "ok"); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "update", cod.Value); } } else { result = t08.Update(); msg = pb.Message("Alteração realizada com sucesso!", "ok"); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "update", cod.Value); } } else { result = t08.Update(); msg = pb.Message("Alteração realizada com sucesso!", "ok"); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "update", cod.Value); } } } else { result = t08.Save(); msg = pb.Message("Cadastro realizado com sucesso!", "ok"); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "insert", t08.nm_acao); if (result) { t08.RetrieveCod(); if (t08.Found) { t09_marco t09 = new t09_marco(); { t09.t08_cd_acao = t08.t08_cd_acao; t09.nu_esforco = 1; t09.ds_marco = "Ação encerrada"; t09.dt_prevista = t08.dt_fim; t09.dt_original = t08.dt_fim; t09.ds_comentario = ""; t09.fl_status = "G"; t09.dt_cadastro = DateTime.Now; t09.dt_alterado = DateTime.Now; t09.fl_original = true; t09.Save(); } } } } if (result) { Ocultar(); GridBind(); cod.Value = "0"; } } lblMsg.Text = msg; lblMsg.Visible = true; } }
public string Status(int cd_projeto) { StringBuilder sb = new StringBuilder(); string fl_status; int azul = 0; int amarelo = 0; int vermelho = 0; int verde = 0; int total = 0; t08_acao t08 = new t08_acao(); { //t08.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao)"; t08.t03_cd_projeto = cd_projeto; foreach (DataRow dra in t08.List().Tables[0].Rows) { bool r = false; bool g = false; bool b = false; bool nenhum = false; t09_marco t09 = new t09_marco(); { t09.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao where t08_cd_acao not in (select t08_cd_acao from t09_marco where fl_ativa=1 and fl_status='R'))"; t09.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString()); foreach (DataRow dr in t09.List().Tables[0].Rows) { switch (dr["fl_status"].ToString()) { case "R": r = true; break; case "G": g = true; break; case "B": b = true; break; } } } if (r) { vermelho++; } else if (g) { verde++; } else if (b) { azul++; } else { nenhum = true; } if (!r) { t29_acaorestricao t29 = new t29_acaorestricao(); { t29.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString()); t29.RetrieveAcao(); if (t29.Found) { amarelo++; nenhum = false; } else { nenhum = true; } } } //if (!nenhum) //{ // total++; //} } total = verde + vermelho + amarelo + azul; //t09_marco t09 = new t09_marco(); //{ // t09.order = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto=" + cd_projeto.ToString() + ")"; // foreach (DataRow dr in t09.ListStatus().Tables[0].Rows) // { // fl_status = dr["fl_status"].ToString().Trim(); // switch (fl_status) // { // case ("Y"): // amarelo += Int32.Parse(dr["nu_esforco"].ToString()); // break; // case ("B"): // azul += Int32.Parse(dr["nu_esforco"].ToString()); // break; // case ("G"): // verde += Int32.Parse(dr["nu_esforco"].ToString()); // break; // case ("R"): // vermelho += Int32.Parse(dr["nu_esforco"].ToString()); // break; // } // total += Int32.Parse(dr["nu_esforco"].ToString()); // } //} if (total > 0) { sb.Append("<table width=100% height=17 border=0 cellpadding=0 cellspacing=0><tr>"); if (azul != 0) { sb.Append("<td style=\"border:none;background:url('images/B.gif');width:" + (azul * 100) / total + "%\" title='" + (azul * 100) / total + "%'> </td>"); } if (verde != 0) { sb.Append("<td style=\"border:none;background:url('images/G.gif');width:" + (verde * 100) / total + "%\" title='" + (verde * 100) / total + "%'> </td>"); } if (amarelo != 0) { sb.Append("<td style=\"border:none;background:url('images/Y.gif');width:" + (amarelo * 100) / total + "%\" title='" + (amarelo * 100) / total + "%'> </td>"); } if (vermelho != 0) { sb.Append("<td style=\"border:none;background:url('images/R.gif');width:" + (vermelho * 100) / total + "%\" title='" + (vermelho * 100) / total + "%'> </td>"); } sb.Append("</tr></table>"); } else { sb.Append(" "); } } return sb.ToString(); }
public void UpdateCorBarra() { t09_marco t09 = new t09_marco(); { t09.fl_status = "B"; t09.order = "where dt_realizada is not null"; t09.UpdateCor(); t09.fl_status = "G"; t09.order = "where dt_prevista >= getdate() and dt_realizada is null"; t09.UpdateCor(); t09.fl_status = "R"; t09.order = "where dt_prevista < getdate()-1 and dt_realizada is null"; t09.UpdateCor(); } }
private void GridBind() { t09_marco t09 = new t09_marco(); { int nu_esforco = 0; int i = 0; t09.t08_cd_acao = pb.cd_acao(); t09.order = "order by " + ViewState["campo"].ToString() + " " + ViewState["sentido"].ToString(); GridView1.DataSource = t09.List(); GridView1.DataBind(); if (pb.fl_gerente()) { foreach (DataRow dr in t09.List().Tables[0].Rows) { i++; nu_esforco += Int32.Parse(dr["nu_esforco"].ToString()); if (dr["dt_realizada"] != null) { btnDes.Visible = true; } else { btnDes.Visible = false; } } if (i > 0) { if (nu_esforco != 100) { //LEVI lblmsg_mc.Text = "Atenção: Percentual de esforço do(s) Marco(s) Crítico(s) é de: " + nu_esforco.ToString() + "% e deveria ser 100%."; //lblmsg_mc.Font.Bold = true; lblmsg_mc.ForeColor = System.Drawing.Color.Brown; } else { lblmsg_mc.Text = ""; } } } } }
private void Retrieve() { trReal.Visible = true; t09_marco t09 = new t09_marco(); { t09.t09_cd_marco = Int32.Parse(cod.Value); t09.Retrieve(); if (t09.Found) { txtnu_esforco.Text = t09.nu_esforco.ToString(); txtds_marco.Text = t09.ds_marco; txtdt_prevista.Text = t09.dt_prevista.ToShortDateString(); if (t09.dt_realizada.ToShortDateString() != "1/1/0001") { txtdt_realizada.Text = t09.dt_realizada.ToShortDateString(); } txtds_comentario.Text = t09.ds_comentario; if (t09.fl_original) { txtds_marco.ReadOnly = true; } else { txtds_marco.ReadOnly = false; } } } }
protected void btnAcao_Click(object sender, System.EventArgs e) { t09_marco t09 = new t09_marco(); { bool result = false; bool erro = false; string msg = ""; t09.t08_cd_acao = pb.cd_acao(); //t09.nu_esforco = Int32.Parse(txtnu_esforco.Text); t09.ds_marco = pb.ReplaceAspas(txtds_marco.Text); t09.dt_prevista = DateTime.Parse(txtdt_prevista.Text); //t09.dt_original = DateTime.Parse(txtdt_prevista.Text); t09.ds_comentario = txtds_comentario.Text; t09.fl_status = "G"; t09.dt_cadastro = DateTime.Now; t09.dt_alterado = DateTime.Now; t09.fl_original = false; t08_acao t08 = new t08_acao(); { t08.t08_cd_acao = pb.cd_acao(); t08.Retrieve(); if (t08.Found) { if ((t09.dt_prevista < t08.dt_inicio) || (t09.dt_prevista > t08.dt_fim)) { erro = true; msg = pb.Message("As Data Prevista do Marco Crítico deve estar entre as " + "datas de início (" + t08.dt_inicio.ToShortDateString() + ") " + "e término (" + t08.dt_fim.ToShortDateString() + ") da Ação!", "erro"); } } } if (!(erro)) { if (cod.Value != "0") { t09.t09_cd_marco = Int32.Parse(cod.Value); if (txtdt_realizada.Text != "") { t09.order = ", dt_realizada='" + String.Format("{0:yyyy-MM-dd}", DateTime.Parse(txtdt_realizada.Text)) + "', fl_status = 'B'"; } else { if (t09.dt_prevista >= DateTime.Today) { //t09.fl_status = "G"; t09.order = ", fl_status = 'G'"; } else { //t09.fl_status = "R"; t09.order = ", fl_status = 'R'"; } } result = t09.Update(); msg = pb.Message("Alteração realizada com sucesso!", "ok"); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t09_marco", "update", cod.Value); } else { if (t09.dt_prevista < DateTime.Today) { t09.fl_status = "R"; } result = t09.Save(); msg = pb.Message("Cadastro realizado com sucesso!", "ok"); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t09_marco", "insert", t09.ds_marco); } if (result) { Ocultar(); GridBind(); cod.Value = "0"; } } lblMsg.Text = msg; lblMsg.Visible = true; } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { GridView gv = (GridView)sender; if (e.CommandName != "Sort") { int cd = Int32.Parse(gv.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Value.ToString()); switch (e.CommandName) { case "Editar": Exibir(); this.lblHeader.Text = "Alteração"; this.btnAcao.Text = "Alterar"; cod.Value = cd.ToString(); Retrieve(); break; case "Deletar": t09_marco t09 = new t09_marco(); { t09.t09_cd_marco = cd; t09.Delete(); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t09_marco", "delete", t09.t09_cd_marco.ToString()); } GridBind(); lblMsg.Text = pb.Message("Exclusão realizada com sucesso!", "ok"); lblMsg.Visible = true; break; } } }
protected void Desrealizar_Click(object sender, System.EventArgs e) { bool result = false; string msg = ""; t09_marco t09 = new t09_marco(); { t09.t09_cd_marco = Int32.Parse(cod.Value); //t09.UpdateDesrealizar(); result = t09.UpdateDesrealizar(); txtdt_realizada.Text = ""; msg = pb.Message("Alteração realizada com sucesso!", "ok"); lblMsg.Visible = true; } if (result) { pb.UpdateCorBarra(); //Ocultar(); GridBind(); } }
public void AcaoStatus(Panel pn) { try { System.Text.StringBuilder sb = new System.Text.StringBuilder(); int azul = 0; int amarelo = 0; int vermelho = 0; int verde = 0; int total = 0; t03_projeto t03 = new t03_projeto(); { t03.order = "select * from t03_projeto where (fl_ativa=1) " + pb.sqlfiltro() + " order by t03_cd_projeto"; foreach (DataRow drp in t03.ListQuery().Tables[0].Rows) { t08_acao t08 = new t08_acao(); { t08.t03_cd_projeto = (int)drp["t03_cd_projeto"]; foreach (DataRow dra in t08.List().Tables[0].Rows) { bool r = false; bool g = false; bool b = false; t09_marco t09 = new t09_marco(); { t09.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao where t08_cd_acao not in (select t08_cd_acao from t09_marco where fl_ativa=1 and fl_status='R')) "; t09.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString()); foreach (DataRow dr in t09.List().Tables[0].Rows) { switch (dr["fl_status"].ToString()) { case "R": r = true; break; case "G": g = true; break; case "B": b = true; break; } } } if (r) { vermelho++; } else if (g) { verde++; } else if (b) { azul++; } if (!r) { t29_acaorestricao t29 = new t29_acaorestricao(); { t29.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString()); t29.RetrieveAcao(); if (t29.Found) { amarelo++; } } } } } } total = verde + vermelho + amarelo + azul; if (total > 0) { lblAzul.Text = azul.ToString(); lblVerde.Text = verde.ToString(); lblAmarela.Text = amarelo.ToString(); lblVermelha.Text = vermelho.ToString(); lblFatiaAzul.Text = ((azul * 100) / total).ToString(); lblFatiaVerde.Text = ((verde * 100) / total).ToString(); lblFatiaAmarela.Text = ((amarelo * 100) / total).ToString(); lblFatiaVermelha.Text = ((vermelho * 100) / total).ToString(); if (azul == 0) linkConcluidos.NavigateUrl = ""; if (verde == 0) linkPrazos.NavigateUrl = ""; if (amarelo == 0) linkComRestricoes.NavigateUrl = ""; if (vermelho == 0) linkAtraso.NavigateUrl = ""; sb.Append("<table width=100% height=20 border=0 cellpadding=0 cellspacing=0><tr>"); if (azul != 0) { sb.Append("<td style=\"border:none;background:url('images/B.gif');width:" + (azul * 100) / total + "%\" title='" + (azul * 100) / total + "%'> </td>"); } if (verde != 0) { sb.Append("<td style=\"border:none;background:url('images/G.gif');width:" + (verde * 100) / total + "%\" title='" + (verde * 100) / total + "%'> </td>"); } if (amarelo != 0) { sb.Append("<td style=\"border:none;background:url('images/Y.gif');width:" + (amarelo * 100) / total + "%\" title='" + (amarelo * 100) / total + "%'> </td>"); } if (vermelho != 0) { sb.Append("<td style=\"border:none;background:url('images/R.gif');width:" + (vermelho * 100) / total + "%\" title='" + (vermelho * 100) / total + "%'> </td>"); } sb.Append("</tr></table>"); } else { lblAzul.Text = "0"; lblVerde.Text = "0"; lblAmarela.Text = "0"; lblVermelha.Text = "0"; lblFatiaAzul.Text = "0"; lblFatiaVerde.Text = "0"; lblFatiaAmarela.Text = "0"; lblFatiaVermelha.Text = "0"; linkConcluidos.NavigateUrl = ""; linkPrazos.NavigateUrl = ""; linkComRestricoes.NavigateUrl = ""; linkAtraso.NavigateUrl = ""; } } pn.Controls.Add(pb.GetLiteral(sb.ToString())); } catch (Exception ex) { Response.Write("AcaoStatus: " + ex.Message); } }
private void GridBind() { t09_marco t09 = new t09_marco(); { string sqlfixo=""; //if ((cd_entidade == "0") && (!pb.fl_estrategico())) //{ // sqlfixo = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto in (select t03_cd_projeto from t03_projeto where fl_ativa=1 and t01_cd_entidade=" + cd_entidade + "))"; //} //else //{ // sqlfixo = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto in (select t03_cd_projeto from t03_projeto where fl_ativa=1 and t02_cd_usuario='" + pb.cd_usuario() + "'))"; //} if (pb.fl_admin()) { sqlfixo = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto in (select t03_cd_projeto from t03_projeto where fl_ativa=1 and t01_cd_entidade=" + ddlt01_cd_entidade.SelectedValue + "))"; } else { if ((pb.cd_parceiro() != 0) && (!pb.fl_estrategico())) //parceiro { sqlfixo = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto in (select t03_cd_projeto from t03_projeto where fl_ativa=1 and t02_cd_usuario='" + pb.cd_usuario() + "'))"; } else //administrador parceiro { if (pb.cd_parceiro() != 0) { sqlfixo = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto in (select t03_cd_projeto from t03_projeto where fl_ativa=1 and t01_cd_entidade in (select t01_cd_entidade from t05_parceiro where t05_cd_parceiro=" + pb.cd_parceiro() + ")))"; } else { sqlfixo = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto in (select t03_cd_projeto from t03_projeto where fl_ativa=1 and t01_cd_entidade=" + pb.cd_entidade() + "))"; } } } t09.order = ViewState["sql"].ToString() + sqlfixo + " order by " + ViewState["campo"].ToString() + " " + ViewState["sentido"].ToString(); GridView1.DataSource = t09.ListStatus(); GridView1.DataBind(); } }