protected void Page_Load(object sender, EventArgs e) { if (Session["establishment"] == null) { Server.Transfer("CommonLogin.aspx"); } else { List <Chat> clist = ChatDB.getallChat(); foreach (Chat ch in clist) { Users s = UsersDB.getUserbyID(ch.by); if (s.email == null) { Establishment es = EstablishmentDB.getEstablishmentByID(ch.by); if (ch.status == "allow") { tbxChat.Text += es.Name + " @ " + ch.time + " : " + ch.message + "\r\n"; } } else { if (ch.status == "allow") { tbxChat.Text += s.username + " @ " + ch.time + " : " + ch.message + "\r\n"; } } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["establishment"] == null) { Server.Transfer("Login.aspx"); } else { tbxChat.Text = ""; List <Chat> clist = ChatDB.getallChat(); foreach (Chat ch in clist) { Users s = UsersDB.getUserbyID(ch.by); if (s.email == null) { Establishment es = EstablishmentDB.getEstablishmentByID(ch.by); if (ch.status == "allow") { tbxChat.Text += es.Name + " @ " + ch.time + " : " + ch.message + "\r\n"; } } else { if (ch.status == "allow") { tbxChat.Text += s.username + " @ " + ch.time + " : " + ch.message + "\r\n"; } } } cnum = clist.Count; currente = (Establishment)(Session["establishment"]); lblOutputPost.Text = ""; List <ForumUser> flist = ForumUserDB.getAllForumUserbyStatus(); if (flist.Count == 0) { Panel1.Visible = false; lblGVOutput.Text = "There is no forum posted by user right now!"; } else { Panel1.Visible = true; gvUser.DataSource = flist; gvUser.DataBind(); lblGVOutput.Text = ""; } List <ForumEstablishment> elist = ForumEstablishmentDB.getAllForumEstbyStatus(); if (elist.Count == 0) { Panel2.Visible = false; lblGVEstOutput.Text = "There is no forum posted by establishment right now!"; } else { lblGVEstOutput.Text = ""; Panel2.Visible = true; gvEst.DataSource = elist; gvEst.DataBind(); } } }