Exemplo n.º 1
0
 protected void gvEst_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     allelist         = ForumEstablishmentDB.getAllForumEstablishment();
     gvEst.PageIndex  = e.NewPageIndex;
     gvEst.DataSource = allelist;
     gvEst.DataBind();
 }
Exemplo n.º 2
0
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlFBChoose.SelectedIndex == 0)
        {
            panelEst.Visible    = false;
            panelUser.Visible   = false;
            Panel1.Visible      = false;
            lblSelectError.Text = "";
        }

        else if (ddlFBChoose.SelectedIndex == 1)
        {
            allflist = ForumUserDB.getAllForumUser();

            if (allflist.Count == 0)
            {
                lblSelectError.Text = "Sorry there is no forum by User found in the moment!";
                panelUser.Visible   = false;
                panelEst.Visible    = false;
            }
            else
            {
                panelUser.Visible = true;
                panelEst.Visible  = false;
                Panel1.Visible    = false;
                gvUser.DataSource = allflist;
                gvUser.DataBind();
                lblSelectError.Text = "The are " + allflist.Count + " Forum posted by Users found!";
                Session["u"]        = "user";
                Session["e"]        = null;
            }
        }
        else
        {
            allelist = ForumEstablishmentDB.getAllForumEstablishment();

            if (allelist.Count == 0)
            {
                lblSelectError.Text = "Sorry there is no forum by Establishment found in the moment!";
                panelUser.Visible   = false;
                panelEst.Visible    = false;
            }
            else
            {
                panelUser.Visible = false;
                panelEst.Visible  = true;
                Panel1.Visible    = false;
                gvEst.DataSource  = allelist;
                gvEst.DataBind();
                lblSelectError.Text = "The are " + allelist.Count + " Forum posted by Establishment found!";
                Session["u"]        = null;
                Session["e"]        = "est";
            }
        }
    }
Exemplo n.º 3
0
    protected void gvEst_SelectedIndexChanged1(object sender, EventArgs e)
    {
        List <tempcomment> tclist = new List <tempcomment>();

        Panel1.Visible = true;
        allelist       = ForumEstablishmentDB.getAllForumEstablishment();
        ForumEstablishment fe = allelist[gvEst.PageSize * gvEst.PageIndex + gvEst.SelectedIndex];

        gvEst.SelectedIndex = -1;
        Session["forumID"]  = fe.forumID;
        lbltitle.Text       = fe.Title;
        lblmessage.Text     = fe.message;
        lblUser.Text        = fe.estID.ID;
        lblDate.Text        = string.Format("{0:dd/MM/yyyy}", fe.date);

        List <ForumEstCommentbyUser> fecu = ForumEstCommentbyUserDB.getoneForumAllCommentbyID(fe.forumID);
        List <ForumEstCommentbyEst>  fece = ForumEstCommentbyEstDB.getoneForumAllCommentbyID(fe.forumID);

        foreach (ForumEstCommentbyUser f in fecu)
        {
            tempcomment tc = new tempcomment();
            tc.comentID  = f.forumcommentID;
            tc.comment   = f.comments;
            tc.commentby = f.commentby.name.ToString();
            tc.time      = f.date;
            tc.status    = f.status;
            tc.timeshow  = datesub(f.date);
            tclist.Add(tc);
        }

        foreach (ForumEstCommentbyEst g in fece)
        {
            tempcomment tc = new tempcomment();
            tc.comentID  = g.forumcommentID;
            tc.comment   = g.comments;
            tc.commentby = g.commentby.Name.ToString();
            tc.time      = g.date;
            tc.status    = g.status;
            tc.timeshow  = datesub(g.date);
            tclist.Add(tc);
        }

        if (tclist.Count == 0)
        {
            lblNotFound.Visible = true;
        }
        else
        {
            tclist = tclist.OrderBy(x => x.time).ToList();
            tclist.Reverse();
            lblNotFound.Visible  = false;
            GridView1.DataSource = tclist;
            GridView1.DataBind();
        }
    }