示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UsuarioOnline"] == null)
        {
            Response.Redirect("~/Views/Login.aspx");
        }
        else
        {
            Usuario user = (Usuario)Session["UsuarioOnline"];
            if (user.Tipo_Usuario != 1)
            {
                Response.Redirect("~/Views/Logout.aspx");
            }
        }

        if (!Page.IsPostBack)
        {
            List <Problema> problemas = Problema.carregarProblemas();
            foreach (Problema problema in problemas)
            {
                selProblema.Items.Add(new ListItem(problema.TituloProblema, problema.IdProblema.ToString()));
            }
        }

        if (selProblema.SelectedIndex > -1)
        {
            carregarQuestoes(int.Parse(selProblema.SelectedValue));
        }
    }
示例#2
0
    private void carregarProblemas()
    {
        //carregar problemas
        panelProblemas.Controls.Clear();
        Table table = new Table();

        table.CssClass = "superFancyTable";
        TableHeaderRow  hr  = new TableHeaderRow();
        TableHeaderCell hc1 = new TableHeaderCell();
        TableHeaderCell hc2 = new TableHeaderCell();
        TableHeaderCell hc3 = new TableHeaderCell();

        hc1.Text = "Problema";
        hc2.Text = "Descrição";
        hr.Controls.Add(hc1);
        hr.Controls.Add(hc2);
        hr.Controls.Add(hc3);
        table.Controls.Add(hr);
        List <Problema> problemas = Problema.carregarProblemas();

        foreach (Problema problema in problemas)
        {
            TableRow  row           = new TableRow();
            TableCell cellNome      = new TableCell();
            TableCell cellDescricao = new TableCell();
            TableCell cellToolbar   = new TableCell();

            //prepara toolbar
            //prepara toolbar
            HyperLink          linkApagar = new HyperLink();
            HyperLink          linkEditar = new HyperLink();
            HtmlGenericControl editar     = new HtmlGenericControl("span");
            HtmlGenericControl apagar     = new HtmlGenericControl("span");
            linkApagar.NavigateUrl     = "javascript:apagarProblema(" + problema.IdProblema + ");";
            linkEditar.NavigateUrl     = "javascript:editarProblema(" + problema.IdProblema + ");";
            editar.Attributes["class"] = "glyphicon glyphicon-pencil ";
            apagar.Attributes["class"] = "glyphicon glyphicon-trash";
            linkApagar.Controls.Add(apagar);
            linkEditar.Controls.Add(editar);
            linkEditar.Attributes.CssStyle.Add("margin-right", "10px;");
            cellToolbar.Attributes["class"] = "text-center";
            cellToolbar.Controls.Add(linkEditar);
            cellToolbar.Controls.Add(linkApagar);

            cellNome.Text      = problema.TituloProblema;
            cellNome.ID        = "titulo" + problema.IdProblema;
            cellDescricao.Text = problema.DescricaoProblema;
            cellDescricao.ID   = "descricao" + problema.IdProblema;

            row.Controls.Add(cellNome);
            row.Controls.Add(cellDescricao);
            row.Controls.Add(cellToolbar);

            table.Controls.Add(row);
        }
        panelProblemas.Controls.Add(table);
    }
示例#3
0
    private void carregarProblemas()
    {
        //carregar problemas
        panelProblemas.Controls.Clear();
        Table table = new Table();

        table.CssClass = "superFancyTable";
        TableHeaderRow  hr  = new TableHeaderRow();
        TableHeaderCell hc0 = new TableHeaderCell();
        TableHeaderCell hc1 = new TableHeaderCell();
        TableHeaderCell hc3 = new TableHeaderCell();

        hc1.Text = "Problema";
        hr.Controls.Add(hc0);
        hr.Controls.Add(hc1);
        hr.Controls.Add(hc3);
        table.Controls.Add(hr);
        List <Problema> problemas = Problema.carregarProblemas();

        foreach (Problema problema in problemas)
        {
            TableRow  row          = new TableRow();
            TableCell cellProblema = new TableCell();
            TableCell cellToolbar  = new TableCell();
            TableCell cellInicio   = new TableCell();

            //prepara botões
            HyperLink linkDetalhes = new HyperLink();
            HyperLink linkIniciar  = new HyperLink();
            linkIniciar.NavigateUrl  = ResolveUrl("~/Views/IniciarProblema.aspx") + "?p=" + problema.IdProblema;
            linkDetalhes.NavigateUrl = ResolveUrl("~/Views/DetalheProblema.aspx") + "?codigo=" + problema.IdProblema;
            linkIniciar.CssClass     = "btn btn-success";
            linkDetalhes.CssClass    = "btn btn-primary";
            linkIniciar.Text         = "Iniciar";
            linkDetalhes.Text        = "Detalhes";
            cellInicio.Controls.Add(linkIniciar);
            cellToolbar.Controls.Add(linkDetalhes);

            cellProblema.Text     = "<p style='font-size:110%;font-weight:bold;' >" + problema.TituloProblema + "</p>" + problema.DescricaoProblema;
            cellProblema.CssClass = "text-left";
            cellToolbar.CssClass  = "text-center";

            row.Controls.Add(cellInicio);
            row.Controls.Add(cellProblema);
            row.Controls.Add(cellToolbar);

            table.Controls.Add(row);
        }
        panelProblemas.Controls.Add(table);
    }