Esempio n. 1
0
        protected void btnFiltrar_Click(object sender, EventArgs e)
        {
            cu.Nome                = txtFiltro.Text;
            cu.IdProfessor         = Convert.ToInt32(Session["idprof"]);
            gvResultado.DataSource = cuDAL.Listar(cu);
            gvResultado.DataBind();

            txtFiltro.Text = "";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string html = "";
            int    qtd  = 0;

            System.Data.DataTable dt = cuDAL.Listar();
            html += "<table style='width: 100 % '><tr>";

            //Laço para Rodar todas as linhas que retornam da select do BD
            for (int lin = 0; lin < dt.Rows.Count; lin++)
            {
                if (qtd == 3)
                {
                    html += "<tr>";
                    qtd   = 0;
                }

                html += "<td style='width: 100%'>";
                html += "<div class='container'>";
                html += "<div class='card'>";
                html += "<div class='face face1'>";
                html += "<div class='content'>";
                html += "<img src='" + dt.Rows[lin].ItemArray[1].ToString() + "' />";                           //imagem
                html += "<h3>" + dt.Rows[lin].ItemArray[2].ToString() + " </h3>";                               //nome
                html += "<h5><br/>R$" + dt.Rows[lin].ItemArray[3].ToString().Replace(",0000", "") + ",00</h5>"; //valor
                html += "</div>";
                html += "</div>";
                html += "<div class='face face2'>";
                html += "<div class='content'>";
                html += "<p>(" + dt.Rows[lin].ItemArray[4].ToString() + "h)";      //horas
                html += "<br/>" + dt.Rows[lin].ItemArray[5].ToString() + "</ p >"; //descrição
                html += "<br/><center><a href='Carrinho.aspx?id='" + dt.Rows[lin].ItemArray[0].ToString() + ">Comprar</center></a>";
                html += "</div>";
                html += "</div>";
                html += "</div>";
                html += "</div>";
                html += "</td>";
                qtd++;

                if (qtd == 3)
                {
                    html += "</tr>";
                }
            }

            html += "</tr></table>";

            litConteudo.Text = html;
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["usuario"] != null)
                {
                    if (Session["usuario"].ToString() != string.Empty)
                    {
                        gvResultado.DataSource = cuDAL.Listar();
                        gvResultado.DataBind();



                        if (Request.QueryString["id"] != null)
                        {
                            if (Request.QueryString["id"].ToString() != "")
                            {
                                int idRecebido;
                                int.TryParse(Request.QueryString["id"], out idRecebido);

                                cu.IdCurso = idRecebido;
                                cu         = cuDAL.PreencherPeloID1(cu);

                                if (cu.IdCurso != 0)
                                {
                                    lblAtu.Visible       = true;
                                    lblId.Visible        = true;
                                    lblIsso.Visible      = true;
                                    lblCad.Visible       = false;
                                    Image1.Visible       = true;
                                    btnAtualizar.Visible = true;
                                    btnEnviar.Visible    = false;
                                    gvResultado.Visible  = false;
                                    txtFiltro.Visible    = false;
                                    btnFiltrar.Visible   = false;

                                    Image1.ImageUrl = cu.Imagem;

                                    lblId.Text        = cu.IdCurso.ToString();
                                    txtNome.Text      = cu.Nome;
                                    txtValor.Text     = cu.Valor.ToString();
                                    txtHoras.Text     = cu.Horas;
                                    txtDescricao.Text = cu.Descricao;
                                }
                                else
                                {
                                    lblId.Text = "ID INVÁLIDO";
                                }
                            }
                            else
                            {
                                lblId.Text = "ID INVÁLIDO";
                            }
                        }
                        else
                        {
                            lblId.Text = "ID INVÁLIDO";
                        }
                    }
                    else
                    {
                        Response.Redirect("LoginAdm.aspx");
                    }
                }
                else
                {
                    Response.Redirect("LoginAdm.aspx");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["usuario"] != null)
                {
                    if (Session["usuario"].ToString() != string.Empty)
                    {
                        ddlCurso.DataSource = cuDAL.Listar();

                        ddlCurso.DataTextField  = "Nome";
                        ddlCurso.DataValueField = "Id_Curso";

                        ddlCurso.DataBind();

                        gvQuizz.DataSource = zzDAL.Listar();
                        gvQuizz.DataBind();

                        if (Request.QueryString["id"] != null)
                        {
                            if (Request.QueryString["id"].ToString() != "")
                            {
                                int idRecebido;
                                int.TryParse(Request.QueryString["id"], out idRecebido);

                                zz.IdQuizz = idRecebido;
                                zz         = zzDAL.PreencherPeloID(zz);

                                if (zz.IdQuizz != 0)
                                {
                                    //mudar visibilidade
                                    lblAtu.Visible       = true;
                                    lblCad.Visible       = false;
                                    lblId.Visible        = true;
                                    lblIsso.Visible      = true;
                                    ddlCurso.Visible     = false;
                                    btnEnviar.Visible    = false;
                                    btnAtualizar.Visible = true;
                                    gvQuizz.Visible      = false;
                                    txtFiltro.Visible    = false;
                                    btnFiltrar.Visible   = false;

                                    lblId.Text   = zz.IdQuizz.ToString();
                                    lblIdC.Text  = zz.IdCurso.ToString();
                                    txtNome.Text = zz.Nome;
                                }
                                else
                                {
                                    lblId.Text = "ID INVÁLIDO";
                                }
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("LoginAdm.aspx");
                    }
                }
                else
                {
                    Response.Redirect("LoginAdm.aspx");
                }
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["usuario"] != null)
                {
                    if (Session["usuario"].ToString() != string.Empty)
                    {
                        ddlCurso.DataSource = cuDAL.Listar();

                        ddlCurso.DataTextField  = "Nome";
                        ddlCurso.DataValueField = "Id_Curso";

                        ddlCurso.DataBind();

                        gvResultado.DataSource = auDAL.Listar();
                        gvResultado.DataBind();
                        if (Request.QueryString["id"] != null)
                        {
                            if (Request.QueryString["id"].ToString() != "")
                            {
                                int idRecebido;
                                int.TryParse(Request.QueryString["id"], out idRecebido);

                                au.IdAula = idRecebido;
                                au        = auDAL.PreencherPeloID1(au);

                                if (au.IdAula != 0)
                                {
                                    lblAtu.Visible       = true;
                                    lblId.Visible        = true;
                                    lblIsso.Visible      = true;
                                    lblCad.Visible       = false;
                                    litPDF.Visible       = true;
                                    btnAtualizar.Visible = true;
                                    ddlCurso.Visible     = false;
                                    btnCadastrar.Visible = false;
                                    gvResultado.Visible  = false;
                                    txtFiltro.Visible    = false;
                                    btnFiltrar.Visible   = false;
                                    ////////////////////////////////////////////////////////////////////////////////////////

                                    //Apresentar o PDF

                                    string html = "";

                                    html += "<a href='" + au.Material + "' target='_blank'>Material</a>";


                                    litPDF.Text = html;
                                    ///////////////////////////////////////////////////////////////////////////////////////
                                    lblId.Text        = au.IdAula.ToString();
                                    txtNome.Text      = au.Nome;
                                    txtVideo.Text     = au.Video;
                                    txtDescricao.Text = au.Descricao;
                                    lblId1.Text       = au.IdCurso.ToString();
                                }
                                else
                                {
                                    lblId.Text = "ID INVÁLIDO";
                                }
                            }
                            else
                            {
                                lblId.Text = "ID INVÁLIDO";
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("LoginAdm.aspx");
                    }
                }
                else
                {
                    Response.Redirect("LoginAdm.aspx");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["usuario"] != null)
                {
                    if (Session["usuario"].ToString() != string.Empty)
                    {
                        Response.Write("<script>alert('Bem-vindo, " + Session["usuario"] + "')</script>");

                        alu.IdLogin = Convert.ToInt32(Session["idlogin"]);
                        alu         = aluDAL.PreencherPeloID(alu);

                        Session.Add("idaluno", alu.IdAluno);

                        string html = "";
                        int    qtd  = 0;
                        //pega o id do usuario e faz um listar por ele
                        System.Data.DataTable dt = cuDAL.Listar();
                        html += "<table style='width: 100 % '><tr>";

                        //Laço para Rodar todas as linhas que retornam da select do BD
                        for (int lin = 0; lin < dt.Rows.Count; lin++)
                        {
                            if (qtd == 4)
                            {
                                html += "<tr>";
                                qtd   = 0;
                            }

                            html += "<td style='width: 100%'>";
                            //html += "<div class='container'>";



                            html += "<div class='card'>";
                            html += "<img class='card__image' src='" + dt.Rows[lin].ItemArray[1].ToString() + "'  alt='wave'/>"; //imagem
                            html += "<div class='card-title'>";
                            html += "<a href='#' class='toggle-info btn'>";
                            html += "<span class='left'></span>";
                            html += "<span class='right'></span>";
                            html += "</a><br/>";
                            html += "<h2>" + dt.Rows[lin].ItemArray[2].ToString(); //nome
                            html += "</h2>";
                            html += "</div>";
                            html += "<div class='card-flap flap1'>";
                            html += "<div class='card-description'>";
                            html += dt.Rows[lin].ItemArray[5].ToString(); //descrição
                            html += "</div>";
                            html += "<div class='card-flap flap2'>";
                            html += "<div class='card-actions'>";
                            html += "<a href = 'Cursos.aspx' class='btn'>Estudar</a>"; //fazer botão com id
                            html += "</div>";
                            html += "</div>";
                            html += "</div>";
                            html += "</div>";


                            //html += "</div>";
                            html += "</td>";
                            qtd++;

                            if (qtd == 4)
                            {
                                html += "</tr>";
                            }
                        }

                        html += "</tr></table>";

                        litCurso.Text = html;
                    }
                    else
                    {
                        Response.Redirect("../EXTERNO/Login.aspx");
                    }
                }
                else
                {
                    Response.Redirect("../EXTERNO/Login.aspx");
                }
            }
        }