protected void GetAds()
    {
        AdPanel.Controls.Clear();
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsAds = dat.GetData("SELECT * FROM Ads WHERE User_ID=" + Session["User"].ToString() + " ORDER BY Header");
        DataView dvAdds = new DataView(dsAds.Tables[0], "", "", DataViewRowState.CurrentRows);

        Panel panel;

        ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();

        if (dvAdds.Count > 0)
        {
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.WIDTH = 576;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 4;
            ArrayList a = new ArrayList(dvAdds.Count);
            int pagecount = 1;
            for (int i = 0; i < dvAdds.Count; i++)
            {
                string featured = "False";
                if (bool.Parse(dvAdds[i]["Featured"].ToString()))
                    featured = "True";
                Literal label = new Literal();

                label.Text = "<tr><td><a class=\"AddGreyLinkAlt\" style=\"padding-left: 10px;\"  " +
                    "href=\"" + dat.MakeNiceName(dvAdds[i]["Header"].ToString()) + "_" +
                    dvAdds[i]["Ad_ID"].ToString() + "_Ad\">" + dvAdds[i]["Header"].ToString() +
                    "</a></td><td><label class=\"AddGreenLink\">" + featured + "</label></td>";

                string disableStr = "";
                if (bool.Parse(dvAdds[i]["LIVE"].ToString()))
                {
                    disableStr = "<td><a class=\"PageButtons\" onclick=\"OpenRadDeleteAd(" + dvAdds[i]["Ad_ID"].ToString() +
                        ")\">Disable</a></td>";
                }
                else
                {
                    disableStr = "<td><a class=\"PageButtons\" onclick=\"OpenRadEnableAd(" + dvAdds[i]["Ad_ID"].ToString() +
                        ")\">Enable</a></td>";
                }

                if (featured == "True")
                {
                    label.Text += "<td><a class=\"AddGreyLinkAlt\" href=\"AdStatistics.aspx?Ad=" +
                        dvAdds[i]["Ad_ID"].ToString() + "\">View Statistics</a></td><td width=\"50px\"><a " +
                        "class=\"PageButtons\" href=\"PostAnAd.aspx?copy=true&ID=" +
                        dvAdds[i]["Ad_ID"].ToString() + "\">Copy</a></td>"+disableStr+"</tr>";
                }
                else
                {
                    label.Text += "<td></td><td width=\"50px\"><a " +
                        "class=\"PageButtons\" href=\"PostAnAd.aspx?copy=true&ID=" +
                        dvAdds[i]["Ad_ID"].ToString() + "\">Copy</a></td>"+disableStr+"</tr>";
                }

                //panel = new Panel();

                //Literal lNew = new Literal();
                if ((i % pagerPanel.NUMBER_OF_ITEMS_PER_PAGE) == 0)
                {
                    label.Text = "<table width=\"576px\"><tbody style=\"opacity: .7; filter: alpha(opacity = 70);background-color: #603E6A;\"><tr><td width=\"400px\"><label>Ad Name</label></td><td><label>Featured?</label></td><td></td><td></td><td></td></tr>"
                    + label.Text;
                    //panel.Controls.Add(lNew);
                }
                //Literal lOld = new Literal();
                //panel.Controls.Add(label);
                if ((i + 1) == 10 * pagecount || i == dvAdds.Count - 1)
                {
                    label.Text = label.Text + "</tbody></table>";
                    pagecount++;
                    //panel.Controls.Add(lOld);
                }
                a.Add(label);
            }
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();

            AdPanel.Controls.Add(pagerPanel);
        }
        else
        {
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
            pagerPanel.WIDTH = 576;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 1;
            ArrayList a = new ArrayList(1);

            Literal lit = new Literal();
            lit.Text = "<label>You are not an owner of any ads. To post ads go to <a href=\"PostAnAd.aspx\" class=\"AddLink\">Post An Ad page</a>.</label>";
            a.Add(lit);
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();

            AdPanel.Controls.Add(pagerPanel);
        }
    }
    protected void GetEvents()
    {
        EventsPanel.Controls.Clear();
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsAds = dat.GetData("SELECT * FROM Events WHERE Owner=" + Session["User"].ToString() + " ORDER BY Header");
        DataView dvAdds = new DataView(dsAds.Tables[0], "", "", DataViewRowState.CurrentRows);

        Panel panel;

        ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
        if (dvAdds.Count > 0)
        {

            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.WIDTH = 576;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 4;
            ArrayList a = new ArrayList(dvAdds.Count);
            int pagecount = 1;
            for (int i = 0; i < dvAdds.Count; i++)
            {
                Literal label = new Literal();
                //label.CssClass = "AddLink";
                string disableStr = "";
                if (bool.Parse(dvAdds[i]["LIVE"].ToString()))
                {
                    disableStr = "<td width=\"50px\"><a class=\"PageButtons\" onclick=\"OpenRadDeleteEvent(" + dvAdds[i]["ID"].ToString() +
                        ")\">Disable</a></td>";
                }
                else
                {
                    disableStr = "<td width=\"50px\"><a class=\"PageButtons\" onclick=\"OpenRadEnableEvent(" + dvAdds[i]["ID"].ToString() +
                        ")\">Enable</a></td>";
                }
                if (i % 10 == 0)
                    label.Text = "<table width=\"576px\"><tbody  style=\"background-color: #628E02;opacity: .8; filter:alpha(opacity = 80);\">";
                label.Text += "<tr><td><a class=\"AddGreyLinkAlt\" style=\"padding-left: 10px;\"  href=\"" +
                    dat.MakeNiceName(dvAdds[i]["Header"].ToString()) + "_" + dvAdds[i]["ID"].ToString() + "_Event\">" +
                    dvAdds[i]["Header"].ToString() + "</a></td><td width=\"50px\"><a style=\"font-family: Arial; font-size: 14px;text-decoration: none; color: #cccccc; font-weight: bold;\" href=\"BlogEvent.aspx?copy=true&ID=" +
                    dvAdds[i]["ID"].ToString() + "\">Copy</a></td>"+disableStr+"</tr>";

                if ((i + 1) == 10 * pagecount || i == dvAdds.Count - 1)
                {
                    label.Text += "</tbody></table>";
                    pagecount++;
                }
                //panel = new Panel();
                //panel.Controls.Add(label);
                a.Add(label);
            }
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();

            EventsPanel.Controls.Add(pagerPanel);
        }
        else
        {
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
            pagerPanel.WIDTH = 576;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 1;
            ArrayList a = new ArrayList(1);

            Literal lit = new Literal();
            lit.Text = "<label>You are not an owner of any events. To post events go to <a href=\"EnterEvent.aspx\" class=\"AddLink\">Post An Event page</a>.</label>";
            a.Add(lit);
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();

            EventsPanel.Controls.Add(pagerPanel);
        }
    }
    protected void GetVenues()
    {
        VenuesPanel.Controls.Clear();
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsAds = dat.GetData("SELECT * FROM Venues WHERE Owner=" + Session["User"].ToString() + " ORDER BY Name");
        DataView dvAdds = new DataView(dsAds.Tables[0], "", "", DataViewRowState.CurrentRows);

        ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
        if (dvAdds.Count > 0)
        {

            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.WIDTH = 576;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 4;
            ArrayList a = new ArrayList(dvAdds.Count);
            int pagecount = 1;
            for (int i = 0; i < dvAdds.Count; i++)
            {
                Literal label = new Literal();
                //label.CssClass = "AddLink";

                if (i % 10 == 0)
                    label.Text = "<table width=\"576px\"><tbody  style=\"opacity: .8; filter: alpha(opacity = 80);background-color: #603E6A;\">";
                label.Text += "<tr><td><a class=\"AddGreyLinkAlt\" style=\"padding-left: 10px;\" href=\"" +
                    dat.MakeNiceName(dvAdds[i]["Name"].ToString()) + "_" + dvAdds[i]["ID"].ToString() +
                    "_Venue\">" +
                    dvAdds[i]["Name"].ToString() + "</a></td></tr>";
                if ((i + 1) == 10 * pagecount || i == dvAdds.Count - 1)
                {
                    label.Text += "</tbody></table>";
                    pagecount++;
                }
                //panel = new Panel();
                //panel.Controls.Add(label);
                a.Add(label);
            }
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();

            VenuesPanel.Controls.Add(pagerPanel);
        }
        else
        {
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
            pagerPanel.WIDTH = 576;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 1;
            ArrayList a = new ArrayList(1);

            Literal lit = new Literal();
            lit.Text = "<label>You are not an owner of any venues. To post venues go to <a href=\"EnterVenueIntro.aspx\" class=\"AddLink\">Post A Venue page</a>.</label>";
            a.Add(lit);
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();

            VenuesPanel.Controls.Add(pagerPanel);
        }
    }
    //protected void GetAds()
    //{
    //    AdPanel.Controls.Clear();
    //    HttpCookie cookie = Request.Cookies["BrowserDate"];
    //    Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
    //    DataSet dsAds = dat.GetData("SELECT * FROM Ads WHERE User_ID=" + Session["User"].ToString() + " ORDER BY Header");
    //    DataView dvAdds = new DataView(dsAds.Tables[0], "", "", DataViewRowState.CurrentRows);
    //    Panel panel;
    //    ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
    //    AdPanel.Controls.Add(pagerPanel);
    //    pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";
    //    if (dvAdds.Count > 0)
    //    {
    //        pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
    //        pagerPanel.WIDTH = 700;
    //        pagerPanel.NUMBER_OF_VISIBLE_PAGES = 4;
    //        ArrayList a = new ArrayList(dvAdds.Count);
    //        int pagecount = 1;
    //        for (int i = 0; i < dvAdds.Count; i++)
    //        {
    //            string featured = "False";
    //            if (bool.Parse(dvAdds[i]["Featured"].ToString()))
    //                featured = "True";
    //            Literal label = new Literal();
    //            label.Text = "<tr><td width=\"400px\"><a class=\"NavyLink12\" style=\"padding-left: 10px;\"  " +
    //                "href=\"" + dat.MakeNiceName(dvAdds[i]["Header"].ToString()) + "_" +
    //                dvAdds[i]["Ad_ID"].ToString() + "_Ad\">" + dvAdds[i]["Header"].ToString() +
    //                "</a></td>";
    //            string disableStr = "";
    //            if (bool.Parse(dvAdds[i]["LIVE"].ToString()))
    //            {
    //                disableStr = "<td><a class=\"PageButtons\" onclick=\"OpenRadDeleteAd(" + dvAdds[i]["Ad_ID"].ToString() +
    //                    ")\">Disable</a></td>";
    //            }
    //            else
    //            {
    //                disableStr = "<td><a class=\"PageButtons\" onclick=\"OpenRadEnableAd(" + dvAdds[i]["Ad_ID"].ToString() +
    //                    ")\">Enable</a></td>";
    //            }
    //            label.Text += "<td width=\"50px\"><a " +
    //                "class=\"PageButtons\" href=\"post-bulletin?copy=true&ID=" +
    //                dvAdds[i]["Ad_ID"].ToString() + "\">Copy</a></td>" + disableStr;
    //            if (!bool.Parse(featured))
    //            {
    //                label.Text += "<td align=\"center\" width=\"100px\"><div style=\"width: 65px\" align=\"center\">" +
    //                    "<div style=\"width: 100px;\" onclick=\"window.location = 'post-bulletin?edit=true&Feature=true&ID=" + dvAdds[i]["Ad_ID"].ToString() + "';\">" +
    //                    "<div class=\"topDiv\" style=\"clear: both;\">" +
    //                      "  <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " +
    //                       " <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;" +
    //                       "padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" +
    //                           " Feature " +
    //                        "</div>" +
    //                       " <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " +
    //                    "</div>" +
    //                    "</div>" +
    //                    "</div></td>";
    //            }
    //            else
    //            {
    //                char[] delim = { ';' };
    //                string[] tokens = dvAdds[i]["DatesOfAd"].ToString().Split(delim, StringSplitOptions.RemoveEmptyEntries);
    //                label.Text += "<td align=\"center\" width=\"100px\"><label>Featured on ";
    //                foreach (string token in tokens)
    //                {
    //                    label.Text += token + ", ";
    //                }
    //                label.Text = label.Text.Trim().Substring(0, label.Text.Trim().Length - 1) + "</label>";
    //                label.Text += "<td align=\"center\" width=\"170px\"><div style=\"width: 158px\" align=\"center\">" +
    //                        "<div style=\"width: 160px;\" onclick=\"window.location = 'post-bulletin?edit=true&Feature=true&ID=" + dvAdds[i]["Ad_ID"].ToString() + "';\">" +
    //                        "<div class=\"topDiv\" style=\"clear: both;\">" +
    //                          "  <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " +
    //                           " <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;" +
    //                           "padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" +
    //                               "Add More Feature Dates" +
    //                            "</div>" +
    //                           " <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " +
    //                        "</div>" +
    //                        "</div>" +
    //                        "</div></td>";
    //                label.Text += "</tr>";
    //            }
    //            //panel = new Panel();
    //            //Literal lNew = new Literal();
    //            if ((i % pagerPanel.NUMBER_OF_ITEMS_PER_PAGE) == 0)
    //            {
    //                label.Text = "<table cellpadding=\"5px\" width=\"700px\"><tbody style=\"\">"
    //                + label.Text;
    //                //panel.Controls.Add(lNew);
    //            }
    //            //Literal lOld = new Literal();
    //            //panel.Controls.Add(label);
    //            if ((i + 1) == 10 * pagecount || i == dvAdds.Count - 1)
    //            {
    //                label.Text = label.Text + "</tbody></table>";
    //                pagecount++;
    //                //panel.Controls.Add(lOld);
    //            }
    //            a.Add(label);
    //        }
    //        pagerPanel.DATA = a;
    //        pagerPanel.DataBind2();
    //    }
    //    else
    //    {
    //        pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
    //        pagerPanel.WIDTH = 700;
    //        pagerPanel.NUMBER_OF_VISIBLE_PAGES = 1;
    //        ArrayList a = new ArrayList(1);
    //        Literal lit = new Literal();
    //        lit.Text = "<div style=\"padding: 10px;\"><label>You are not an owner of any ads. To post ads go to <a href=\"post-bulletin\" class=\"NavyLink12\">Post An Ad page</a>.</label></div>";
    //        a.Add(lit);
    //        pagerPanel.DATA = a;
    //        pagerPanel.DataBind2();
    //    }
    //}
    protected void GetEvents()
    {
        EventsPanel.Controls.Clear();
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsAds = dat.GetData("SELECT * FROM Events E WHERE Owner=" + Session["User"].ToString() + " ORDER BY Header");
        DataView dvAdds = new DataView(dsAds.Tables[0], "", "", DataViewRowState.CurrentRows);

        Panel panel;

        ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();

        EventsPanel.Controls.Add(pagerPanel);
        pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";
        DataView dvEvent;
        if (dvAdds.Count > 0)
        {

            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.WIDTH = 700;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 4;
            ArrayList a = new ArrayList(dvAdds.Count);
            int pagecount = 1;
            for (int i = 0; i < dvAdds.Count; i++)
            {
                dvEvent = dat.GetDataDV("SELECT * FROM Events E, Event_Occurance EO Where E.ID=EO.EventID AND E.ID=" + dvAdds[i]["ID"].ToString() + " ORDER BY EO.DateTimeEnd");
                Literal label = new Literal();
                //label.CssClass = "AddLink";
                string disableStr = "";
                if (bool.Parse(dvAdds[i]["LIVE"].ToString()))
                {
                    disableStr = "<td align=\"center\" width=\"50px\"><a class=\"PageButtons\" onclick=\"OpenRadDeleteEvent(" + dvAdds[i]["ID"].ToString() +
                        ")\">Disable</a></td>";

                    //if (!bool.Parse(dvAdds[i]["Featured"].ToString()))
                    //{
                        if (DateTime.Parse(dvEvent[0]["DateTimeEnd"].ToString()) >= DateTime.Now)
                        {
                            disableStr += "<td align=\"center\" width=\"100px\"><div style=\"width: 65px\" align=\"center\">" +
                                "<div style=\"width: 100px;\" onclick=\"window.location = 'blog-event?edit=true&ID=" + dvAdds[i]["ID"].ToString() + "';\">" +
                                "<div class=\"topDiv\" style=\"clear: both;\">" +
                                  "  <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " +
                                   " <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;" +
                                   "padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" +
                                       " Edit " +
                                    "</div>" +
                                   " <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " +
                                "</div>" +
                                "</div>" +
                                "</div></td>";
                        }
                        else
                        {
                            disableStr += "<td align=\"center\" width=\"100px\"><label>This event has passed</label></td>";
                        }
                    //}
                    //else
                    //{
                    //    char[] delim = { ';' };
                    //    string[] tokens = dvAdds[i]["DaysFeatured"].ToString().Split(delim, StringSplitOptions.RemoveEmptyEntries);
                    //    disableStr += "<td align=\"center\" width=\"100px\"><label>Featured on ";
                    //    foreach (string token in tokens)
                    //    {
                    //        disableStr += token + ", ";
                    //    }
                    //    disableStr = disableStr.Trim().Substring(0, disableStr.Trim().Length - 1) + "</label>";
                    //    if (DateTime.Parse(dvEvent[0]["DateTimeEnd"].ToString()) >= DateTime.Now)
                    //    {
                    //        disableStr += "<td align=\"center\" width=\"170px\"><div style=\"width: 158px\" align=\"center\">" +
                    //            "<div style=\"width: 160px;\" onclick=\"window.location = 'blog-event?edit=true&Feature=true&ID=" + dvAdds[i]["ID"].ToString() + "';\">" +
                    //            "<div class=\"topDiv\" style=\"clear: both;\">" +
                    //              "  <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " +
                    //               " <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;" +
                    //               "padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" +
                    //                   "Add More Feature Dates" +
                    //                "</div>" +
                    //               " <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " +
                    //            "</div>" +
                    //            "</div>" +
                    //            "</div></td>";
                    //    }
                    //    else
                    //    {
                    //        disableStr += "<td align=\"center\" width=\"140px\"><label>This event has passed</label></td>";
                    //    }
                    //    disableStr += "</tr>";
                    //}
                }
                else
                {
                    disableStr = "<td align=\"center\" width=\"50px\"><a class=\"PageButtons\" onclick=\"OpenRadEnableEvent(" + dvAdds[i]["ID"].ToString() +
                        ")\">Enable</a></td>";

                        //disableStr += "<td align=\"center\" width=\"100px\"><label>To feature event, enable it first.</label></td>";

                }

                if (i % 10 == 0)
                    label.Text = "<table cellpadding=\"5px\" width=\"700px\"><tbody  style=\"\">";
                label.Text += "<tr><td><a class=\"NavyLink12\" style=\"padding-left: 10px;\"  href=\"" +
                    dat.MakeNiceName(dvAdds[i]["Header"].ToString()) + "_" + dvAdds[i]["ID"].ToString() + "_Event\">" +
                    dvAdds[i]["Header"].ToString() + "</a></td><td width=\"50px\"><a class=\"PageButtons\" href=\"blog-event?copy=true&ID=" +
                    dvAdds[i]["ID"].ToString() + "\">Copy</a></td>"+disableStr+"</tr>";

                if ((i + 1) == 10 * pagecount || i == dvAdds.Count - 1)
                {
                    label.Text += "</tbody></table>";
                    pagecount++;
                }
                //panel = new Panel();
                //panel.Controls.Add(label);
                a.Add(label);
            }
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();
        }
        else
        {
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
            pagerPanel.WIDTH = 700;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 1;
            ArrayList a = new ArrayList(1);

            Literal lit = new Literal();
            lit.Text = "<div style=\"padding: 10px;\"><label>You are not an owner of any events. To post events go to <a href=\"enter-event\" class=\"AddLink\">Post An Event page</a>.</label></div>";
            a.Add(lit);
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();
        }
    }
    protected void GetVenues()
    {
        VenuesPanel.Controls.Clear();
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet dsAds = dat.GetData("SELECT * FROM Venues WHERE Owner=" + Session["User"].ToString() + " ORDER BY Name");
        DataView dvAdds = new DataView(dsAds.Tables[0], "", "", DataViewRowState.CurrentRows);

        ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
        VenuesPanel.Controls.Add(pagerPanel);
        pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";
        if (dvAdds.Count > 0)
        {

            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.WIDTH = 700;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 4;
            ArrayList a = new ArrayList(dvAdds.Count);
            int pagecount = 1;
            for (int i = 0; i < dvAdds.Count; i++)
            {
                Literal label = new Literal();
                //label.CssClass = "AddLink";

                if (i % 10 == 0)
                    label.Text = "<table cellpadding=\"5px\" width=\"700px\"><tbody>";
                label.Text += "<tr><td><a class=\"NavyLink12\" style=\"padding-left: 10px;\" href=\"" +
                    dat.MakeNiceName(dvAdds[i]["Name"].ToString()) + "_" + dvAdds[i]["ID"].ToString() +
                    "_Venue\">" +
                    dvAdds[i]["Name"].ToString() + "</a></td>";

                //if (!bool.Parse(dvAdds[i]["Featured"].ToString()))
                //{
                    label.Text += "<td align=\"center\" width=\"100px\"><div style=\"width: 65px\" align=\"center\">" +
                        "<div style=\"width: 100px;\" onclick=\"window.location = 'enter-locale?edit=true&ID=" + dvAdds[i]["ID"].ToString() + "';\">" +
                        "<div class=\"topDiv\" style=\"clear: both;\">" +
                          "  <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " +
                           " <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;" +
                           "padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" +
                               " Edit " +
                            "</div>" +
                           " <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " +
                        "</div>" +
                        "</div>" +
                        "</div></td><td></td></tr>";
                //}
                //else
                //{
                //    char[] delim = { ';' };
                //    string[] tokens = dvAdds[i]["DaysFeatured"].ToString().Split(delim, StringSplitOptions.RemoveEmptyEntries);
                //    label.Text += "<td align=\"center\" width=\"100px\"><label>Featured on ";
                //    foreach (string token in tokens)
                //    {
                //        label.Text += token + ", ";
                //    }
                //    label.Text = label.Text.Trim().Substring(0, label.Text.Trim().Length - 1) + "</label></td>";
                //    label.Text += "<td align=\"center\" width=\"170px\"><div style=\"width: 158px\" align=\"center\">" +
                //            "<div style=\"width: 160px;\" onclick=\"window.location = 'enter-locale?edit=true&Feature=true&ID=" + dvAdds[i]["ID"].ToString() + "';\">" +
                //            "<div class=\"topDiv\" style=\"clear: both;\">" +
                //              "  <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " +
                //               " <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;" +
                //               "padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" +
                //                   "Add More Feature Dates" +
                //                "</div>" +
                //               " <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " +
                //            "</div>" +
                //            "</div>" +
                //            "</div></td>";

                //    label.Text += "</tr>";
                //}

                if ((i + 1) == 10 * pagecount || i == dvAdds.Count - 1)
                {
                    label.Text += "</tbody></table>";
                    pagecount++;
                }
                //panel = new Panel();
                //panel.Controls.Add(label);
                a.Add(label);
            }
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();
        }
        else
        {
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
            pagerPanel.WIDTH = 700;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 1;
            ArrayList a = new ArrayList(1);

            Literal lit = new Literal();
            lit.Text = "<div style=\"padding: 10px;\"><label>You are not an owner of any venues. To post venues go to <a href=\"EnterVenueIntro.aspx\" class=\"NavyLink12\">Post A Venue page</a>.</label></div>";
            a.Add(lit);
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();
        }
    }
Esempio n. 6
0
    protected void LoadControls()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        TheDiv.InnerHtml = "";

        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet ds = dat.GetData("SELECT UM.MessageSubject, UM.MessageContent, U.UserName FROM UserMessages UM, Users U WHERE UM.Live='True' AND UM.To_UserID=" +
            Session["User"].ToString() + " AND UM.From_UserID=U.User_ID ORDER BY Date DESC");

        System.Drawing.Color greyText = System.Drawing.Color.FromArgb(102, 102, 102);
        System.Drawing.Color greyBack = System.Drawing.Color.FromArgb(51, 51, 51);

        ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
        pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl14_Panel";
        pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
        ArrayList a = new ArrayList(ds.Tables[0].Rows.Count);

        int unreadCount = 0;
        int count = 0;
        int times = 1;

        Panel ItemsPanel = new Panel();
        ItemsPanel.ID = "PanelM1";
        if (ds.Tables.Count > 0)
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {

                    if (count == 10 * times)
                    {
                        a.Add(ItemsPanel);
                        times++;
                        ItemsPanel = new Panel();
                        ItemsPanel.ID = "PanelM" + times.ToString();
                    }
                    count++;
                    DataSet dsUsers = dat.GetData("SELECT * FROM Users WHERE User_ID=" +
                        ds.Tables[0].Rows[i]["From_UserID"].ToString());

                    if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString()))
                        unreadCount++;

                    string boldOrNot = "font-size: 12px;";

                    if (!bool.Parse(ds.Tables[0].Rows[i]["Read"].ToString()))
                        boldOrNot = "font-weight:bold;font-size: 14px;";

                    HtmlGenericControl thediv = new HtmlGenericControl();
                    thediv.Attributes.Add("class", "MailHeader");
                    thediv.Attributes.Add("style", boldOrNot);
                    thediv.Attributes.Add("onclick", "OpenEmail('" + i.ToString() + "');");
                    //thediv.Attributes.Add("onserverclick", "MarkAsRead2");
                    thediv.ID = "header" + i.ToString();

                    string thedivsText = "";
                    //thedivsText = "<div class=\"MailHeader\" style=\""+boldOrNot+"\" "+
                    //    "onclick=\"OpenEmail('"+i.ToString()+"');\" id=\"header"+i.ToString()+"\">";

                    //thedivsText += "<div style=\"display: none;\" id=\"readDiv"+i.ToString()+"\">"+
                    //    ds.Tables[0].Rows[i]["Read"].ToString()+"</div>";
                    //thedivsText += "<div style=\"display: none;\" id=\"idDiv"+i.ToString()+"\">"+
                    //    ds.Tables[0].Rows[i]["ID"].ToString()+"</div>";
                    //thedivsText += "<div style=\"display: none;\" id=\"userDiv" + i.ToString() + "\">" +
                    //    Session["User"].ToString() + "</div>";
                    //thedivsText += "<div style=\"display: none;\" id=\"fromDiv" + i.ToString() + "\">" +
                    //    ds.Tables[0].Rows[i]["From_UserID"].ToString() + "</div>";

                    string tempor2 = "";
                    string theUser = dsUsers.Tables[0].Rows[0]["UserName"].ToString();
                    if (ds.Tables[0].Rows[i]["Mode"].ToString() == "1")
                    {
                        theUser = "******";
                        tempor2 = " style=\"display:none;\" ";
                    }

                    string acceptHTML = "";
                    string tempor = "";

                    if (ds.Tables[0].Rows[i]["Mode"].ToString() == "2")
                    {
                        tempor2 = " style=\"display:none;\" ";
                        tempor = "<a class=\"Green12LinkNF\" href=\"javascript:AcceptFriend('" + i.ToString() + "');\">Accept Friend Request</a>";
                        DataSet isFirend = dat.GetData("SELECT * FROM User_Friends WHERE UserID="+Session["User"].ToString()+" AND FriendID="+ds.Tables[0].Rows[i]["From_UserID"].ToString());
                        if (isFirend.Tables.Count > 0)
                            if (isFirend.Tables[0].Rows.Count > 0)
                                tempor = "<span class=\"Green12LinkNF\">You are already friends with "+theUser + "</span>";
                        acceptHTML = "<div class=\"Green12LinkNF\" id=\"accept"+i.ToString()+"\">"+tempor+"</div><br/>";
                    }

                    thedivsText += "<table width=\"530px\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><span style=\"padding-left:5px;font-family:Arial;  "
                        + "\">From: </span><span style=\"color: #1fb6e7; font-family: Arial;\">" + theUser
                        + "</span></td><td ><span style=\"padding-top:10px;font-family:Arial;" +
                        " float:right;padding-right:5px;\">" +
                        ds.Tables[0].Rows[i]["Date"].ToString() + "</span></td></tr><tr><td colspan=\"3\"><span style=\"font-family:Arial; padding-left: 5px;\">Subject: <span id=\"subject" + i.ToString() + "\">"
                        + ds.Tables[0].Rows[i]["MessageSubject"].ToString() +
                        "</span></span></td></tr></table>";

                    thedivsText += "</div>";
                    thediv.InnerHtml = thedivsText;

                    HtmlGenericControl messageDiv = new HtmlGenericControl();
                    messageDiv.Attributes.Add("style", "display: none;");
                    messageDiv.Attributes.Add("class", "MailContent EventBody");
                    messageDiv.ID = "contentDiv";

                    string messageDivsText = "";

                    //thedivsText += "<div style=\"display: none;\" class=\"MailContent EventBody\" id=\"contentDiv"+
                    //    i.ToString()+"\">";
                    messageDivsText += "<table><tr><td width=\"285px\" valign=\"top\"><label>" +
                        ds.Tables[0].Rows[i]["MessageContent"].ToString()+" <br/><br/><br/> " +acceptHTML + "</label></td>";
                    messageDivsText += "<td valign=\"top\"><table ><tr><td width=\"285px\" align=\"right\">" +
                        "<img alt=\"Delete Message\" name=\"Delete Message\" style=\"cursor: pointer;\" "+
                        "onclick=\"DeleteEmail('" + i.ToString() + "');\" src=\"image/X.png\" "+
                        "onmouseover=\"this.src='image/XSelected.png'\" onmouseout=\"this.src='image/X.png'\" />"+
                        "</td></tr><tr><td " + tempor2 + "><textarea cols=\"30\" rows=\"10\" id=\"textDiv" +
                        i.ToString() + "\"></textarea></td></tr>";
                    messageDivsText += "<tr><td " + tempor2 + "><img onclick=\"ReplyMessage('" + i.ToString() +
                        "');\" src=\"image/ReplyButton.png\" onmouseout=\"this.src='image/ReplyButton.png'\""+
                        "onmouseover=\"this.src='image/ReplyButtonSelected.png'\" /></td></tr>";
                    messageDivsText += "<tr><td><div class=\"NavyLink12\" id=\"message" + i.ToString() + "\"></div></td></tr>";
                    messageDivsText += "</table></td></tr></table>";
                    //thedivsText += "</div>";

                    messageDiv.InnerHtml = messageDivsText;

                    ItemsPanel.Controls.Add(thediv);

                    //message.DATE = ds.Tables[0].Rows[i]["Date"].ToString();

                    //MessagePanel.Controls.Add(message);
                }

                if (ds.Tables[0].Rows.Count % 10 != 0 || ds.Tables[0].Rows.Count == 10)
                {
                    a.Add(ItemsPanel);
                }

            }

        Label label = new Label();

        string temp = "messages";
        if (ds.Tables[0].Rows.Count == 1)
            temp = "message";
        label.Text = "<table width=\"570px\"><tr><td><span style=\"font-family: Arial; font-size: 20px; color: White;\">My Messages</span>"
            + "<span style=\"font-family: Arial; font-size: 12px;   padding-left: 5px;\">(<span id=\"messagesCount\">" + unreadCount.ToString()
            + "</span> new " + temp + ")</span></td><td align=\"right\"><div class=\"Green12LinkNF\" id=\"globalMessage\"></div></td></tr></table>";

        Panel MessagesPanel = (Panel)Tab1.FindControl("MessagesPanel");

        MessagesPanel.Controls.Clear();
        MessagesPanel.Controls.Add(label);
        MessagesPanel.Controls.Add(pagerPanel);

        if (a.Count > 0)
        {
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();
        }
    }
Esempio n. 7
0
    protected void LoadControlsNotAJAX()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        try
        {
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            DataSet ds = dat.GetData("SELECT TOP 100 UM.MessageSubject, UM.ID, UM.From_UserID, UM.MessageContent, UM.[Read], UM.Date, U.UserName, UM.Mode FROM UserMessages UM, Users U WHERE UM.Live='True' AND UM.To_UserID=" +
                Session["User"].ToString() + " AND UM.From_UserID=U.User_ID AND UM.LIVE=1 ORDER BY Date DESC");

            ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();

            pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl156_Panel";
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
            pagerPanel.WIDTH = 530;
            pagerPanel.NUMBER_OF_VISIBLE_PAGES = 4;
            ArrayList a = new ArrayList(ds.Tables[0].Rows.Count);

            if (ds.Tables[0].Rows.Count == 0)
            {
                Literal lit = new Literal();
                lit.Text = "<div style=\"border: solid 3px #dedbdb;" +
               "float: left; width: 530px;\"><div style=\"width: 530px; display: block; float: left; margin" +
               "-left: 5px;\"><table width=\"100%\"><tr><td><span class=\"TextNormal\" "+
               "style=\"padding-left: 5px;\">(0 messages)</span></td></tr></table></div>" +
               "<div style=\"width: 530px; display: block; float: left; margin-left: 5px; padding-bottom: 5px;\">" +
               "</div></div>";
                MessagesPanel.Controls.Add(lit);
            }
            else
            {
                int unreadCount = AddMessages(ds, ref a, false);

                Label label = new Label();

                string temp = "messages";
                if (ds.Tables[0].Rows.Count == 1)
                    temp = "message";

                if (unreadCount > 0)
                {
                    RadTabStrip3.Tabs[0].Text = "<div style=\"float: left;\">Inbox </div>" +
                        "<div style=\"float: left;font-size: 12px; vertical-align: " +
                        "middle; font-weight: normal; padding-bottom: 3px;\" id=\"InboxDiv\">" +
                        "<div style=\"float: left;\">&nbsp;(</div><div style=\"float: left;\" id=\"InboxInnerDiv\">" +
                        unreadCount.ToString() + " </div><div style=\"float: left;\">&nbsp;New)</div></div>";

                    //label.Text = "<span style=\"font-family: Arial; font-size: 20px; color: White;\">My Messages</span>"
                    //    + "<span style=\"font-family: Arial; font-size: 12px;   padding-left: 5px;\">(" + unreadCount.ToString()
                    //    + " new " + temp + ")</span>";
                    RadTabStrip3.Tabs[0].Value = unreadCount.ToString();
                }
                MessagesPanel.Controls.Clear();
                //MessagesPanel.Controls.Add(label);
                MessagesPanel.Controls.Add(pagerPanel);
                pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";

                pagerPanel.DATA = a;
                pagerPanel.DataBind2();
            }

            ds = dat.GetData("SELECT TOP 100 UM.MessageContent, UM.ID, UM.To_UserID AS From_UserID, UM.MessageSubject, UM.[Read], UM.Mode, UM.Date, U.UserName FROM UserMessages UM, Users U WHERE UM.From_UserID=" +
                Session["User"].ToString() + " AND U.User_ID=UM.To_UserID AND UM.SentLive=1 ORDER BY Date DESC");

            pagerPanel = new ASP.controls_pager_ascx();
            pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl157_Panel";
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 1;
            pagerPanel.WIDTH = 530;
            a = new ArrayList(ds.Tables[0].Rows.Count);

            if (ds.Tables[0].Rows.Count == 0)
            {
                Literal lit = new Literal();
                lit.Text = "<div style=\"border: solid 3px #dedbdb;" +
               "float: left; width: 530px;\"><div style=\"width: 530px; display: block; float: left; margin" +
               "-left: 5px;\"><table width=\"100%\"><tr><td><span class=\"TextNormal\" style=\" "+
               "padding-left: 5px;\">(0 sent messages)</span></td></tr></table></div>" +
               "<div style=\"width: 530px; display: block; float: left; margin-left: 5px; padding-bottom: 5px;\">" +
               "</div></div>";
                UsedMessagesPanel.Controls.Add(lit);
            }
            else
            {

                AddMessages(ds, ref a, true);

                UsedMessagesPanel.Controls.Clear();
                UsedMessagesPanel.Controls.Add(pagerPanel);

                pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";

                pagerPanel.DATA = a;
                pagerPanel.DataBind2();
            }
        }
        catch (Exception ex)
        {
            UserErrorLabel.Text = ex.ToString();
        }
    }
Esempio n. 8
0
    protected void FillRecommendedEvents()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        //only show top 10
        int topCount = 10;

        //Put the sets together
        DataSet dsAll = dat.RetrieveRecommendedEvents(topCount, true);

        bool noneMessage = false;

        if (dsAll.Tables.Count > 0)
            if (dsAll.Tables[0].Rows.Count > 0)
            {
                //insert link to all recommended events
                Session["RecomDS"] = dsAll;
                Literal link = new Literal();
                link.Text = "<h4 style=\"margin-bottom: 5px;\">Top 10 Recommended Events</h4><div><a class=\"NavyLink12\" onclick=\"OpenRadRecom();\">See All</a></div>";

                RecommendedEvents.Controls.Add(link);

                Hashtable hash = new Hashtable();

                ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
                pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_ctl13_Panel";
                pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 3;
                pagerPanel.PANEL_CSSCLASS = "FavoritesPanel";
                pagerPanel.WIDTH = 260;
                ArrayList a = new ArrayList(topCount);

                for (int i = 0; i < topCount; i++)
                {
                    dat.InsertOneEvent(dsAll, i, ref a, false);
                }

                RecommendedEvents.Controls.Add(pagerPanel);
                pagerPanel.DATA = a;
                pagerPanel.DataBind2();
            }
            else
            {
                noneMessage = true;
            }
        else
            noneMessage = true;

        if (noneMessage)
        {
            Label lab = new Label();
            lab.Text = "There are no recommended events here this month. There are a few reasons for this. "+
                "There simply is no events that fit your recommendation criteria, or you have selected not to "+
                "recommend any events. To modify your preferences please visit the 'My Preferences' tab on this page.";

            RecommendedEvents.Controls.Add(lab);
        }
    }
Esempio n. 9
0
    protected void FillVenues()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        DataSet ds = dat.GetData("SELECT *, UV.VenueID AS VID  FROM UserVenues UV, Venues V "+
            "WHERE V.ID=UV.VenueID AND UV.UserID="+
            Session["User"].ToString() + " ORDER BY V.Name");

        bool noneExist = false;

        if (ds.Tables.Count > 0)
            if (ds.Tables[0].Rows.Count > 0)
            {
                ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
                pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 5;
                pagerPanel.PANEL_CSSCLASS = "FavoritesPanel";
                pagerPanel.WIDTH = 260;
                ArrayList a = new ArrayList(ds.Tables[0].Rows.Count * 2);

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Literal lit = new Literal();
                    lit.Text = "<div class=\"topDiv\"><div class=\"topDiv\" style=\"padding-top: 20px;\">";

                    Literal lit2 = new Literal();
                    lit2.Text = "</div>";

                    ASP.controls_hipporating_ascx rating = new ASP.controls_hipporating_ascx();
                    rating.VENUE_ID = ds.Tables[0].Rows[i]["ID"].ToString();

                    Label label = new Label();
                    label.Text = "<div style=\"float:left; padding-top: 4px;\"><a class=\"NavyLink12\" href=\"" +
                        dat.MakeNiceName(ds.Tables[0].Rows[i]["Name"].ToString()) +'_'+ ds.Tables[0].Rows[i]["ID"].ToString() + "_Venue\">" + ds.Tables[0].Rows[i]["Name"].ToString() + "</a></div>";

                    DataSet dsEvents = dat.GetData("SELECT * FROM Events E, Event_Occurance EO WHERE EO.EventID=E.ID AND "+
                        "DAY(EO.DateTimeStart) = DAY(GETDATE()) AND MONTH(EO.DateTimeStart) = MONTH(GETDATE()) AND YEAR"+
                        "(EO.DateTimeStart) = YEAR(GETDATE()) "
                      +   " AND E.Venue=" + ds.Tables[0].Rows[i]["VID"].ToString());
                    int count = 0;

                    if (dsEvents.Tables.Count > 0)
                        if (dsEvents.Tables[0].Rows.Count > 0)
                            count = dsEvents.Tables[0].Rows.Count;

                    string theColor = "";
                    if (count > 0)
                        theColor = "color: #ff6b09;";

                    Label label2 = new Label();
                    label2.Text = "<div style=\"display: block; padding-top: 3px;" + theColor +
                        "\">" + count + " event[s] going on today </div></div>";

                    Panel allP = new Panel();
                    allP.Controls.Add(lit);
                    allP.Controls.Add(label);
                    allP.Controls.Add(rating);
                    allP.Controls.Add(lit2);
                    allP.Controls.Add(label2);

                    a.Add(allP);
                }

                Literal newLit = new Literal();
                newLit.Text = "<div class=\"topDiv\">";
                FavoriteVenues.Controls.Add(newLit);
                FavoriteVenues.Controls.Add(pagerPanel);

                pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";
                pagerPanel.DATA = a;
                pagerPanel.DataBind2();

                newLit = new Literal();
                newLit.Text = "</div>";
                FavoriteVenues.Controls.Add(newLit);
            }
            else
                noneExist = true;
        else
            noneExist = true;

        if (noneExist)
        {
            Label label = new Label();
            label.Text = "You have not added any locales to your favorite's list. To search for some awesome locales and make them your favorite visit the <a class=\"Green12LinkNF\" href=\"venue-search\">locale's page.</a>";
            FavoriteVenues.Controls.Add(label);
        }
    }
    public void DataBind2()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (pollID != -1)
        {
            int pollCount = 0;
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            DataSet pollsDS;
            if (Session["User"] != null)
            {
                string commentPrefs = dat.GetData("SELECT * FROM UserPreferences WHERE UserID=" + Session["User"].ToString()).Tables[0].Rows[0]["PollPreferences"].ToString();
                if (commentPrefs == "1")
                {
                    pollsDS = dat.GetData("SELECT * FROM PollAnswers WHERE PollID=" + pollID.ToString() + " AND UserID <> " + Session["User"].ToString());
                }
                else
                {
                    pollsDS = dat.GetData("SELECT  * FROM PollAnswers PA, Users U, User_Friends UF WHERE UF.UserID=" + Session["User"].ToString() + " AND UF.FriendID=U.User_ID AND U.User_ID=PA.UserID AND PA.PollID=" + pollID.ToString());
                }
            }
            else
            {
                pollsDS = dat.GetData("SELECT * FROM PollAnswers WHERE PollID=" + pollID.ToString() + " AND UserID <> " + Session["User"].ToString());
            }
            if (pollsDS.Tables.Count > 0)
            {
                pollCount = pollsDS.Tables[0].Rows.Count;
                Label title = new Label();
                title.CssClass = "EventHeader";
                title.Text = "Answers:";
                PollElementsPanel.Controls.Add(title);
            }

            ArrayList a = new ArrayList(pollCount);

            for (int i = 0; i < pollCount; i++)
            {
                if (pollsDS.Tables[0].Rows[i]["Answer"].ToString() == "" && pollsDS.Tables[0].Rows[i]["MediaCategory"].ToString() == "0")
                {

                }
                else
                {
                    ASP.controls_pollanswer_ascx pollElement = new ASP.controls_pollanswer_ascx();
                    pollElement.ANSWER_ID = int.Parse(pollsDS.Tables[0].Rows[i]["AnswerID"].ToString());
                    pollElement.POLL_ID = pollID;
                    pollElement.USER_ID = int.Parse(pollsDS.Tables[0].Rows[i]["UserID"].ToString());

                    a.Add(pollElement);
                }
                //pagerPanel.Add(searchElement);

            }
            ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();
            PollElementsPanel.Controls.Add(pagerPanel);
        }
    }
    protected void FillEvents(DataSet dsAll)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        int count = dsAll.Tables[0].Rows.Count;
        Encryption decrypt = new Encryption();
        //if (Request.QueryString["message"] != null)
        //    MessageLabel.Text = decrypt.decrypt(Request.QueryString["message"].ToString());
        //else if (Session["Message"] != null)
        //{
        //    MessageLabel.Text = Session["Message"].ToString();
        //}

        if (count > 0)
        {
            ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 6;
            pagerPanel.PANEL_NAME = "ctl02_Panel";
            pagerPanel.PANEL_CSSCLASS = "FavoritesPanel";
            pagerPanel.WIDTH = 650;
            ArrayList a = new ArrayList(count * 4);

            for (int i = 0; i < count; i++)
            {
                dat.InsertOneEvent(dsAll, i, ref a, true);
            }

            RecommendedEvents.Controls.Clear();
            RecommendedEvents.Controls.Add(pagerPanel);
            pagerPanel.DATA = a;
            pagerPanel.DataBind2();

        }
        else
        {

            Label lab = new Label();
            lab.CssClass = "EventBody";
            lab.Text = "<br/>No Recommended events in this time frame.";

            RecommendedEvents.Controls.Clear();
            RecommendedEvents.Controls.Add(lab);
        }
    }
    public int DataBind2()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];

        DateTime isn = DateTime.Now;

        if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn))
            isn = DateTime.Now;
        DateTime isNow = isn;
        Data dat = new Data(isn);
        Hashtable hash = new Hashtable();
        int countInHash = 0;

        string featureDate = isNow.Month.ToString() +"/"+isNow.Day.ToString()+"/"+isNow.Year.ToString();

        if (eventsDS != null)
        {
            try
            {
                Clear();
                int eventCount = 0;
                if (eventsDS.Tables.Count > 0)
                    eventCount = eventsDS.Tables[0].Rows.Count;

                ArrayList a = new ArrayList(eventCount);

                int searchTo = eventCount;

                if (dat.SearchCutOffNumber < eventCount)
                {
                    searchTo = dat.SearchCutOffNumber;
                }

                DataView dv = new DataView(eventsDS.Tables[0], "", "", DataViewRowState.CurrentRows);

                DataView dvEvent;

                int countGotten = 0;
                int i = 0;

                ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();

                pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = num_of_pages;
                pagerPanel.ID = "PagerPanel";
                if (Request.Url.AbsolutePath.ToLower() == "/tripsearch.aspx")
                {
                    dv.Sort = "colOrder ASC";
                    pagerPanel.RUN_FUNCTION = "initialize";
                    pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_EventSearchElements_PagerPanel_Panel";
                }
                else if (Request.Url.AbsolutePath.ToLower() == "/tripcategorysearch.aspx")
                {
                    pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_SearchElements_PagerPanel_Panel";
                }
                int mapCount = 0;
                string means = "";

                foreach(DataRowView row in dv)
                {
                    if (countGotten < searchTo)
                    {
                        try
                        {
                            ASP.controls_tripsearchelement_ascx searchElement = new ASP.controls_tripsearchelement_ascx();

                            if (bool.Parse(row["Featured"].ToString()))
                            {
                                if (row["DaysFeatured"].ToString().Contains(";" + featureDate + ";"))
                                    searchElement.IS_FEATURED = true;
                                else
                                    searchElement.IS_FEATURED = false;
                            }
                            else
                            {
                                searchElement.IS_FEATURED = false;
                            }

                            searchElement.NUM_OF_ALL_RESULTS = countOfUniqueVenues;
                            searchElement.SEARCH_LABEL = row["Header"].ToString();

                            means = "";
                            if (row["Means"].ToString().Contains(";1"))
                            {
                                means += "Car, ";
                            }

                            if (row["Means"].ToString().Contains(";2"))
                            {
                                means += "Walking, ";
                            }

                            if (row["Means"].ToString().Contains(";3"))
                            {
                                means += "Hiking, ";
                            }

                            if (row["Means"].ToString().Contains(";4"))
                            {
                                means += "Biking, ";
                            }

                            if (row["Means"].ToString().Contains(";5"))
                            {
                                means += "Flying, ";
                            }

                            if (row["PriceRange"].ToString().Trim() != "")
                                means = row["PriceRange"].ToString() + ", " + means;

                            searchElement.PRICE_MEANS_TIMEFRAME = means + row["TimeFrame"].ToString();

                            string toolTipID = "";

                            searchElement.EVENT_ID = int.Parse(row["EID"].ToString());
                            searchElement.IS_WINDOW = false;

                            if (doMap)
                            {
                                searchElement.SEARCH_MAP_NUM = row["SearchNum"].ToString();
                            }

                            toolTipID = "False" + row["EID"].ToString();

                            searchElement.TOOL_TIP_ID = toolTipID;

                            if (isConnectTo)
                            {
                                searchElement.IS_CONNECT_TO = bool.Parse(row["isConnect"].ToString());
                                searchElement.WIDTH = 417;
                            }

                            //if (somecount % 2 != 0)
                            searchElement.COLOR = "#ebe7e7";

                            a.Add(searchElement);

                            //pagerPanel.Add(searchElement);
                            countGotten++;
                        }
                        catch (Exception ex)
                        {
                            Label lab = new Label();
                            lab.Text = ex.ToString();
                            a.Add(lab);
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                SearchElementsPanel.Controls.Add(pagerPanel);
                pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";
                pagerPanel.DATA = a;
                pagerPanel.WIDTH = 429;
                pagerPanel.DataBind2();
            }
            catch (Exception ex)
            {
                ErrorLabel.Text = ex.ToString();
            }
        }
        return countInHash;
    }
    public void DataBind2()
    {
        if (adDS != null)
        {
            int adCount = 0;
            if (adDS.Tables.Count > 0)
                adCount = adDS.Tables[0].Rows.Count;

            ArrayList a = new ArrayList(adCount);
            HttpCookie cookie = Request.Cookies["BrowserDate"];

            DateTime isn = DateTime.Now;

            if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn))
                isn = DateTime.Now;
            DateTime isNow = isn;
            Data dat = new Data(isn);
            string featureDate = isNow.Month.ToString() + "/" + isNow.Day.ToString() + "/" + isNow.Year.ToString();
            int searchTo = adCount;

            if (dat.SearchCutOffNumber < adCount)
            {
                searchTo = dat.SearchCutOffNumber;
            }

            DataView dvAd;
            DataView dvAds = new DataView(adDS.Tables[0], "", "", DataViewRowState.CurrentRows);

            ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();

            if (Request.Url.AbsolutePath.ToLower() == "/adsearch.aspx")
            {
                pagerPanel.PANEL_NAME = "AdSearchElements_ctl00_Panel";
                dvAds.Sort = "colOrder ASC";
            }
            else
            {
                pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_SearchElements_ctl00_Panel";
            }

            foreach(DataRowView ad in dvAds)
            {
                ASP.controls_adsearchelement_ascx searchElement = new ASP.controls_adsearchelement_ascx();
                searchElement.AD_ID = int.Parse(ad["VID"].ToString());
                searchElement.SEARCH_LABEL = ad["Header"].ToString();
                searchElement.IS_WINDOW = windowT;

                dvAd = dat.GetDataDV("SELECT * FROM Ads WHERE Ad_ID=" + ad["VID"].ToString());

                if (bool.Parse(dvAd[0]["Featured"].ToString()))
                {
                    if (dvAd[0]["DatesOfAd"].ToString().Contains(";" + featureDate + ";"))
                        searchElement.IS_FEATURED = true;
                    else
                        searchElement.IS_FEATURED = false;
                }
                else
                {
                    searchElement.IS_FEATURED = false;
                }

                a.Add(searchElement);

                //pagerPanel.Add(searchElement);

            }

            SearchElementsPanel.Controls.Add(pagerPanel);
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.DATA = a;
            pagerPanel.WIDTH = 420;
            pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";

            pagerPanel.DataBind2();
        }
    }
    public void DataBind2()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (venueDS != null)
        {
            int venueCount = 0;
            if (venueDS.Tables.Count > 0)
                venueCount = venueDS.Tables[0].Rows.Count;

            ArrayList a = new ArrayList(venueCount);

            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            int searchTo = venueCount;

            if (dat.SearchCutOffNumber < venueCount)
            {
                searchTo = dat.SearchCutOffNumber;
            }

            for (int i = 0; i < searchTo; i++)
            {
                ASP.controls_groupsearchelement_ascx searchElement = new ASP.controls_groupsearchelement_ascx();
                searchElement.Venue_ID = int.Parse(venueDS.Tables[0].Rows[i]["Group_ID"].ToString());
                searchElement.SEARCH_LABEL = venueDS.Tables[0].Rows[i]["Header"].ToString();
                searchElement.CITY = venueDS.Tables[0].Rows[i]["City"].ToString();
                searchElement.STATE = venueDS.Tables[0].Rows[i]["State"].ToString();
                searchElement.IS_WINDOW = windowT;
                if (i % 2 != 0)
                    searchElement.COLOR = "#1b1b1b";

                a.Add(searchElement);

                //pagerPanel.Add(searchElement);

            }
            ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();
            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = 10;
            pagerPanel.DATA = a;
            pagerPanel.WIDTH = 420;
            pagerPanel.DataBind2();
            SearchElementsPanel.Controls.Add(pagerPanel);
        }
    }
    public int DataBind2()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];

        DateTime isn = DateTime.Now;

        DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn);
        DateTime isNow = isn;
        Data dat = new Data(isn);
        Hashtable hash = new Hashtable();
        int countInHash = 0;

        string featureDate = isNow.Month.ToString() +"/"+isNow.Day.ToString()+"/"+isNow.Year.ToString();

        if (eventsDS != null)
        {
            try
            {
                Clear();
                int eventCount = 0;
                if (eventsDS.Tables.Count > 0)
                    eventCount = eventsDS.Tables[0].Rows.Count;

                ArrayList a = new ArrayList(eventCount);

                int searchTo = eventCount;

                if (dat.SearchCutOffNumber < eventCount)
                {
                    searchTo = dat.SearchCutOffNumber;
                }

                DataView dv = new DataView(eventsDS.Tables[0], "", "", DataViewRowState.CurrentRows);

                DataView dvEvent;

                int countGotten = 0;
                int i = 0;

                ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();

                pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = num_of_pages;

                if (Request.Url.AbsolutePath.ToLower() == "/eventsearch.aspx")
                {
                    pagerPanel.ID = "PagerPanel";
                    pagerPanel.RUN_FUNCTION = "initialize";
                    dv.Sort = "colOrder ASC";
                }
                else if (Request.Url.AbsolutePath.ToLower() == "/eventcategorysearch.aspx")
                {
                    pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_SearchElements_PagerPanel_Panel";
                }
                else  if (Request.Url.AbsolutePath.ToLower() == "/friend.aspx")
                {
                    pagerPanel.ID = "PagerPanel";
                    pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_EventsCtrl_PagerPanel_Panel";
                }
                int mapCount = 0;

                bool isEvent = true;
                DateTime dateOfEvent;
                foreach(DataRowView row in dv)
                {
                    if (countGotten < searchTo)
                    {
                        try
                        {
                            ASP.controls_searchelement_ascx searchElement = new ASP.controls_searchelement_ascx();

                            if (dv.Table.Columns.Contains("Type"))
                            {
                                if (row["Type"].ToString() == "V")
                                    isEvent = false;
                                else
                                    isEvent = true;
                            }
                            else
                            {
                                isEvent = true;
                            }

                            if (isEvent)
                            {
                                dvEvent = dat.GetDataDV("SELECT *, EO.ID AS ReoccurrID FROM Events E, Event_Occurance EO WHERE E.ID=EO.EventID AND E.ID=" + row["EID"].ToString());

                                if (bool.Parse(dvEvent[0]["Featured"].ToString()))
                                {
                                    if (dvEvent[0]["DaysFeatured"].ToString().Contains(";" + featureDate + ";"))
                                        searchElement.IS_FEATURED = true;
                                    else
                                        searchElement.IS_FEATURED = false;
                                }
                                else
                                {
                                    searchElement.IS_FEATURED = false;
                                }

                                searchElement.NUM_OF_ALL_RESULTS = countOfUniqueVenues;
                                searchElement.SEARCH_LABEL = row["Header"].ToString();

                                string toolTipID = "";

                                searchElement.VENUE_LABEL = row["Name"].ToString();
                                searchElement.EVENT_ID = int.Parse(row["EID"].ToString());
                                searchElement.IS_WINDOW = false;

                                if (doMap)
                                {
                                    searchElement.SEARCH_MAP_NUM = row["SearchNum"].ToString();
                                }

                                if (isEvent)
                                {
                                    dateOfEvent = DateTime.Parse(row["DateTimeStart"].ToString());
                                    searchElement.DATE_LABEL = dateOfEvent.DayOfWeek.ToString().Substring(0, 3) +
                                        " " + row["DateTimeStart"].ToString().Replace(":00",
                                        "").Trim().Replace(" PM", "p").Replace(" AM", "a").Replace("/" + dateOfEvent.Year.ToString(), "");
                                    toolTipID = "False" + row["EID"].ToString() + row["ReoccurrID"].ToString();
                                }

                                if (dv.Count > 1)
                                    searchElement.DATE_LABEL += "+";

                                if (row["VID"].ToString() != "NONE")
                                    searchElement.VENUE_ID = int.Parse(row["VID"].ToString());

                                searchElement.TOOL_TIP_ID = toolTipID;

                                if (isConnectTo)
                                {
                                    searchElement.IS_CONNECT_TO = bool.Parse(row["isConnect"].ToString());
                                    searchElement.WIDTH = 417;
                                }
                            }
                            else
                            {
                                dvEvent = dat.GetDataDV("SELECT * FROM Venues E WHERE E.ID=" + row["VID"].ToString());

                                if (bool.Parse(dvEvent[0]["Featured"].ToString()))
                                {
                                    if (dvEvent[0]["DaysFeatured"].ToString().Contains(";" + featureDate + ";"))
                                        searchElement.IS_FEATURED = true;
                                    else
                                        searchElement.IS_FEATURED = false;
                                }
                                else
                                {
                                    searchElement.IS_FEATURED = false;
                                }

                                searchElement.NUM_OF_ALL_RESULTS = countOfUniqueVenues;
                                searchElement.SEARCH_LABEL = row["Header"].ToString();

                                string toolTipID = "";

                                searchElement.DATE_LABEL = "";
                                searchElement.VENUE_LABEL = row["Name"].ToString();
                                searchElement.VENUE_ID = int.Parse(row["VID"].ToString());
                                searchElement.IS_WINDOW = false;
                                searchElement.IS_VENUE = true;

                                if (doMap)
                                {
                                    searchElement.SEARCH_MAP_NUM = row["SearchNum"].ToString();
                                }

                                toolTipID = "False" + row["VID"].ToString();
                                searchElement.TOOL_TIP_ID = toolTipID;
                            }
                            //if (somecount % 2 != 0)
                            searchElement.COLOR = "#ebe7e7";

                            a.Add(searchElement);

                            //pagerPanel.Add(searchElement);
                            countGotten++;
                        }
                        catch (Exception ex)
                        {
                            Label lab = new Label();
                            lab.Text = ex.ToString();
                            a.Add(lab);
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                SearchElementsPanel.Controls.Add(pagerPanel);
                pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";
                pagerPanel.DATA = a;
                pagerPanel.WIDTH = 429;

                pagerPanel.DataBind2();
            }
            catch (Exception ex)
            {
                ErrorLabel.Text = ex.ToString();
            }
        }
        return countInHash;
    }
    public void DataBind2()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (venueDS != null)
        {
            int venueCount = 0;
            if (venueDS.Tables.Count > 0)
                venueCount = venueDS.Tables[0].Rows.Count;

            ArrayList a = new ArrayList(venueCount);

            DateTime isn = DateTime.Now;

            if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn))
                isn = DateTime.Now;
            DateTime isNow = isn;
            Data dat = new Data(isn);

            string featureDate = isNow.Month.ToString() + "/" + isNow.Day.ToString() + "/" + isNow.Year.ToString();

            int searchTo = venueCount;

            if (dat.SearchCutOffNumber < venueCount)
            {
                searchTo = dat.SearchCutOffNumber;
            }
            int mapCount = 0;

            DataView dv = new DataView(venueDS.Tables[0], "", "", DataViewRowState.CurrentRows);

            ASP.controls_pager_ascx pagerPanel = new ASP.controls_pager_ascx();

            pagerPanel.NUMBER_OF_ITEMS_PER_PAGE = num_of_pages;
            if (Request.Url.AbsolutePath.ToLower() == "/venuesearch.aspx")
            {
                pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_VenueSearchElements_ctl00_Panel";
                pagerPanel.RUN_FUNCTION = "initialize";
                dv.Sort = "colOrder ASC";
            }
            else if (Request.Url.AbsolutePath.ToLower() == "/venuecategorysearch.aspx")
            {
                pagerPanel.PANEL_NAME = "ctl00_ContentPlaceHolder1_SearchElements_ctl00_Panel";
            }

            int countGotten = 0;
            foreach (DataRowView row in dv)
            {
                if (countGotten < searchTo)
                {
                    ASP.controls_venuesearchelement_ascx searchElement = new ASP.controls_venuesearchelement_ascx();
                    searchElement.Venue_ID = int.Parse(row["VID"].ToString());
                    searchElement.SEARCH_LABEL = dat.stripHTML(row["Name"].ToString());
                    searchElement.CITY = row["City"].ToString();
                    searchElement.STATE = row["State"].ToString();
                    searchElement.NUM_OF_ALL_RESULTS = searchTo;
                    if (bool.Parse(row["Featured"].ToString()))
                    {
                        if (row["DaysFeatured"].ToString().Contains(";" + featureDate + ";"))
                            searchElement.IS_FEATURED = true;
                        else
                            searchElement.IS_FEATURED = false;
                    }
                    else
                    {
                        searchElement.IS_FEATURED = false;
                    }
                    if (doMap)
                    {
                        searchElement.SEARCH_MAP_NUM = row["SearchNum"].ToString();
                    }

                    a.Add(searchElement);
                }
                else
                {
                    break;
                }
            }

            SearchElementsPanel.Controls.Add(pagerPanel);
            pagerPanel.PANEL_NAME = pagerPanel.ClientID + "_Panel";
            pagerPanel.DATA = a;
            pagerPanel.WIDTH = 420;
            pagerPanel.DataBind2();
        }
    }