private void Retrieve(int cod) { t07_restricao t07 = new t07_restricao(); { t07.t07_cd_restricao = cod; t07.Retrieve(); if (t07.Found) { lblds_restricao.Text = t07.ds_restricao; lblds_medida.Text = t07.ds_medida; lbldt_limite.Text = t07.dt_limite.ToShortDateString(); lbldt_cadastro.Text = t07.dt_cadastro.ToShortDateString(); t29_acaorestricao t29 = new t29_acaorestricao(); { t29.t07_cd_restricao = t07.t07_cd_restricao; t29.Retrieve(); if (t29.Found) { t08_acao t08 = new t08_acao(); { t08.t08_cd_acao = t29.t08_cd_acao; t08.Retrieve(); if (t08.Found) { trAcao.Visible = true; lblnm_acao.Text = t08.nm_acao; } } } else { trProjeto.Visible = true; } } } } }
private void GridBind(string order) { string tipologia=""; if (pb.cd_tipologia().ToString() != "0") { tipologia = " t04_cd_tipologia = " + pb.cd_tipologia().ToString() +" and "; } string colspan = "5"; PanelGrid.Controls.Clear(); StringBuilder sb = new StringBuilder(); sb.Append("<table cellspacing=\"2\" cellpadding=\"4\" class=\"tblist\">"); t03_projeto t03 = new t03_projeto(); { //t03.t01_cd_entidade = cd_entidade; //somente a entidade do parceiro if (pb.fl_admin() || pb.fl_visitante() || pb.fl_estrategico()) { //entidade do usuário //t03.order = " and t01_cd_entidade in (select t01_cd_entidade from t03_projeto where " + tipologia + " fl_ativa=1 and t01_cd_entidade="+pb.cd_entidade()+" ) order by nm_entidade"; if (pb.fl_visitante()) { t03.order = " and t01_cd_entidade in (select t01_cd_entidade from t03_projeto where " + tipologia + " fl_ativa=1 and t03_cd_projeto in (select t03_cd_projeto from t20_faseprojeto where t19_cd_fase = 2 or t19_cd_fase = 1)) order by nm_entidade"; } else { t03.order = " and t01_cd_entidade in (select t01_cd_entidade from t03_projeto where " + tipologia + " fl_ativa=1) order by nm_entidade"; } if (Session["vr"] != null) { t03.order = " and t01_cd_entidade = " + Session["vr"].ToString() + " "+ //"(select t01_cd_entidade from t03_projeto where " + tipologia + " fl_ativa=1 and t01_cd_entidade = " + Session["vr"].ToString() + " " + "order by nm_entidade"; } foreach (DataRow dre in t03.ListEntidade().Tables[0].Rows) { sb.Append("<tr class=\"hr_white\">"); sb.Append("<td colspan='" + colspan + "'>" + dre["nm_entidade"] + "</td>"); sb.Append("</tr>"); t03.order = tipologia; t03.t01_cd_entidade = Int32.Parse(dre["t01_cd_entidade"].ToString()); foreach (DataRow drt in t03.ListTipologia().Tables[0].Rows) { sb.Append("<tr class=\"hr_yellow\">"); sb.Append("<td colspan='" + colspan + "'>" + drt["nm_tipologia"] + "</td>"); sb.Append("</tr>"); sb.Append("<tr class=\"hr_orange\">"); if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { sb.Append("<td>Eixos</td>"); } else { sb.Append("<td colspan=2>Eixos</td>"); } //LEVI sb.Append("<td>Fase</td>"); //LEVI 11-02-2015 sb.Append("<td>Atualizado</td>"); if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { sb.Append("<td>Restrição</td>"); } sb.Append("<td style='width:200px'>Evolução</td>"); sb.Append("</tr>"); if (pb.fl_visitante()) { t03.order = "where fl_ativa = 1" + " and t03_cd_projeto in " + " (select t03_cd_projeto from t20_faseprojeto where t19_cd_fase = 2 or t19_cd_fase = 1)" + " and t01_cd_entidade=" + dre["t01_cd_entidade"].ToString() + " and t04_cd_tipologia=" + drt["t04_cd_tipologia"].ToString(); } else { t03.order = "where fl_ativa=1" + " and t01_cd_entidade=" + dre["t01_cd_entidade"].ToString() + " and t04_cd_tipologia=" + drt["t04_cd_tipologia"].ToString() + " order by nm_projeto"; } foreach (DataRow drp in t03.List().Tables[0].Rows) { string nm_projeto = drp["nm_projeto"].ToString(); string nm_fase = ""; string data = "-"; if (drp["dt_alterado"] != DBNull.Value) { data = String.Format("{0:dd/MM/yyyy}", DateTime.Parse(drp["dt_alterado"].ToString())); } t19_fase t19 = new t19_fase(); { t19.t19_cd_fase = Int32.Parse(drp["t03_cd_projeto"].ToString()); //usando o t19_cd_fase para armazenar t03_cd_projeto; t19.RetrieveFaseProjeto(); if (t19.Found) { nm_fase = t19.nm_fase; } } sb.Append("<tr>"); PanelGrid.Controls.Add(pb.GetLiteral(sb.ToString())); if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { PanelGrid.Controls.Add(pb.GetLiteral("<td>")); } else { PanelGrid.Controls.Add(pb.GetLiteral("<td colspan=2>")); } LinkButton link = new LinkButton(); { link.ID = "linkP" + drp["t03_cd_projeto"].ToString(); link.CommandArgument = drp["t03_cd_projeto"].ToString(); link.Text = nm_projeto; link.Click += new EventHandler(link_Click); } PanelGrid.Controls.Add(link); PanelGrid.Controls.Add(pb.GetLiteral("</td>"));//Projeto sb = new StringBuilder(); //LEVI sb.Append("<td>" + nm_fase + "</td>"); //Fase //LEVI 11-02-2015 sb.Append("<td style='text-align:center'>" + data + "</td>"); //Atualizado if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { t07_restricao t07 = new t07_restricao(); { t07.t03_cd_projeto = Int32.Parse(drp["t03_cd_projeto"].ToString()); if (t07.List().Tables[0].Rows.Count == 0) { sb.Append("<td> </td>"); //Restrição } else { sb.Append("<td style='text-align:center'><b>R</b></td>"); //Restrição } } } sb.Append("<td>" + pb.Status(Int32.Parse(drp["t03_cd_projeto"].ToString())) + "</td>"); //Evolução sb.Append("</tr>"); } } } //restante das entidades //t03.order = " and t01_cd_entidade in (select t01_cd_entidade from t03_projeto where " + tipologia + " fl_ativa=1 and t01_cd_entidade<>" + pb.cd_entidade() + ") order by nm_entidade"; //foreach (DataRow dre in t03.ListEntidade().Tables[0].Rows) //{ // sb.Append("<tr class=\"hr_white\">"); // sb.Append("<td colspan='" + colspan + "'>" + dre["nm_entidade"] + "</td>"); // sb.Append("</tr>"); // t03.order = tipologia; // t03.t01_cd_entidade = Int32.Parse(dre["t01_cd_entidade"].ToString()); // foreach (DataRow drt in t03.ListTipologia().Tables[0].Rows) // { // sb.Append("<tr class=\"hr_yellow\">"); // sb.Append("<td colspan='" + colspan + "'>" + drt["nm_tipologia"] + "</td>"); // sb.Append("</tr>"); // sb.Append("<tr class=\"hr_orange\">"); // if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) // { // sb.Append("<td>Projeto</td>"); // } // else { sb.Append("<td colspan=2>Projeto</td>"); } // sb.Append("<td>Fase</td>"); // sb.Append("<td>Atualizado</td>"); // if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { sb.Append("<td>Restrição</td>"); } // sb.Append("<td style='width:120px'>Evolução</td>"); // sb.Append("</tr>"); // t03.order = "where fl_ativa=1" + // " and t01_cd_entidade=" + dre["t01_cd_entidade"].ToString() + // " and t04_cd_tipologia=" + drt["t04_cd_tipologia"].ToString() + // " order by nm_projeto"; // foreach (DataRow drp in t03.List().Tables[0].Rows) // { // string nm_projeto = drp["nm_projeto"].ToString(); // string nm_fase = ""; // string data = "-"; // if (drp["dt_alterado"] != DBNull.Value) // { // data = String.Format("{0:dd/MM/yyyy}", DateTime.Parse(drp["dt_alterado"].ToString())); // } // t19_fase t19 = new t19_fase(); // { // t19.t19_cd_fase = Int32.Parse(drp["t03_cd_projeto"].ToString()); //usando o t19_cd_fase para armazenar t03_cd_projeto; // t19.RetrieveFaseProjeto(); // if (t19.Found) // { // nm_fase = t19.nm_fase; // } // } // sb.Append("<tr>"); // PanelGrid.Controls.Add(pb.GetLiteral(sb.ToString())); // if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) // { // PanelGrid.Controls.Add(pb.GetLiteral("<td>")); // } // else { PanelGrid.Controls.Add(pb.GetLiteral("<td colspan=2>")); } // LinkButton link = new LinkButton(); // { // link.ID = "linkP" + drp["t03_cd_projeto"].ToString(); // link.CommandArgument = drp["t03_cd_projeto"].ToString(); // link.Text = nm_projeto; // link.Click += new EventHandler(link_Click); // } // PanelGrid.Controls.Add(link); // PanelGrid.Controls.Add(pb.GetLiteral("</td>"));//Projeto // sb = new StringBuilder(); // sb.Append("<td>" + nm_fase + "</td>"); //Fase // sb.Append("<td style='text-align:center'>" + data + "</td>"); //Atualizado // if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) // { // t07_restricao t07 = new t07_restricao(); // { // t07.t03_cd_projeto = Int32.Parse(drp["t03_cd_projeto"].ToString()); // if (t07.List().Tables[0].Rows.Count == 0) // { // sb.Append("<td> </td>"); //Restrição // } // else // { // sb.Append("<td style='text-align:center'><b>R</b></td>"); //Restrição // } // } // } // sb.Append("<td>" + pb.Status(Int32.Parse(drp["t03_cd_projeto"].ToString())) + "</td>"); //Evolução // sb.Append("</tr>"); // } // } //} } else //se usuário sem perfil e diferente de visitante { if (pb.cd_parceiro() != 0) //parceiro { t03.order = " and t01_cd_entidade in " + "(select t01_cd_entidade from t03_projeto where " + tipologia + " fl_ativa=1 and t01_cd_entidade in " + "(select t01_cd_entidade from t05_parceiro where t05_cd_parceiro=" + pb.cd_parceiro() + ")) " + "order by nm_entidade"; //Response.Write(t03.order+"<br>"); foreach (DataRow dre in t03.ListEntidade().Tables[0].Rows) { sb.Append("<tr class=\"hr_white\">"); sb.Append("<td colspan='" + colspan + "'>" + dre["nm_entidade"] + "</td>"); sb.Append("</tr>"); t03.order = tipologia; t03.t01_cd_entidade = Int32.Parse(dre["t01_cd_entidade"].ToString()); foreach (DataRow drt in t03.ListTipologia().Tables[0].Rows) { sb.Append("<tr class=\"hr_yellow\">"); sb.Append("<td colspan='" + colspan + "'>" + drt["nm_tipologia"] + "</td>"); sb.Append("</tr>"); sb.Append("<tr class=\"hr_orange\">"); if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { sb.Append("<td>Eixos</td>"); } else { sb.Append("<td colspan=2>Eixos</td>"); } //LEVI sb.Append("<td>Fase</td>"); //LEVI 11-02-2015 sb.Append("<td>Atualizado</td>"); //LEVI if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { sb.Append("<td>Restrição</td>"); } sb.Append("<td style='width:200px'>Evolução</td>"); sb.Append("</tr>"); t03.order = "where fl_ativa=1" + " and t01_cd_entidade=" + dre["t01_cd_entidade"].ToString() + " and t04_cd_tipologia=" + drt["t04_cd_tipologia"].ToString() + " order by nm_projeto"; foreach (DataRow drp in t03.List().Tables[0].Rows) { string nm_projeto = drp["nm_projeto"].ToString(); string nm_fase = ""; string data = "-"; if (drp["dt_alterado"] != DBNull.Value) { data = String.Format("{0:dd/MM/yyyy}", DateTime.Parse(drp["dt_alterado"].ToString())); } t19_fase t19 = new t19_fase(); { t19.t19_cd_fase = Int32.Parse(drp["t03_cd_projeto"].ToString()); //usando o t19_cd_fase para armazenar t03_cd_projeto; t19.RetrieveFaseProjeto(); if (t19.Found) { nm_fase = t19.nm_fase; } } sb.Append("<tr>"); PanelGrid.Controls.Add(pb.GetLiteral(sb.ToString())); if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { PanelGrid.Controls.Add(pb.GetLiteral("<td>")); } else { PanelGrid.Controls.Add(pb.GetLiteral("<td colspan=2>")); } LinkButton link = new LinkButton(); { link.ID = "linkP2" + drp["t03_cd_projeto"].ToString(); link.CommandArgument = drp["t03_cd_projeto"].ToString(); link.Text = nm_projeto; link.Click += new EventHandler(link_Click); } PanelGrid.Controls.Add(link); PanelGrid.Controls.Add(pb.GetLiteral("</td>"));//Programas sb = new StringBuilder(); //LEVI sb.Append("<td>" + nm_fase + "</td>"); //Fase //LEVI 11-02-2015 sb.Append("<td style='text-align:center'>" + data + "</td>"); //Atualizado if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { t07_restricao t07 = new t07_restricao(); { t07.t03_cd_projeto = Int32.Parse(drp["t03_cd_projeto"].ToString()); if (t07.List().Tables[0].Rows.Count == 0) { //LEVI sb.Append("<td> </td>"); //Restrição } else { //LEVI sb.Append("<td style='text-align:center'><b>R</b></td>"); //Restrição } } } sb.Append("<td>" + pb.Status(Int32.Parse(drp["t03_cd_projeto"].ToString())) + "</td>"); //Evolução sb.Append("</tr>"); } } } } else //administrador parceiro { t03.order = " and t01_cd_entidade in (select t01_cd_entidade from t03_projeto where " + tipologia + " fl_ativa=1 and t01_cd_entidade=" + pb.cd_entidade() + " ) order by nm_entidade"; foreach (DataRow dre in t03.ListEntidade().Tables[0].Rows) { sb.Append("<tr class=\"hr_white\">"); sb.Append("<td colspan='" + colspan + "'>" + dre["nm_entidade"] + "</td>"); sb.Append("</tr>"); t03.order = tipologia; t03.t01_cd_entidade = Int32.Parse(dre["t01_cd_entidade"].ToString()); foreach (DataRow drt in t03.ListTipologia().Tables[0].Rows) { sb.Append("<tr class=\"hr_yellow\">"); sb.Append("<td colspan='" + colspan + "'>" + drt["nm_tipologia"] + "</td>"); sb.Append("</tr>"); sb.Append("<tr class=\"hr_orange\">"); if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { sb.Append("<td>Eixos</td>"); } else { sb.Append("<td colspan=2>Eixos</td>"); } // sb.Append("<td>Fase</td>"); sb.Append("<td>Atualizado</td>"); //if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { sb.Append("<td>Restrição</td>"); } //sb.Append("<td style='width:120px'>Evolução</td>"); sb.Append("</tr>"); t03.order = "where fl_ativa=1" + " and t01_cd_entidade=" + dre["t01_cd_entidade"].ToString() + " and t04_cd_tipologia=" + drt["t04_cd_tipologia"].ToString() + " order by nm_projeto"; foreach (DataRow drp in t03.List().Tables[0].Rows) { string nm_projeto = drp["nm_projeto"].ToString(); string nm_fase = ""; string data = "-"; if (drp["dt_alterado"] != DBNull.Value) { data = String.Format("{0:dd/MM/yyyy}", DateTime.Parse(drp["dt_alterado"].ToString())); } t19_fase t19 = new t19_fase(); { t19.t19_cd_fase = Int32.Parse(drp["t03_cd_projeto"].ToString()); //usando o t19_cd_fase para armazenar t03_cd_projeto; t19.RetrieveFaseProjeto(); if (t19.Found) { nm_fase = t19.nm_fase; } } sb.Append("<tr>"); PanelGrid.Controls.Add(pb.GetLiteral(sb.ToString())); if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { PanelGrid.Controls.Add(pb.GetLiteral("<td>")); } else { PanelGrid.Controls.Add(pb.GetLiteral("<td colspan=2>")); } LinkButton link = new LinkButton(); { link.ID = "linkP" + drp["t03_cd_projeto"].ToString(); link.CommandArgument = drp["t03_cd_projeto"].ToString(); link.Text = nm_projeto; link.Click += new EventHandler(link_Click); } PanelGrid.Controls.Add(link); PanelGrid.Controls.Add(pb.GetLiteral("</td>"));//Programas sb = new StringBuilder(); // sb.Append("<td>" + nm_fase + "</td>"); //Fase sb.Append("<td style='text-align:center'>" + data + "</td>"); //Atualizado //if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) //{ // t07_restricao t07 = new t07_restricao(); // { // t07.t03_cd_projeto = Int32.Parse(drp["t03_cd_projeto"].ToString()); // if (t07.List().Tables[0].Rows.Count == 0) // { // sb.Append("<td> </td>"); // } // else // { // sb.Append("<td style='text-align:center'><b>R</b></td>"); // } // } // } //sb.Append("<td>" + pb.Status(Int32.Parse(drp["t03_cd_projeto"].ToString())) + "</td>"); sb.Append("</tr>"); } } } } //t03.order = " and t01_cd_entidade in " + // "(select t01_cd_entidade from t03_projeto where "+ tipologia +" fl_ativa=1 and t01_cd_entidade not in " + // "(select t01_cd_entidade from t05_parceiro where t05_cd_parceiro=" + pb.cd_parceiro() + ")) " + // "order by nm_entidade"; ////Response.Write(t03.order + "<br>"); //foreach (DataRow dre in t03.ListEntidade().Tables[0].Rows) //{ // sb.Append("<tr class=\"hr_white\">"); // sb.Append("<td colspan='" + colspan + "'>" + dre["nm_entidade"] + "</td>"); // sb.Append("</tr>"); // t03.order = tipologia; // t03.t01_cd_entidade = Int32.Parse(dre["t01_cd_entidade"].ToString()); // foreach (DataRow drt in t03.ListTipologia().Tables[0].Rows) // { // sb.Append("<tr class=\"hr_yellow\">"); // sb.Append("<td colspan='" + colspan + "'>" + drt["nm_tipologia"] + "</td>"); // sb.Append("</tr>"); // sb.Append("<tr class=\"hr_orange\">"); // if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) // { // sb.Append("<td>Projeto</td>"); // } // else { sb.Append("<td colspan=2>Projeto</td>"); } // sb.Append("<td>Fase</td>"); // sb.Append("<td>Atualizado</td>"); // if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) { sb.Append("<td>Restrição</td>"); } // sb.Append("<td style='width:120px'>Evolução</td>"); // sb.Append("</tr>"); // t03.order = "where fl_ativa=1" + // " and t01_cd_entidade=" + dre["t01_cd_entidade"].ToString() + // " and t04_cd_tipologia=" + drt["t04_cd_tipologia"].ToString() + // " order by nm_projeto"; // foreach (DataRow drp in t03.List().Tables[0].Rows) // { // string nm_projeto = drp["nm_projeto"].ToString(); // string nm_fase = ""; // string data = "-"; // if (drp["dt_alterado"] != DBNull.Value) // { // data = String.Format("{0:dd/MM/yyyy}", DateTime.Parse(drp["dt_alterado"].ToString())); // } // t19_fase t19 = new t19_fase(); // { // t19.t19_cd_fase = Int32.Parse(drp["t03_cd_projeto"].ToString()); //usando o t19_cd_fase para armazenar t03_cd_projeto; // t19.RetrieveFaseProjeto(); // if (t19.Found) // { // nm_fase = t19.nm_fase; // } // } // sb.Append("<tr>"); // PanelGrid.Controls.Add(pb.GetLiteral(sb.ToString())); // if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) // { // PanelGrid.Controls.Add(pb.GetLiteral("<td>")); // } // else { PanelGrid.Controls.Add(pb.GetLiteral("<td colspan=2>")); } // LinkButton link = new LinkButton(); // { // link.ID = "linkP3" + drp["t03_cd_projeto"].ToString(); // link.CommandArgument = drp["t03_cd_projeto"].ToString(); // link.Text = nm_projeto; // link.Click += new EventHandler(link_Click); // } // PanelGrid.Controls.Add(link); // PanelGrid.Controls.Add(pb.GetLiteral("</td>"));//Projeto // sb = new StringBuilder(); // sb.Append("<td>" + nm_fase + "</td>"); //Fase // sb.Append("<td style='text-align:center'>" + data + "</td>"); //Atualizado // if (!pb.fl_semperfil((int)dre["t01_cd_entidade"])) // { // t07_restricao t07 = new t07_restricao(); // { // t07.t03_cd_projeto = Int32.Parse(drp["t03_cd_projeto"].ToString()); // if (t07.List().Tables[0].Rows.Count == 0) // { // sb.Append("<td> </td>"); //Restrição // } // else // { // sb.Append("<td style='text-align:center'><b>R</b></td>"); //Restrição // } // } // } // sb.Append("<td>" + pb.Status(Int32.Parse(drp["t03_cd_projeto"].ToString())) + "</td>"); //Evolução // sb.Append("</tr>"); // } // } //} } sb.Append("</table>"); } PanelGrid.Controls.Add(pb.GetLiteral(sb.ToString())); }
private void GridBind(string order) { string colspan = "7"; PanelGrid.Controls.Clear(); StringBuilder sb = new StringBuilder(); sb.Append("<table cellspacing=\"2\" cellpadding=\"4\" class=\"tblist\">"); t03_projeto t03 = new t03_projeto(); { t03.t01_cd_entidade = cd_entidade; //somente a entidade do parceiro foreach (DataRow dre in t03.ListEntidadeAdm().Tables[0].Rows) { sb.Append("<tr class=\"hr_white\">"); sb.Append("<td colspan='" + colspan + "'>" + dre["nm_entidade"] + "</td>"); sb.Append("</tr>"); t03.t01_cd_entidade = Int32.Parse(dre["t01_cd_entidade"].ToString()); foreach (DataRow drt in t03.ListTipologia().Tables[0].Rows) { sb.Append("<tr class=\"hr_yellow\">"); sb.Append("<td colspan='" + colspan + "'>" + drt["nm_tipologia"] + "</td>"); sb.Append("</tr>"); sb.Append("<tr class=\"hr_orange\">"); sb.Append("<td style='width:1%'> </td>"); sb.Append("<td style='width:1%'> </td>"); sb.Append("<td>Programas</td>"); sb.Append("<td>Fase</td>"); sb.Append("<td>Atualizado</td>"); sb.Append("<td>Restrição</td>"); sb.Append("<td style='width:120px'>Evolução</td>"); sb.Append("</tr>"); t03.order = "where fl_ativa=1"+ " and t01_cd_entidade=" + dre["t01_cd_entidade"].ToString() + " and t04_cd_tipologia=" + drt["t04_cd_tipologia"].ToString() + " order by nm_projeto"; foreach (DataRow drp in t03.List().Tables[0].Rows) { string nm_projeto = drp["nm_projeto"].ToString(); string nm_fase = ""; string data = "-"; t19_fase t19 = new t19_fase(); { t19.t19_cd_fase = Int32.Parse(drp["t03_cd_projeto"].ToString()); //usando o t19_cd_fase para armazenar t03_cd_projeto; t19.RetrieveFaseProjeto(); if (t19.Found) { nm_fase = t19.nm_fase; } } sb.Append("<tr>"); PanelGrid.Controls.Add(pb.GetLiteral(sb.ToString())); PanelGrid.Controls.Add(pb.GetLiteral("<td>")); ImageButton btne = new ImageButton(); btne.ID = "ImageButton1_" + drp["t03_cd_projeto"].ToString(); btne.CommandArgument = drp["t03_cd_projeto"].ToString(); btne.ImageUrl = "~/images/ico_exc.gif"; btne.ToolTip = "Excluir"; btne.OnClientClick = "javascript:return confirm('Tem certeza que deseja excluir?')"; btne.Click += new ImageClickEventHandler(Delete_Click); PanelGrid.Controls.Add(btne); //Adiciona o botão de exclusão PanelGrid.Controls.Add(pb.GetLiteral("</td><td>")); btne = new ImageButton(); btne.ID = "ImageButton2_" + drp["t03_cd_projeto"].ToString(); btne.CommandArgument = drp["t03_cd_projeto"].ToString(); btne.ImageUrl = "~/images/ico_edit.gif"; btne.ToolTip = "Editar"; btne.Click += new ImageClickEventHandler(Edit_Click); PanelGrid.Controls.Add(btne); //Adiciona o botão de edição PanelGrid.Controls.Add(pb.GetLiteral("</td>")); PanelGrid.Controls.Add(pb.GetLiteral("<td>")); LinkButton link = new LinkButton(); { link.ID = "link" + drp["t03_cd_projeto"].ToString(); link.CommandArgument = drp["t03_cd_projeto"].ToString(); link.Text = nm_projeto; link.Click +=new EventHandler(link_Click); } PanelGrid.Controls.Add(link); PanelGrid.Controls.Add(pb.GetLiteral("</td>"));//Projeto sb = new StringBuilder(); sb.Append("<td>" + nm_fase + "</td>"); //Fase sb.Append("<td>" + data + "</td>"); //Atualizado sb = new StringBuilder(); sb.Append("<td>" + nm_fase + "</td>"); //Fase sb.Append("<td style='text-align:center'>" + data + "</td>"); //Atualizado t07_restricao t07 = new t07_restricao(); { t07.t03_cd_projeto = Int32.Parse(drp["t03_cd_projeto"].ToString()); if (t07.List().Tables[0].Rows.Count == 0) { sb.Append("<td> </td>"); //Restrição } else { sb.Append("<td style='text-align:center'><b>R</b></td>"); //Restrição } } sb.Append("<td>" + pb.Status(Int32.Parse(drp["t03_cd_projeto"].ToString())) + "</td>"); //Evolução sb.Append("</tr>"); } } } sb.Append("</table>"); } PanelGrid.Controls.Add(pb.GetLiteral(sb.ToString())); }
private void Retrieve() { t07_restricao t07 = new t07_restricao(); { t07.t07_cd_restricao = Int32.Parse(cod.Value); t07.Retrieve(); if (t07.Found) { txtds_restricao.Text = t07.ds_restricao; txtds_medida.Text = t07.ds_medida; txtdt_limite.Text = t07.dt_limite.ToShortDateString(); ddlt08_cd_acao.ClearSelection(); t29_acaorestricao t29 = new t29_acaorestricao(); { t29.t07_cd_restricao = t07.t07_cd_restricao; t29.Retrieve(); if (t29.Found) { ListItem li = ddlt08_cd_acao.Items.FindByValue(t29.t08_cd_acao.ToString()); if (li != null) li.Selected = true; } else { cbProjeto.Checked = true; } } } } }
private void GridBind() { t07_restricao t07 = new t07_restricao(); { t07.t03_cd_projeto = pb.cd_projeto(); t07.order = "order by " + ViewState["campo"].ToString() + " " + ViewState["sentido"].ToString(); GridView1.DataSource = t07.List(); GridView1.DataBind(); } }
protected void btnAcao_Click(object sender, System.EventArgs e) { t07_restricao t07 = new t07_restricao(); { bool result = false; bool erro = false; string msg = ""; t07.t03_cd_projeto = pb.cd_projeto(); t07.ds_restricao = pb.ReplaceAspas(txtds_restricao.Text); t07.ds_medida = pb.ReplaceAspas(txtds_medida.Text); t07.dt_limite = DateTime.Parse(txtdt_limite.Text); t07.dt_cadastro = DateTime.Now; t07.dt_alterado = DateTime.Now; if ((ddlt08_cd_acao.SelectedValue == "") && (!cbProjeto.Checked)) { erro = true; msg = pb.Message("É necessário selecionar uma ação ou marcar a opção Restrição vinculada ao projeto, antes de continuar.", "erro"); btnAcao.Focus(); } else if ((ddlt08_cd_acao.SelectedValue != "") && (cbProjeto.Checked)) { erro = true; msg = pb.Message("Favor escolher somente uma das opções: Ação relacionada ou Restrição vinculada ao projeto, antes de continuar.", "erro"); btnAcao.Focus(); } if (!(erro)) { if (cod.Value != "0") { t07.t07_cd_restricao = Int32.Parse(cod.Value); result = t07.Update(); msg = "Alteração realizada com sucesso!"; pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t07_restricao", "update", cod.Value); } else { result = t07.Save(); msg = "Cadastro realizado com sucesso!"; pb.criarEmail(pb.cd_projeto(), txtds_restricao.Text); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t07_restricao", "insert", t07.ds_restricao); } if (result) { if (cod.Value == "0") { t07.RetrieveCod(); if (t07.Found) cod.Value = t07.t07_cd_restricao.ToString(); } if (!cbProjeto.Checked) { t29_acaorestricao t29 = new t29_acaorestricao(); { t29.t07_cd_restricao = Int32.Parse(cod.Value); t29.t08_cd_acao = Int32.Parse(ddlt08_cd_acao.SelectedValue); t29.Delete(); t29.Save(); } } } Ocultar(); GridBind(); cod.Value = "0"; Response.Redirect("Gerenciamento.aspx?msg=" + msg); } lblMsg.Text = msg; lblMsg.Visible = true; } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { bool redirect = false; string msg = ""; try { GridView gv = (GridView)sender; int cd = Int32.Parse(gv.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Value.ToString()); switch (e.CommandName.Trim()) { case "Superada": t07_restricao t07 = new t07_restricao(); { t07.t07_cd_restricao = cd; t07.dt_superada = DateTime.Now; t07.dt_alterado = DateTime.Now; t07.UpdateSuperar(); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "superou a restrição", "t07_restricao", "update", t07.t07_cd_restricao.ToString()); } t29_acaorestricao t29 = new t29_acaorestricao(); { t29.t07_cd_restricao = cd; t29.Delete(); } GridBind(); msg = "Restrição superada com sucesso!"; break; case "Selecionar": Context.Items["t07_cd_restricao"] = cd.ToString(); Server.Transfer("~/Restricao.aspx", false); break; case "Editar": Exibir(); this.lblHeader.Text = "Alteração"; this.btnAcao.Text = "Alterar"; btnAcao.Focus(); cod.Value = cd.ToString(); Retrieve(); break; case "Deletar": t07 = new t07_restricao(); { t07.t07_cd_restricao = cd; t07.Delete(); pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t07_restricao", "delete", t07.t07_cd_restricao.ToString()); } t29 = new t29_acaorestricao(); { t29.t07_cd_restricao = cd; t29.Delete(); } GridBind(); msg = "Exclusão realizada com sucesso!"; redirect = true; break; } } catch (Exception ex) { lblMsg.Text = pb.Message(ex.Message, "erro"); lblMsg.Visible = true; } if (msg.Length > 1) { lblMsg.Text = pb.Message(msg, "ok"); lblMsg.Visible = true; } if (redirect) { Response.Redirect("Gerenciamento.aspx?msg=" + msg); } }