Beispiel #1
0
        protected void gridFADN_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            DataTable mostra = new DataTable();

            mostra = boton.BotonReadUsuario(Session["Usuario"].ToString(), "PE1: GAD");

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                gridFADN.Columns[0].Visible = true;

                (e.Row.FindControl("btEditar") as LinkButton).Visible      = false;
                (e.Row.FindControl("btVer") as LinkButton).Visible         = false;
                (e.Row.FindControl("btEliminar") as LinkButton).Visible    = false;
                (e.Row.FindControl("btObservacion") as LinkButton).Visible = false;
                (e.Row.FindControl("btAprobar") as LinkButton).Visible     = false;
                (e.Row.FindControl("btEnviar") as LinkButton).Visible      = false;

                if (int.Parse(e.Row.Cells[0].Text) > 0)
                {
                    for (int j = 0; j < mostra.Rows.Count; j++)
                    {
                        switch (mostra.Rows[j][0].ToString())
                        {
                        case "Guardar":
                            break;

                        case "Editar":
                            if (pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 2)
                            {
                                (e.Row.FindControl("btEditar") as LinkButton).Visible = true;
                            }
                            break;

                        case "Ver":
                            if (obs.ObservacionCEFADNExiste(int.Parse(e.Row.Cells[0].Text), 24) == true ||
                                obs.ObservacionAcompaniamientoExiste(int.Parse(e.Row.Cells[0].Text), 24) == true ||
                                obs.ObservacionEvaluadorExiste(int.Parse(e.Row.Cells[0].Text), 24) == true)
                            {
                                (e.Row.FindControl("btVer") as LinkButton).Visible = true;
                            }
                            break;

                        case "Eliminar":
                            if (pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 1 || pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 2)
                            {
                                (e.Row.FindControl("btEliminar") as LinkButton).Visible = true;
                            }
                            break;

                        case "Enviar":
                            if (pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 1 ||
                                pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 2 ||
                                pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 3 ||
                                pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 6 ||
                                pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 9)
                            {
                                (e.Row.FindControl("btEnviar") as LinkButton).Visible = true;
                            }
                            break;

                        case "Aprobar":
                            if (pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 3 || pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 9)
                            {
                                (e.Row.FindControl("btAprobar") as LinkButton).Visible = true;
                            }

                            break;

                        case "Observación":
                            if (pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 3 ||
                                pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 6 ||
                                pat.PE1Estado(int.Parse(e.Row.Cells[0].Text)) == 9)
                            {
                                (e.Row.FindControl("btObservacion") as LinkButton).Visible = true;
                            }
                            break;
                        }
                    }
                }
            }
        }