예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            enter     obj    = new enter();
            DataTable d1     = new DataTable();
            int       userid = (int)Session["userid"];
            int       check  = obj.MsgPreview(userid, ref d1);

            if (check <= 0)
            {
                Label l = new Label();
                l.Text = "No messages to show yet";
                l.Attributes.Add("runat", "server");
                p.Controls.Add(l);
            }
            else
            {
                for (int i = 0; i < d1.Rows.Count; i++)
                {
                    DataTable temp = new DataTable();
                    int       x    = obj.Convo(userid, d1.Rows[i].Field <int>(0), ref temp);
                    if (x > 0)
                    {
                        LinkButton button = new LinkButton();
                        button.ID = button.UniqueID;
                        button.Attributes.Add("style", "font-size: 23px; color: white;");
                        int user2 = d1.Rows[i].Field <int>(0);
                        button.Text = obj.GetUser(user2);
                        DataTable convo = new DataTable();
                        convo         = temp;
                        button.Click += (se, ev) =>
                        {
                            Session["msgid"] = user2;
                            Session["Convo"] = convo;
                            Response.Redirect("talk.aspx?val=" + user2);
                        };
                        button.Attributes.Add("runat", "server");
                        int j = 0;
                        while (temp.Rows[j].Field <DateTime>(2).Subtract(d1.Rows[i].Field <DateTime>(1)).TotalMilliseconds > 0)
                        {
                            if (temp.Rows[j].Field <int>(0) == userid)
                            {
                                break;
                            }
                            j++;
                        }
                        Label notify = new Label();
                        notify.ID = notify.UniqueID;
                        Label message = new Label();
                        message.ID   = message.UniqueID;
                        message.Text = temp.Rows[0].Field <string>(1);
                        message.Attributes.Add("style", "font-size: 20px;");
                        message.Attributes.Add("runat", "server");
                        Label time = new Label();
                        time.ID = time.UniqueID;
                        time.Attributes.Add("style", "text-align: right;");
                        time.Text = "<sub>" + temp.Rows[0].Field <DateTime>(2) + "</sub>";
                        if (j > 0)
                        {
                            notify.Attributes.Add("style", "content:attr(data-badge); position: absolute; font-size:.7em; background: red; color: white; width: 18px; height: 18px; text-align:center; line-height:18px; border-radius:50%; box-shadow:0 0 1px #333;");
                            notify.Text += j;
                            p.Controls.Add(new LiteralControl("<div style=\"border: solid; border-color: azure; background-color: rgba(255, 216, 0,0.6); color: white; \">"));
                        }
                        else
                        {
                            p.Controls.Add(new LiteralControl("<div style=\"border: solid; border-color: azure; background-color: rgba(18, 12, 85, 0.6); color: white; \">"));
                        }
                        p.Controls.Add(button);
                        p.Controls.Add(notify);
                        p.Controls.Add(new LiteralControl("<br/>"));
                        p.Controls.Add(message);
                        p.Controls.Add(new LiteralControl("<br/>"));
                        p.Controls.Add(time);
                        p.Controls.Add(new LiteralControl("</div>"));
                        p.Controls.Add(new LiteralControl("<br/><br/>"));
                    }
                }
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            enter     obj    = new enter();
            string    search = (string)Session["searchstring"];
            string    myname = (string)Session["Uname"];
            int       myown  = (int)Session["userid"];
            DataTable DT     = new DataTable();
            DataTable DT2    = new DataTable();
            int       found  = obj.search(search, ref DT, ref DT2);

            if (found == -1)
            {
                Error.Text = "Your text did not yield any result";
            }
            else
            {
                foreach (DataRow row in DT2.Rows)
                {
                    if (search[0] == '#')
                    {
                        Label b1 = new Label();
                        b1.ID = b1.UniqueID;
                        b1.Attributes.Add("runat", "server");
                        b1.Attributes.Add("style", "font-family: Broadway;  font-size: 25px; color: #ffffff; background-color: midnightblue;");
                        b1.Text = row.Field <string>(0) + " (" + row.Field <int>(1) + ")";
                        ph.Controls.Add(b1);
                        ph.Controls.Add(new LiteralControl("<br/><br/>"));
                    }
                }
                ph.Controls.Add(new LiteralControl("<br/><br/>"));
                foreach (DataRow row in DT.Rows)
                {
                    if (search[0] == '#')
                    {
                        Label  b2       = new Label();
                        string thetweet = obj.GetATweet(row.Field <int>(0));
                        int    idofuser = obj.GetUserIDfromTweet(row.Field <int>(0));
                        string name     = obj.GetUser(idofuser);
                        Button bu       = new Button();
                        bu.ID = bu.UniqueID;
                        bu.Attributes.Add("style", "font-family: Broadway;  font-size: 25px; color: black; background-color:rgba(18, 12, 85, 0.6);");

                        bu.Attributes.Add("runat", "server");

                        bu.Text = name;
                        if (bu.Text == myname)
                        {
                            bu.Click += (se, ev) =>
                            {
                                Response.Redirect("profile.aspx?val=" + myown);
                            };
                        }
                        else
                        {
                            bu.Click += (se, ev) =>
                            {
                                int u = obj.GetUserID(name);
                                Session["uid"] = u;
                                Response.Redirect("user.aspx?val=" + u);
                            };
                        }
                        ph.Controls.Add(bu);
                        b2.ID = b2.UniqueID;
                        b2.Attributes.Add("style", "font-family: Times New Roman;font-size: 20px; border: solid; border-color: black; background-color: rgba(255, 216, 0,0.6); color: black; text-align: left;width:900px ");

                        b2.Attributes.Add("runat", "server");
                        b2.Text = thetweet;
                        ph.Controls.Add(b2);
                        ph.Controls.Add(new LiteralControl("<br/><br/><br/><br/><br/>"));
                    }
                    else
                    {
                        bool   checkfollow = false;
                        Button b1          = new Button();
                        b1.ID = b1.UniqueID;
                        b1.Attributes.Add("runat", "server");
                        b1.Attributes.Add("style", "font-family: Broadway;  font-size: 25px; color: black; background-color:rgba(18, 12, 85, 0.6);");

                        b1.Text = row.Field <string>(0);
                        int u = obj.GetUserID(b1.Text);
                        if (u == myown)
                        {
                            b1.Click += (ser, eve) =>
                            {
                                Response.Redirect("profile.aspx?val=" + myown);
                            };
                            ph.Controls.Add(b1);
                        }
                        else
                        {
                            ph.Controls.Add(new LiteralControl("<br/>"));
                            ph.Controls.Add(new LiteralControl("<br/>"));

                            b1.Click += (ser, eve) =>
                            {
                                Session["uid"] = u;
                                Response.Redirect("user.aspx?val=" + u);
                            };

                            ph.Controls.Add(b1);
                            ph.Controls.Add(new LiteralControl("&nbsp &nbsp &nbsp"));

                            Button b2 = new Button();
                            b2.ID = b2.UniqueID;
                            b2.Attributes.Add("runat", "server");
                            b2.Attributes.Add("style", "font-family: Times New Roman;font-size: 20px; border: solid; border-color: black; background-color: rgba(255, 216, 0,0.6); color: black; text-align: left;width:130px ");

                            obj.checkifcollowing(myown, u, ref checkfollow);
                            if (checkfollow == false)
                            {
                                b2.Text = "FOLLOW ";
                            }
                            else
                            {
                                b2.Text = "UNFOLLOW ";
                            }

                            b2.Click += (se, ev) =>
                            {
                                bool ret = false;
                                int  f   = obj.enterfollow(myown, u, ref ret);
                                if (f != -1)
                                {
                                    if (!ret)
                                    {
                                        b2.Text = "UNFOLLOW ";
                                    }
                                    else
                                    {
                                        b2.Text = "FOLLOW ";
                                    }
                                }
                            };

                            ph.Controls.Add(b2);
                            ph.Controls.Add(new LiteralControl("<br/>"));
                        }
                    }
                }
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            enter     obj    = new enter();
            DataTable d1     = new DataTable();
            int       userid = (int)Session["userid"];
            int       y      = obj.UpdateLastSeen_Notif(userid);
            int       check  = obj.GetNotif(userid, ref d1);

            if (check <= 0)
            {
                Label l = new Label();
                l.Text = "No Notifications to show" + check;
                l.Attributes.Add("runat", "server");
                p.Controls.Add(l);
            }
            else
            {
                for (int i = 0; i < d1.Rows.Count; i++)
                {
                    Label notify = new Label();
                    notify.ID = notify.UniqueID;
                    int        uid      = d1.Rows[i].Field <int>(0);
                    string     username = obj.GetUser(uid);
                    LinkButton button1  = new LinkButton();
                    button1.ID = button1.UniqueID;
                    button1.Attributes.Add("runat", "server");
                    p.Controls.Add(new LiteralControl("<div style=\"border: solid; border-color: azure; background-color: rgba(255, 216, 0,0.6); color: white; \">"));
                    notify.Attributes.Add("style", "font-size: 30px;");
                    notify.Attributes.Add("runat", "server");
                    //notify.Attributes.Add("Width", "561px");
                    button1.Attributes.Add("style", "font-size: 30px;");
                    //button1.Attributes.Add("Width", "561px");
                    int tid = d1.Rows[i].Field <int>(1);
                    if (d1.Rows[i].Field <string>(3) == "like")
                    {
                        button1.Text   = "@" + username;
                        button1.Click += (se, ev) =>
                        {
                            Session["uid"] = uid;
                            Response.Redirect("user.aspx?val=" + uid);
                        };
                        notify.Text += " liked your ";
                        LinkButton button2 = new LinkButton();
                        button2.ID = button2.UniqueID;
                        button2.Attributes.Add("runat", "server");
                        button2.Attributes.Add("style", "font-size: 30px;");
                        //  button2.Attributes.Add("Width", "561px");
                        button2.Text   = "tweet.";
                        button2.Click += (se, ev) =>
                        {
                            Session["tweetid"] = tid;
                            Response.Redirect("tweet.aspx?val=" + uid);
                        };
                        p.Controls.Add(button1);
                        p.Controls.Add(notify);
                        p.Controls.Add(button2);
                    }
                    else if (d1.Rows[i].Field <string>(3) == "you followed")
                    {
                        button1.Text   = "@" + username;
                        button1.Click += (se, ev) =>
                        {
                            Session["uid"] = uid;
                            Response.Redirect("user.aspx?val=" + uid);
                        };
                        notify.Text = "You started Following ";

                        p.Controls.Add(notify);
                        p.Controls.Add(button1);
                    }
                    else if (d1.Rows[i].Field <string>(3) == "followed you")
                    {
                        button1.Text   = "@" + username;
                        button1.Click += (se, ev) =>
                        {
                            Session["uid"] = uid;
                            Response.Redirect("user.aspx?val=" + uid);
                        };
                        notify.Text = " started Following you.";
                        p.Controls.Add(button1);
                        p.Controls.Add(notify);
                    }
                    else if (d1.Rows[i].Field <string>(3) == "Comment")
                    {
                        button1.Text   = "@" + username;
                        button1.Click += (se, ev) =>
                        {
                            Session["uid"] = uid;
                            Response.Redirect("user.aspx?val=" + uid);
                        };
                        notify.Text = " Commented on your ";
                        LinkButton button2 = new LinkButton();
                        button2.ID = button2.UniqueID;
                        button2.Attributes.Add("runat", "server");
                        button2.Attributes.Add("style", "font-size: 30px;");
                        //  button2.Attributes.Add("Width", "561px");
                        button2.Text   = "tweet.";
                        button2.Click += (se, ev) =>
                        {
                            Session["tweetid"] = tid;
                            Response.Redirect("tweet.aspx?val=" + uid);
                        };
                        p.Controls.Add(button1);
                        p.Controls.Add(notify);
                        p.Controls.Add(button2);
                    }
                    else if (d1.Rows[i].Field <string>(3) == "ReTweet")
                    {
                        button1.Text   = username;
                        button1.Click += (se, ev) =>
                        {
                            Session["uid"] = uid;
                            Response.Redirect("user.aspx?val=" + uid);
                        };
                        notify.Text = " Retweeted your ";
                        LinkButton button2 = new LinkButton();
                        button2.ID = button2.UniqueID;
                        button2.Attributes.Add("runat", "server");
                        button2.Attributes.Add("style", "font-size: 30px;");
                        //  button2.Attributes.Add("Width", "561px");
                        button2.Text   = "tweet.";
                        button2.Click += (se, ev) =>
                        {
                            Session["tweetid"] = tid;
                            Response.Redirect("tweet.aspx?val=" + uid);
                        };
                        p.Controls.Add(button1);
                        p.Controls.Add(notify);
                        p.Controls.Add(button2);
                    }
                    else if (d1.Rows[i].Field <string>(3) == "Tag")
                    {
                        button1.Text   = username;
                        button1.Click += (se, ev) =>
                        {
                            Session["uid"] = uid;
                            Response.Redirect("user.aspx?val=" + uid);
                        };
                        notify.Text = " Tagged you in their ";
                        LinkButton button2 = new LinkButton();
                        button2.ID = button2.UniqueID;
                        button2.Attributes.Add("runat", "server");
                        button2.Attributes.Add("style", "font-size: 30px;");
                        //  button2.Attributes.Add("Width", "561px");
                        button2.Text   = "tweet.";
                        button2.Click += (se, ev) =>
                        {
                            Session["tweetid"] = tid;
                            Response.Redirect("tweet.aspx?val=" + uid);
                        };
                        p.Controls.Add(button1);
                        p.Controls.Add(notify);
                        p.Controls.Add(button2);
                    }
                    else if (d1.Rows[i].Field <string>(3) == "Message")
                    {
                        button1.Text   = username;
                        button1.Click += (se, ev) =>
                        {
                            Session["uid"] = uid;
                            Response.Redirect("user.aspx?val=" + uid);
                        };
                        notify.Text = " sent you a secret Message.";
                        p.Controls.Add(button1);
                        p.Controls.Add(notify);
                    }
                    p.Controls.Add(new LiteralControl("</div>"));
                    p.Controls.Add(new LiteralControl("<br/><br/>"));
                }
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            enter     obj       = new enter();
            string    username  = (string)(Session["Uname"]);
            int       userid    = obj.GetUserID(username);
            DataTable DT        = new DataTable();
            DataTable DT2       = new DataTable();
            int       following = obj.GetFollowingID(userid, ref DT);
            int       followers = obj.GetFollowerID(userid, ref DT2);

            if (following != -1)
            {
                Label youfollow = new Label();
                youfollow.ID = youfollow.UniqueID;
                youfollow.Attributes.Add("runat", "server");
                youfollow.Attributes.Add("style", "font-family: Times New Roman; font-size: 25px; background-color: #ffffff;");
                youfollow.Text = "You are Following these Users! :D";
                p.Controls.Add(youfollow);
                p.Controls.Add(new LiteralControl("<br/><br/>"));
                foreach (DataRow row in DT.Rows)
                {
                    bool   checkfollow = false;
                    Button b1          = new Button();
                    Button b2          = new Button();
                    b1.ID = b1.UniqueID;
                    b2.ID = b2.UniqueID;
                    b1.Attributes.Add("runat", "server");
                    b1.Attributes.Add("style", "font-family: Broadway;  font-size: 25px; color: #ffffff; background-color: midnightblue;");
                    b2.Attributes.Add("runat", "server");
                    b2.Attributes.Add("style", "height: 35px; width: 100px; font-family: Times New Roman; font-size: 10px; background-color: #ffffff;");
                    string name = obj.GetUser(row.Field <int>(0));
                    b1.Text   = name;
                    b1.Click += (ser, eve) =>
                    {
                        int u = obj.GetUserID(b1.Text);
                        Session["uid"] = u;
                        Response.Redirect("user.aspx?val=" + u);
                    };
                    p.Controls.Add(b1);
                    obj.checkifcollowing(userid, row.Field <int>(0), ref checkfollow);
                    if (checkfollow == false)
                    {
                        b2.Text = "FOLLOW ";
                    }
                    else
                    {
                        b2.Text = "UNFOLLOW ";
                    }

                    b2.Click += (se, ev) =>
                    {
                        bool ret = false;
                        int  f   = obj.enterfollow(userid, row.Field <int>(0), ref ret);
                        if (f != -1)
                        {
                            if (!ret)
                            {
                                b2.Text = "UNFOLLOW ";
                            }
                            else
                            {
                                b2.Text = "FOLLOW ";
                            }
                        }
                    };
                    p.Controls.Add(b2);
                    p.Controls.Add(new LiteralControl("<br/><br/>"));
                }
            }
            else if (following == -1)
            {
                Label youfollow = new Label();
                youfollow.ID = youfollow.UniqueID;
                youfollow.Attributes.Add("runat", "server");
                youfollow.Attributes.Add("style", "font-family: Times New Roman; font-size: 25px; background-color: #ffffff;");
                youfollow.Text = "You are following No User! :(";
                p.Controls.Add(youfollow);
                p.Controls.Add(new LiteralControl("<br/><br/>"));
            }
            if (followers != -1)
            {
                p.Controls.Add(new LiteralControl("<br/><br/>"));
                Label youfollow = new Label();
                youfollow.ID = youfollow.UniqueID;
                youfollow.Attributes.Add("runat", "server");
                youfollow.Attributes.Add("style", "font-family: Times New Roman; font-size: 25px; background-color: #ffffff;");
                youfollow.Text = "These Users are Following You! :D";
                p.Controls.Add(youfollow);
                p.Controls.Add(new LiteralControl("<br/><br/>"));
                foreach (DataRow row in DT2.Rows)
                {
                    bool   checkfollow = false;
                    Button b1          = new Button();
                    Button b2          = new Button();
                    b1.ID = b1.UniqueID;
                    b2.ID = b2.UniqueID;
                    b1.Attributes.Add("runat", "server");
                    b1.Attributes.Add("style", "font-family: Broadway;  font-size: 25px; color: #ffffff; background-color: midnightblue;");
                    b2.Attributes.Add("runat", "server");
                    b2.Attributes.Add("style", "height: 35px; width: 100px; font-family: Times New Roman; font-size: 10px; background-color: #ffffff;");
                    string name = obj.GetUser(row.Field <int>(0));
                    b1.Text   = name;
                    b1.Click += (ser, eve) =>
                    {
                        int u = obj.GetUserID(b1.Text);
                        Session["uid"] = u;
                        Response.Redirect("user.aspx?val=" + u);
                    };
                    p.Controls.Add(b1);
                    obj.checkifcollowing(userid, row.Field <int>(0), ref checkfollow);
                    if (checkfollow == false)
                    {
                        b2.Text = "FOLLOW ";
                    }
                    else
                    {
                        b2.Text = "UNFOLLOW ";
                    }

                    b2.Click += (se, ev) =>
                    {
                        bool ret = false;
                        int  f   = obj.enterfollow(userid, row.Field <int>(0), ref ret);
                        if (f != -1)
                        {
                            if (!ret)
                            {
                                b2.Text = "UNFOLLOW ";
                            }
                            else
                            {
                                b2.Text = "FOLLOW ";
                            }
                        }
                    };
                    p.Controls.Add(b2);
                    p.Controls.Add(new LiteralControl("<br/><br/>"));
                }
            }
            else if (followers == -1)
            {
                Label youfollow = new Label();
                youfollow.ID = youfollow.UniqueID;
                youfollow.Attributes.Add("runat", "server");
                youfollow.Attributes.Add("style", "font-family: Times New Roman; font-size: 25px; background-color: #ffffff;");
                youfollow.Text = "No one is Following you! :(";
                p.Controls.Add(youfollow);
                p.Controls.Add(new LiteralControl("<br/><br/>"));
            }
        }