protected void ChangeCheckImage(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        ImageButton CheckImageButton = (ImageButton)dat.FindControlRecursive(this, "CheckImageButton");

        if (CheckImageButton.ImageUrl == "image/Check.png")
            CheckImageButton.ImageUrl = "image/CheckSelected.png";
        else
        {
            CheckImageButton.ImageUrl = "image/Check.png";
            CheckBoxList CategoriesCheckBoxes = (CheckBoxList)dat.FindControlRecursive(this, "CategoriesCheckBoxes");
            for (int i = 0; i < CategoriesCheckBoxes.Items.Count; i++)
                CategoriesCheckBoxes.Items[i].Selected = false;
        }
    }
    protected void ChangeImage2(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        ImageButton ImageButton2 = (ImageButton)dat.FindControlRecursive(this, "ImageButton2");
        ImageButton ImageButton1 = (ImageButton)dat.FindControlRecursive(this, "ImageButton1");

        if (ImageButton2.ImageUrl == "image/RadioButton.png")
        {
            ImageButton2.ImageUrl = "image/RadioButtonSelected.png";
            ImageButton1.ImageUrl = "image/RadioButton.png";
        }
        else
        {
            ImageButton2.ImageUrl = "image/RadioButton.png";
            ImageButton1.ImageUrl = "image/RadioButton.png";
        }
    }
    protected void ChangeCheckImage(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        ImageButton CheckImageButton = (ImageButton)dat.FindControlRecursive(this, "CheckImageButton");

        if (CheckImageButton.ImageUrl == "image/Check.png")
            CheckImageButton.ImageUrl = "image/CheckSelected.png";
        else
            CheckImageButton.ImageUrl = "image/Check.png";
    }
    protected void AddTo(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string userID = "";
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        FormsAuthenticationTicket authTicket = null;
        try
        {
            authTicket = FormsAuthentication.Decrypt(authCookie.Value);
            string group = authTicket.UserData.ToString();

            if (group.Contains("User"))
            {
                userID = authTicket.Name;
            }
            else
            {
                Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                calendarLink.Visible = false;
            }
        }
        catch (Exception ex)
        {
        }

        dat.Execute("INSERT INTO User_Calendar (UserID, EventID, ExcitmentID, isConnect, DateAdded) VALUES(" + userID + ", " +
            Session["EventID"].ToString() + ", " + EventExcitmentDropDown.SelectedValue + ", '" +
            ConnectCheckBox.Checked.ToString() + "', '" + DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).ToString() + "')");

        Label label = (Label)dat.FindControlRecursive(this.Parent, "AddToLabel");
        LinkButton link = (LinkButton)dat.FindControlRecursive(this.Parent, "AddToLink");
        label.Text = "stufrf";
        label.Visible = true;
        link.Visible = false;

        dat.SendFriendAddNotification(Session["User"].ToString(), ID);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];

        FormsAuthenticationTicket authTicket = null;
        try
        {
            string group = "";
            if (authCookie != null)
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                group = authTicket.UserData.ToString();
            }

            if (group.Contains("Admin"))
            {
                if (group.Contains("User"))
                {
                    Session["User"] = authTicket.Name;
                    Session["UserName"] = dat.GetData("SELECT UserName FROM USERS WHERE User_ID="+authTicket.Name).Tables[0].Rows[0]["UserName"].ToString();
                    if(!IsPostBack)
                        SetPoll();
                }
                else
                {
                    if(!IsPostBack)
                        SetNotAnsweredPoll();
                }
            }
            else
            {
                ImageButton calendarLink = (ImageButton)dat.FindControlRecursive(this, "CalendarLink");
                calendarLink.Visible = false;
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        Button button = (Button)dat.FindControlRecursive(this, "AdsLink");
        button.CssClass = "NavBarImageAdSelected";
    }
    protected void ChangeCheckImage(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        ImageButton CheckImageButton = (ImageButton)dat.FindControlRecursive(this, "CheckImageButton");

        if (CheckImageButton.ImageUrl == "image/Check.png")
            CheckImageButton.ImageUrl = "image/CheckSelected.png";
        else
            CheckImageButton.ImageUrl = "image/Check.png";
    }
示例#8
0
    protected void FriendSearch(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        ClearMessage();
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        TextBox FriendSearchTextBox = (TextBox)dat.FindControlRecursive(this, "FriendSearchTextBox");

        Label FriendMessageLabel = (Label)dat.FindControlRecursive(this, "FriendMessageLabel");

        if (FriendSearchTextBox.Text != "" && dat.TrapKey(FriendSearchTextBox.Text, 1))
        {
            DataSet ds = dat.GetData("SELECT * FROM Users WHERE UserName LIKE '%" + FriendSearchTextBox.Text + "%'");

            if (ds.Tables.Count > 0)
                if (ds.Tables[0].Rows.Count > 0)
                {
                    FillSearchPanel(ds);
                    ViewState["FriendDS"] = ds;
                }
                else
                    FriendMessageLabel.Text = "0 Results Found.";
            else
                FriendMessageLabel.Text = "0 Results Found.";
        }
        else
            FriendMessageLabel.Text = "Include a valid User Name in the text field.";
    }
    protected void AddToVenue(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string userID = "";
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        FormsAuthenticationTicket authTicket = null;
        try
        {
            authTicket = FormsAuthentication.Decrypt(authCookie.Value);
            string group = authTicket.UserData.ToString();

            if (group.Contains("User"))
            {
                userID = authTicket.Name;
            }
            else
            {
                Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                calendarLink.Visible = false;
            }
        }
        catch (Exception ex)
        {
        }

        dat.Execute("INSERT INTO UserVenues (UserID, VenueID) VALUES(" + userID + ", " + Session["VenueID"].ToString()+")");
    }
    protected void SendIt(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string userID = "";
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        FormsAuthenticationTicket authTicket = null;
        try
        {
            authTicket = FormsAuthentication.Decrypt(authCookie.Value);
            string group = authTicket.UserData.ToString();

            if (group.Contains("User"))
            {
                userID = authTicket.Name;
            }
            else
            {
                Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                calendarLink.Visible = false;
            }
        }
        catch (Exception ex)
        {
        }

        string toUserID = Session["ViewedUser"].ToString();

        string subject = "";

        if (Session["Subject"].ToString() == "")
            subject = SubjectTextBox.Text;
        else
            subject = Session["Subject"].ToString();

        if (subject != "")
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());

            conn.Open();
            SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode)"
                + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 0)", conn);
            cmd.Parameters.Add("@content", SqlDbType.Text).Value = MessageTextBox.Text;
            cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = subject;
            cmd.Parameters.Add("@toID", SqlDbType.Int).Value = int.Parse(toUserID);
            cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = int.Parse(userID);
            cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
            cmd.ExecuteNonQuery();
            conn.Close();
        }
    }
示例#11
0
    protected void ServerReply(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        bool goOn = false;

        if (Session["NotFinished"] == null)
        {
            Session["NotFinished"] = true;
            if (Session["TimeReplySubmitted"] == null)
                goOn = true;
            else
            {
                if (DateTime.Now < ((DateTime)Session["TimeReplySubmitted"]).AddSeconds(2))
                {
                    goOn = false;
                }
                else
                {
                    goOn = true;
                }
            }

            if (goOn)
            {
                try
                {
                    Session["TimeReplySubmitted"] = DateTime.Now;

                    LinkButton link = (LinkButton)sender;
                    string[] delim = { "reply" };

                    string[] tokens = link.CommandArgument.Split(delim, StringSplitOptions.None);

                    TextBox textbox = (TextBox)dat.FindControlRecursive(this, tokens[0] + "textbox" + tokens[1]);

                    Panel panel = (Panel)dat.FindControlRecursive(this, "RadPanel" + tokens[1]);

                    int To_ID = int.Parse(tokens[0]);

                    DataSet ds = dat.GetData("SELECT * FROM UserMessages WHERE ID=" + tokens[1]);

                    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());

                    conn.Open();
                    SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, " +
                        "From_UserID, To_UserID, Date, [Read], Mode)"
                        + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 0)", conn);
                    cmd.Parameters.Add("@content", SqlDbType.Text).Value = textbox.Text;
                    cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "Re: " + ds.Tables[0].Rows[0]["MessageSubject"].ToString();
                    cmd.Parameters.Add("@toID", SqlDbType.Int).Value = To_ID;
                    cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = Session["User"].ToString();
                    cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
                    cmd.ExecuteNonQuery();

                    DataSet dsUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + Session["User"].ToString());
                    DataSet dsTo = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.User_ID=" + To_ID);

                    //only send to email if users preferences are set to do so.
                    if (dsTo.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("4"))
                    {
                        dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"],
                            System.Configuration.ConfigurationManager.AppSettings["emailName"],
                            dsTo.Tables[0].Rows[0]["Email"].ToString(), textbox.Text, "Re: " + ds.Tables[0].Rows[0]["MessageSubject"].ToString());
                    }
                    conn.Close();

                    Literal lit = new Literal();
                    lit.Text = "<div align=\"left\" style=\"width: 220px; margin: 5px; float: right;\" class=\"Green12LinkNF\">Your reply has been sent!</div>";

                    panel.Controls.AddAt(7, lit);

                    Session["NotFinished"] = null;
                    Session.Remove("NotFinished");
                }
                catch (Exception ex)
                {
                    MessagesErrorLabel.Text += " " + ex.ToString();

                    Session["NotFinished"] = null;
                    Session.Remove("NotFinished");
                }
            }
            else
            {
                LinkButton link = (LinkButton)sender;
                string[] delim = { "reply" };

                string[] tokens = link.CommandArgument.Split(delim, StringSplitOptions.None);

                Panel panel = (Panel)dat.FindControlRecursive(this, "RadPanel" + tokens[1]);

                Literal lit = new Literal();
                lit.Text = "<div align=\"left\" style=\"height: 30px; width: 220px; margin: 5px; float: right;\" class=\"Green12LinkNF\">Your reply has been sent!</div>";

                panel.Controls.AddAt(7, lit);

                Session["NotFinished"] = null;
                Session.Remove("NotFinished");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        SummaryTextBox.Attributes.Add("onkeyup", "CountChars()");

        HtmlLink lk = new HtmlLink();
        HtmlHead head = (HtmlHead)Page.Header;
        lk.Attributes.Add("rel", "canonical");
        lk.Href = "http://hippohappenings.com/PostAnAd.aspx";
        head.Controls.AddAt(0, lk);

        HtmlMeta kw = new HtmlMeta();
        kw.Name = "keywords";
        kw.Content = "post local ad in your neighborhood for your community interest groups";

        head.Controls.AddAt(0, kw);

        HtmlMeta hm = new HtmlMeta();
        hm.Name = "description";
        hm.Content = "Post local ads in your neighborhood which will be posted in your community and interest groups";

        head.Controls.AddAt(0, hm);

        lk = new HtmlLink();
        lk.Href = "http://" + Request.Url.Authority + "/PostAnAd.aspx";
        lk.Attributes.Add("rel", "bookmark");
        head.Controls.AddAt(0, lk);

        try
        {
            HttpCookie cookie = Request.Cookies["BrowserDate"];
            if (cookie == null)
            {
                cookie = new HttpCookie("BrowserDate");
                cookie.Value = DateTime.Now.ToString();
                cookie.Expires = DateTime.Now.AddDays(22);
                Response.Cookies.Add(cookie);
            }
            StartDateTimePicker.MinDate = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Subtract(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).TimeOfDay);
            Session["RedirectTo"] = Request.Url.AbsoluteUri;
            if (!IsPostBack)
            {
                Session["UserAvailableDate"] = null;
                Session.Remove("UserAvailableDate");
                Session["RedirectTo"] = "PostAnAd.aspx";
                Session["categorySession"] = null;

            }

            if (Session["UserAvailableDate"] != null)
            {
                bool isBig = false;
                if (AdPlacementList.SelectedValue == "0.04")
                    isBig = true;
                //GetAvailableUsers((DateTime)Session["UserAvailableDate"], isBig);
            }

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

            Button button = (Button)dat.FindControlRecursive(this, "Button1");
            button.CssClass = "NavBarImageAddAdSelected";

            DataView dv = dat.GetDataDV("SELECT * FROM TermsAndConditions");
            Literal lit1 = new Literal();
            lit1.Text = "<div style=\"padding-bottom: 20px;\">"+dv[0]["Content"].ToString()+"</div>";
            TACTextBox.Controls.Add(lit1);

            if (Session["User"] != null)
            {
                LoggedInPanel.Visible = true;
            }
            else
            {
                WelcomeLabel.Text = "HippoHappenings's delivers content for users by users. " +
                "You have all the power to post events, advertisements and venues. " +
                "Users are responsible for all posted content, so mind " +
                "what you post. Everyone has the power to flag content deemed expressly " +
                "offensive, illegal or corporate in nature. In order to make this possible, " +
                "and for us to maintain clean and manageable content, we require that you " +
                "<a class=\"AddLink\" href=\"Register.aspx\">create an account</a> with us. If you already have an account, <a class=\"AddLink\" href=\"UserLogin.aspx\">login</a> and post your ad!";
                //WelcomeLabel.Text = "On Hippo Happenings, the users have all the power to post event, ads and venues alike. In order to do so, and for us to maintain clean and manageable content,  "
                //    + " we require that you <a class=\"AddLink\" href=\"Register.aspx\">create an account</a> with us. <a class=\"AddLink\" href=\"UserLogin.aspx\">Log in</a> if you have an account already. " +
                //    "Having an account with us will allow you to do many other things as well. You'll will be able to add events to your calendar, communicate with others going to events, add your friends, filter content based on your preferences, " +
                //    " feature your ads throughout the site and much more. <br/><br/>So let's go <a class=\"AddLink\" style=\"font-size: 16px;\" href=\"Register.aspx\">Register!</a>";
            }

            try
            {
                if (!IsPostBack)
                {

                    DataSet dsCountry = dat.GetData("SELECT * FROM Countries");
                    CountryDropDown.DataSource = dsCountry;
                    CountryDropDown.DataTextField = "country_name";
                    CountryDropDown.DataValueField = "country_id";
                    CountryDropDown.DataBind();

                    CountryDropDown.SelectedValue = "223";

                    DataSet ds = dat.GetData("SELECT * FROM State WHERE country_id=223");

                    StateDropDownPanel.Visible = true;
                    StateTextBoxPanel.Visible = false;
                    StateDropDown.DataSource = ds;
                    StateDropDown.DataTextField = "state_2_code";
                    StateDropDown.DataValueField = "state_id";
                    StateDropDown.DataBind();
                }

                MusicUploadButton.PostBackUrl = Request.Url.AbsoluteUri;
                ImageButton1.PostBackUrl = Request.Url.AbsoluteUri;
                ImageButton10.PostBackUrl = Request.Url.AbsoluteUri;
                ImageButton5.PostBackUrl = Request.Url.AbsoluteUri;

                if (Session["User"] != null)
                {

                    Session["UserName"] = dat.GetData("SELECT UserName FROM Users WHERE User_ID=" + Session["User"].ToString()).Tables[0].Rows[0]["UserName"].ToString();
                    //Session["EffectiveUserName"] = Session["UserName"].ToString();
                    LoggedInPanel.Visible = true;
                    LogInPanel.Visible = false;
                    if (Request.QueryString["edit"] != null)
                        if (bool.Parse(Request.QueryString["edit"].ToString()))
                        {
                            string IDi = Request.QueryString["ID"].ToString();
                            if (Request.Cookies["editAd" + IDi] != null)
                            {
                                if (bool.Parse(Request.Cookies["editAd" + IDi].Value))
                                {
                                    DataSet dsAd = dat.GetData("SELECT * FROM Ads WHERE Ad_ID=" + Request.QueryString["ID"].ToString());

                                    if (Session["User"].ToString() == dsAd.Tables[0].Rows[0]["User_ID"].ToString())
                                    {

                                        isEdit.Text = "True";
                                        adID.Text = IDi;
                                        if (!IsPostBack)
                                        {
                                            fillAd(IDi);
                                        }

                                        IntroPanel.Visible = false;
                                        TabsPanel.Visible = true;
                                    }
                                    else
                                    {
                                        Response.Redirect("Home.aspx");
                                    }
                                }
                            }

                        }
                        else
                        {
                            Response.Redirect("Home.aspx");
                        }
                }
                else
                {
                    LoggedInPanel.Visible = false;
                    LogInPanel.Visible = true;
                }
            }
            catch (Exception ex)
            {
                YourMessagesLabel.Text = ex.ToString();
                MessagePanel.Visible = true;
                //Session.Abandon();
                //FormsAuthentication.SignOut();
                //Response.Redirect("~/UserLogin.aspx");
            }

            //YourMessagesLabel.Text = "";
            //MessagePanel.Visible = false;

            if (!IsPostBack)
            {
                //DataSet ds = dat.GetData("SELECT * FROM Categories");

                //CategoriesCheckBoxes.DataSource = ds;
                //CategoriesCheckBoxes.DataTextField = "CategoryName";
                //CategoriesCheckBoxes.DataValueField = "ID";
                //CategoriesCheckBoxes.DataBind();

                ShowVideoPictureLiteral.Text = "";

                //Button adsLink = (Button)dat.FindControlRecursive(this, "AdsLink");
                //adsLink.CssClass = "NavBarImageAdSelected";

                DataView dvAdControl = dat.GetDataDV("SELECT * FROM AdControl");
                if (bool.Parse(dvAdControl[0]["areAdsFree"].ToString()))
                {
                    FreeLabel.Text = "Choose how many users you want to see your ad. " +
                        "<span style='color: #ff770d;'>[As the ads are now free, your limit on the number of users you can choose is " +
                        dvAdControl[0]["userLimit"].ToString() + ".] </span><br/>Your price will be calulated based on the number of " +
                "users you want your ad to be displayed to. Your ad will stop running " +
                "when that particular number of users have seen your ad. The price for " +
                "each user is $0.01, since you have chosen the 'Normal Ad Space'. " +
                "For example, if you choose 1000 users, your cost will be $10.";
                    FreeValidator.MaximumValue = dvAdControl[0]["userLimit"].ToString();
                    FreeFeaturedAdsPanel.Visible = true;
                    //FreeFeaturedAdPanel2.Visible = false;
                    FreeFeaturedAdPanel3.Visible = true;
                    FreeFeaturedAdPanel4.Visible = true;
                    AdPlacementList.Items[0].Text = "Normal Ad  <span style='color: #ff770d;'>[usually $0.01/user, today it is free. Limit of users is " + dvAdControl[0]["userLimit"].ToString() + "]</span>";
                    AdPlacementList.Items[1].Text = "Big Ad  <span style='color: #ff770d;'>[usually $0.04/user, today it is free. Limit of users is " + dvAdControl[0]["bigUserLimit"].ToString() + "]</span>";
                    FreeValidator.Visible = true;
                }
                else
                {
                    FreeValidator.Visible = false;
                    FreeLabel.Text = "Choose how many users you want to see your ad.<br/>Your price will be calulated based on the number of " +
                "users you want your ad to be displayed to. Your ad will stop running " +
                "when that particular number of users have seen your ad. The price for " +
                "each user is $0.01, since you have chosen the 'Normal Ad Space'. " +
                "For example, if you choose 1000 users, your cost will be $10.";
                }
            }
        }
        catch (Exception ex)
        {
            YourMessagesLabel.Text = ex.ToString();
            MessagePanel.Visible = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Session["Type"] = "Venue";
        Session["VenueID"] = VenueID;
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];

        if (IsPostBack)
        {
            MessageRadWindowManager.VisibleOnPageLoad = false;
        }

        FormsAuthenticationTicket authTicket = null;
        try
        {
            string group = "";
            if (authCookie != null)
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                group = authTicket.UserData.ToString();
            }

            if (group.Contains("User"))
            {
                Session["User"] = authTicket.Name;
                DataSet ds1 = dat.GetData("SELECT UserName FROM Users WHERE User_ID=" + authTicket.Name);
                Session["UserName"] = ds1.Tables[0].Rows[0]["UserName"].ToString();
            }
            else
            {
                Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                calendarLink.Visible = false;
            }
        }
        catch (Exception ex)
        {
        }

        DataSet ds = dat.GetData("SELECT * FROM UserVenues WHERE UserID="+Session["User"].ToString() + " AND VenueID="+VenueID.ToString());

        if (ds.Tables.Count > 0)
            if (ds.Tables[0].Rows.Count > 0)
            {
                AddToLabel.Text = "This venue is one of your favorites";
                AddToLabel.CssClass = "AddLinkGoing";
                AddToLabel.Visible = true;
                ImagePanel.Visible = false;
            }
            else
            {
                AddToLink.Text = "Add this venue to my favorites";
                AddToLink.Visible = true;
                ImagePanel.Visible = true;
            }
        else
        {
            AddToLink.Text = "Add this venue to my favorites";
            AddToLink.Visible = true;
            ImagePanel.Visible = true;
        }
    }
    //protected void Search(object sender, EventArgs e)
    //{
    //    if (SearchTextBox.THE_TEXT != "")
    //    {
    //        char[] delim = { ' ' };
    //        string[] tokens;
    //        tokens = SearchTextBox.THE_TEXT.Split(delim);
    //        string temp = "";
    //        for (int i = 0; i < tokens.Length; i++)
    //        {
    //            temp += " E.Header LIKE @search" + i.ToString();
    //            if (i + 1 != tokens.Length)
    //                temp += " AND ";
    //        }
    //        string searchStr = "SELECT DISTINCT E.ID AS EID, V.ID AS VID, * FROM Events E, Venues V, Event_Occurance EO WHERE E.ID=EO.EventID AND E.Venue=V.ID AND " + temp;
    //        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
    //        if (conn.State != ConnectionState.Open)
    //            conn.Open();
    //        SqlCommand cmd = new SqlCommand(searchStr, conn);
    //        for (int i = 0; i < tokens.Length; i++)
    //        {
    //            cmd.Parameters.Add("@search" + i.ToString(), SqlDbType.NVarChar).Value = "%" + tokens[i] + "%";
    //        }
    //        DataSet ds = new DataSet();
    //        SqlDataAdapter da = new SqlDataAdapter(cmd);
    //        da.Fill(ds);
    //        conn.Close();
    //        Session["EventSearchDS"] = ds;
    //    }
    //    Response.Redirect("EventSearch.aspx");
    //}
    protected void Page_Init(object sender, EventArgs e)
    {
        try
        {
            HttpCookie cookie = Request.Cookies["BrowserDate"];
            if (cookie == null)
            {
                cookie = new HttpCookie("BrowserDate");
                cookie.Value = DateTime.Now.ToString();
                cookie.Expires = DateTime.Now.AddDays(22);
                Response.Cookies.Add(cookie);
            }
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            string cookieName = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie = Context.Request.Cookies[cookieName];

            if (!IsPostBack)
            {
                FormsAuthenticationTicket authTicket = null;
                try
                {
                    string group = "";
                    if (authCookie != null)
                    {
                        authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                        group = authTicket.UserData.ToString();
                    }

                    if (group.Contains("User"))
                    {
                        //DataSet ds2 = dat.RetrieveAds(Session["User"].ToString(), false);
                        //DataSet dsMain = dat.RetrieveMainAds(Session["User"].ToString());
                        //Ads1.DATA_SET = ds2;
                        //Ads1.MAIN_AD_DATA_SET = dsMain;
                    }
                    else
                    {
                        //Ads1.DATA_SET = dat.RetrieveAllAds(false);
                        //Ads1.MAIN_AD_DATA_SET = dat.RetrieveAllAds(true);
                    }
                }
                catch (Exception ex)
                {
                    //Response.Redirect("~/UserLogin.aspx");
                }
            }
            Button button = (Button)dat.FindControlRecursive(this, "HomeLink");
            button.CssClass = "NavBarImageHomeSelected";
        }
        catch (Exception ex)
        {
            ErrorLabel.Text = ex.ToString();
        }
    }
    protected void DoAll()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (Session["User"] != null)
        {
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            string cookieName = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie = Context.Request.Cookies[cookieName];

            FormsAuthenticationTicket authTicket = null;
            try
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                string group = authTicket.UserData.ToString();

                if (group.Contains("User"))
                {
                    Session["User"] = authTicket.Name;
                    Session["UserName"] = dat.GetData("SELECT UserName FROM USERS WHERE User_ID=" + Session["User"].ToString()).Tables[0].Rows[0]["UserName"].ToString();
                }
                else
                {
                    Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                    calendarLink.Visible = false;
                    Response.Redirect("~/UserLogin.aspx");
                }
            }
            catch (Exception ex)
            {
                Response.Redirect("~/UserLogin.aspx");
            }

            Session["UserName"] = dat.GetData("SELECT * FROM Users WHERE User_ID=" +
                Session["User"].ToString()).Tables[0].Rows[0]["UserName"].ToString();
            UserLabel.Text = Session["UserName"].ToString();
            ClearMessage();
            CalendarLink.NavigateUrl = "UserCalendar.aspx?ID=" + Session["User"].ToString();
            if (IsPostBack)
            {
                if (ViewState["FriendDS"] != null)
                    FillSearchPanel((DataSet)ViewState["FriendDS"]);
            }
            FillVenues();
            FillRecommendedEvents();

                LoadControlsNotAJAX();

            LoadFriends();

            LoadGlanceCalendar();
            FillGroups();
            //GetFriendEvents();

        }
        else
        {
            ErrorLabel.Text = "somtin happen";
            Response.Redirect("UserLogin.aspx");
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string USER_ID = "";
        try
        {
            //Ajax.Utility.RegisterTypeForAjax(typeof(User));

            //if (!IsPostBack)
            //{
            //    FriendsButton.Attributes.Add("onmouseover", "this.src='image/MyFriendsHover.png'");
            //    FriendsButton.Attributes.Add("onmouseout", "this.src='image/MyFriends.png'");

            //}
            //else
            //{
            //    FriendsButton.Attributes.Remove("onmouseover");
            //    FriendsButton.Attributes.Remove("onmouseout");
            //    MessagesButton.Attributes.Remove("onmouseover");
            //    MessagesButton.Attributes.Remove("onmouseout");
            //}

            //FOR USER PREFERENCES
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            MessageRadWindowManager.VisibleOnPageLoad = false;

            if (!IsPostBack)
            {
                try
                {

                    if (Session["User"] != null)
                    {
                    }
                    else
                    {
                        Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                        calendarLink.Visible = false;
                        Response.Redirect("~/UserLogin.aspx");
                    }
                }
                catch (Exception ex)
                {
                    ErrorLabel.Text = ex.ToString();
                   Response.Redirect("~/UserLogin.aspx");
                }

                USER_ID = Session["User"].ToString();

                //DataSet dsCat = dat.GetData("SELECT * FROM Categories");
                //CategoriesCheckBoxes.DataSource = dsCat;
                //CategoriesCheckBoxes.DataTextField = "CategoryName";
                //CategoriesCheckBoxes.DataValueField = "ID";
                //CategoriesCheckBoxes.DataBind();

                DataSet dsProvider = dat.GetData("SELECT * FROM PhoneProviders");
                ProviderDropDown.DataSource = dsProvider;
                ProviderDropDown.DataTextField = "Provider";
                ProviderDropDown.DataValueField = "ID";
                ProviderDropDown.DataBind();

                Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
                DataSet ds = d.GetData("SELECT * FROM Events E, Venues V, Event_Occurance EO, User_Calendar UC WHERE UC.EventID=E.ID AND E.ID=EO.EventID AND E.Venue=V.ID AND UC.UserID=" + USER_ID);
                DataSet dsUser = d.GetData("SELECT * FROM Users WHERE User_ID=" + USER_ID);
                DataSet dsUserPrefs = d.GetData("SELECT * FROM UserPreferences WHERE UserID=" + USER_ID);

                if (dsUser.Tables[0].Rows[0]["FirstName"] != null)
                    FirstNameTextBox.THE_TEXT = dsUser.Tables[0].Rows[0]["FirstName"].ToString();

                if (dsUser.Tables[0].Rows[0]["LastName"] != null)
                    LastNameTextBox.THE_TEXT = dsUser.Tables[0].Rows[0]["LastName"].ToString();

                if (dsUserPrefs.Tables.Count > 0)
                    if (dsUserPrefs.Tables[0].Rows.Count > 0)
                    {
                        //AgeTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Age"].ToString();
                        SexTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Sex"].ToString();

                        LocationTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Location"].ToString();

                        string eventsPosted = "0";
                        DataSet dsEvents = dat.GetData("SELECT COUNT(*) AS COUNT1 FROM Events WHERE UserName='******'");
                        if (dsEvents.Tables.Count > 0)
                            if (dsEvents.Tables[0].Rows.Count > 0)
                                eventsPosted = dsEvents.Tables[0].Rows[0]["COUNT1"].ToString();
                        EventsLabel.Text = eventsPosted;
                        AttendedLabel.Text = dsUserPrefs.Tables[0].Rows[0]["EventsAttended"].ToString();

                        if (dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString() != null)
                        {
                            PublicPrivateCheckList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString();
                        }

                        //if (dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString() != null)
                        //{
                        //    PollRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString();
                        //}

                        if (dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString() != null)
                        {
                            CommentsRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString();
                        }
                        RadioButtonList CategoriesOnOffRadioList = (RadioButtonList)AdCategoryRadPanel.Items[0].Items[0].FindControl("CategoriesOnOffRadioList");
                        if (dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString() != null)
                        {
                            if (bool.Parse(dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString()))
                                CategoriesOnOffRadioList.SelectedValue = "1";
                            else
                                CategoriesOnOffRadioList.SelectedValue = "2";
                        }

                        if(dsUserPrefs.Tables[0].Rows[0]["RecommendationPrefs"].ToString() != null){
                            string recom = dsUserPrefs.Tables[0].Rows[0]["RecommendationPrefs"].ToString();
                            if (recom.Contains("1"))
                                RecommendationsCheckList.Items[0].Selected = true;
                            if (recom.Contains("2"))
                                RecommendationsCheckList.Items[1].Selected = true;
                            if (recom.Contains("3"))
                                RecommendationsCheckList.Items[2].Selected = true;
                        }

                        if (dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString() != null)
                        {
                            CommunicationPrefsRadioList.SelectedValue =
                                dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString();
                        }

                        if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString() != null)
                        {
                            if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString().Trim() != "")
                            {
                                if (dsUserPrefs.Tables[0].Rows[0]["Address"].ToString() != null)
                                {
                                    AddressTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["Address"].ToString();
                                }

                                if (dsUserPrefs.Tables[0].Rows[0]["City"].ToString() != null)
                                {
                                    BillCityTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["City"].ToString();
                                }

                                if (dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString() != null)
                                {
                                    ZipTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString();
                                }

                                BillCountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["Country"].ToString();

                                DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["Country"].ToString());

                                bool isText = false;
                                if (dsStates.Tables.Count > 0)
                                    if (dsStates.Tables[0].Rows.Count > 0)
                                    {
                                        BillStateDropDown.DataSource = dsStates;
                                        BillStateDropDown.DataTextField = "state_2_code";
                                        BillStateDropDown.DataValueField = "state_id";
                                        BillStateDropDown.DataBind();
                                        BillStateDropDown.Items.Insert(0, new ListItem("Select State..", "-1"));

                                        if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null)
                                        {
                                            ListItem a = BillStateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["State"].ToString());
                                            if (a != null)
                                                BillStateDropDown.SelectedValue = a.Value;
                                        }

                                        BillStateDropPanel.Visible = true;
                                        BillStateTextPanel.Visible = false;
                                    }
                                    else
                                    {
                                        isText = true;
                                    }
                                else
                                    isText = true;

                                if (isText)
                                {
                                    if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null)
                                    {
                                        BillStateTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["State"].ToString();
                                    }
                                    BillStateTextPanel.Visible = true;
                                    BillStateDropPanel.Visible = false;
                                }
                            }
                        }
                        if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString() != null)
                        {
                            if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString().Trim() != "")
                            {
                                if (dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString() != null)
                                {
                                    CityTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString();
                                }

                                if (dsUserPrefs.Tables[0].Rows[0]["CatZip"].ToString() != null)
                                {
                                    if (dsUserPrefs.Tables[0].Rows[0]["CatZip"].ToString().Trim() != "")
                                    {
                                        char[] delim = { ';' };
                                        string[] tokens = dsUserPrefs.Tables[0].Rows[0]["CatZip"].ToString().Split(delim);

                                        if(tokens.Length > 1)
                                            CatZipTextBox.THE_TEXT = tokens[1].Trim();
                                    }
                                }

                                if (dsUserPrefs.Tables[0].Rows[0]["Radius"].ToString() != null)
                                {
                                    RadiusDropDown.SelectedValue =
                                        dsUserPrefs.Tables[0].Rows[0]["Radius"].ToString();
                                }

                                CountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString();

                                DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString());

                                bool isText = false;
                                if (dsStates.Tables.Count > 0)
                                    if (dsStates.Tables[0].Rows.Count > 0)
                                    {
                                        StateDropDown.DataSource = dsStates;
                                        StateDropDown.DataTextField = "state_2_code";
                                        StateDropDown.DataValueField = "state_id";
                                        StateDropDown.DataBind();

                                        if (dsUserPrefs.Tables[0].Rows[0]["CatState"] != null)
                                        {
                                            StateDropDown.SelectedValue = StateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString()).Value;
                                        }

                                        StateDropDownPanel.Visible = true;
                                        StateTextBoxPanel.Visible = false;
                                    }
                                    else
                                    {
                                        isText = true;
                                    }
                                else
                                    isText = true;

                                if (isText)
                                {
                                    if (dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString() != null)
                                    {
                                        StateTextBox.THE_TEXT = dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString();
                                    }
                                    StateTextBoxPanel.Visible = true;
                                    StateDropDownPanel.Visible = false;
                                }
                            }
                        }
                        if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString() != null)
                        {
                            if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("1"))
                                TextingCheckBoxList.Items[0].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("2"))
                                TextingCheckBoxList.Items[1].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("3"))
                                TextingCheckBoxList.Items[2].Selected = true;
                        }

                        if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString() != null)
                        {
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("1"))
                                EmailCheckList.Items[0].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("2"))
                                EmailCheckList.Items[1].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("3"))
                                EmailCheckList.Items[2].Selected = true;

                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[0].Value))
                                EmailUserCheckList1.Items[0].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[1].Value))
                                EmailUserCheckList1.Items[1].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[2].Value))
                                EmailUserCheckList1.Items[2].Selected = true;

                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[0].Value))
                                EmailUserCheckList2.Items[0].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[1].Value))
                                EmailUserCheckList2.Items[1].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[2].Value))
                                EmailUserCheckList2.Items[2].Selected = true;

                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("C"))
                                EmailCheckList3.Items[0].Selected = true;
                        }
                    }

                DataSet dsComments = d.GetData("SELECT * FROM User_Comments CU, Users U WHERE CU.CommenterID=U.User_ID AND CU.UserID=" + USER_ID.ToString());
                //Label UserNameLabel = (Label)Tab3.FindControl("UserNameLabel");

                //UserNameLabel.Text = dsUser.Tables[0].Rows[0]["UserName"].ToString();

                if (dsUser.Tables[0].Rows[0]["Email"].ToString() != null)
                {
                    EmailTextBox.Text = dsUser.Tables[0].Rows[0]["Email"].ToString();
                }

                if (dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString() != null)
                {
                    PhoneTextBox.THE_TEXT = dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString();
                }

                if (dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString() != null)
                {
                    ProviderDropDown.SelectedValue = dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString();
                }

                Image FriendImage = (Image)Tab3.FindControl("FriendImage");

                if (dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString() != null)
                {
                    if (System.IO.File.Exists(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString()))
                    {
                        System.Drawing.Image theimg = System.Drawing.Image.FromFile(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() +
                "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString());

                        double width = double.Parse(theimg.Width.ToString());
                        double height = double.Parse(theimg.Height.ToString());

                        if (width > height)
                        {
                            if (width <= 150)
                            {

                            }
                            else
                            {
                                double dividor = double.Parse("150.00") / double.Parse(width.ToString());
                                width = double.Parse("150.00");
                                height = height * dividor;
                            }
                        }
                        else
                        {
                            if (width == height)
                            {
                                width = double.Parse("150.00");
                                height = double.Parse("150.00");
                            }
                            else
                            {
                                double dividor = double.Parse("150.00") / double.Parse(height.ToString());
                                height = double.Parse("150.00");
                                width = width * dividor;
                            }
                        }

                        FriendImage.Width = int.Parse((Math.Round(decimal.Parse(width.ToString()))).ToString());
                        FriendImage.Height = int.Parse((Math.Round(decimal.Parse(height.ToString()))).ToString());

                        FriendImage.ImageUrl = "~/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString();
                        Session["ProfilePicture"] = dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString();
                    }
                    else
                    {
                        FriendImage.ImageUrl = "~/NewImages/NoAvatar150.jpg";
                    }
                }
                else
                    FriendImage.ImageUrl = "~/NewImages/NoAvatar150.jpg";
            }
            else
            {
                if (Session["User"] == null)
                {
                    ErrorLabel.Text = "something happen";
                    //Session.Abandon();
                    Response.Redirect("~/UserLogin.aspx");

                }
            }

            DataSet dsVenues = dat.GetData("SELECT * FROM UserVenues UV, Venues V WHERE V.ID=UV.VenueID AND UV.UserID=" + Session["User"].ToString());

            VenuesRadPanel.Items[0].Text = "<div style=\" background-color: #1b1b1b; cursor: pointer;" +
                "\"><label class=\"PreferencesTitle\" style=\"cursor: pointer !important;\">Favorite Venues</label><span " +
                "style=\"font-style: italic; font-family: Arial; font-size: 14px; color: #666666;\">" +
                " (Click to drop down the list. Un-check to remove a venue from the favorites list.)</span></div>";

            //"<div style=\"border-bottom: dotted 1px black; " +
            //    "padding-top: 10px;\"><label class=\"PreferencesTitle\">Favorite Venues</label><span " +
            //    "style=\"font-style: italic; font-family: Arial; font-size: 14px; color: #666666;\">" +
            //    "(You can add these from the <a href=\"VenueSearch.aspx\" class=\"AddLink\">Venues Page</a>. " +
            //    "Un-check to remove a venue from the favorites list.)</span></div>";

            CheckBoxList VenueCheckBoxes = new CheckBoxList();
            VenueCheckBoxes.Width = 560;
            VenueCheckBoxes.CssClass = "VenueCheckBoxes";
            VenueCheckBoxes.ID = "VenueCheckBoxes";
            VenueCheckBoxes.RepeatColumns = 4;
            VenueCheckBoxes.RepeatDirection = RepeatDirection.Horizontal;

            VenueCheckBoxes.DataSource = dsVenues;
            VenueCheckBoxes.DataTextField = "NAME";
            VenueCheckBoxes.DataValueField = "ID";
            VenueCheckBoxes.DataBind();

            for (int i = 0; i < VenueCheckBoxes.Items.Count; i++)
            {
                VenueCheckBoxes.Items[i].Selected = true;
            }

            if (VenueCheckBoxes.Items.Count == 0)
            {
                Label label = new Label();
                label.CssClass = "VenueCheckBoxes";
                label.Text = "You have no venues specified as your favorite. To add venues as your favorites search for them on the <a href=\"VenueSearch.aspx\" class=\"AddLink\">Venues Page</a>";
                VenuesRadPanel.Items[0].Items[0].Controls.Add(label);
            }
            else
            {
                VenuesRadPanel.Items[0].Items[0].Controls.Add(VenueCheckBoxes);
            }

            VenuesRadPanel.CollapseAllItems();
        }
        catch (Exception ex)
        {
            UserErrorLabel.Text = ex.ToString();
        }

        if (Request.QueryString["p"] != null)
        {
            RadTabStrip2.Tabs[2].Selected = true;
            RadTabStrip2.Tabs[2].CssClass = "MyTabsPreferencesSelected";
            RadTabStrip2.Tabs[0].CssClass = "MyTabsMessages";
            RadTabStrip2.Tabs[1].CssClass = "MyTabsFriends";
            TheMultipage.PageViews[2].Selected = true;
        }

        if (Request.QueryString["G"] != null)
        {
            RadTabStrip2.Tabs[3].Selected = true;
            RadTabStrip2.Tabs[3].CssClass = "MyTabsGroupsSelected";
            RadTabStrip2.Tabs[0].CssClass = "MyTabsMessages";
            RadTabStrip2.Tabs[1].CssClass = "MyTabsFriends";
            RadTabStrip2.Tabs[2].CssClass = "MyTabsPreferences";
            TheMultipage.PageViews[3].Selected = true;
        }
    }
示例#17
0
    protected void FillSearchPanel(DataSet ds)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        Panel SearchResultsPanel = (Panel)dat.FindControlRecursive(this, "SearchResultsPanel");
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            Image image = new Image();
            image.Width = 50;
            image.Height = 50;

            if (System.IO.File.Exists(Server.MapPath(".") + "\\UserFiles\\" + ds.Tables[0].Rows[i]["UserName"].ToString() + "\\Profile\\" + ds.Tables[0].Rows[i]["ProfilePicture"].ToString()))
            {
                image.ImageUrl = "~/UserFiles/" + ds.Tables[0].Rows[i]["UserName"].ToString() + "/Profile/" + ds.Tables[0].Rows[i]["ProfilePicture"].ToString();
            }
            else
                image.ImageUrl = "~/NewImages/noAvatar_50x50_small.png";

            Label label = new Label();
            label.Text = ds.Tables[0].Rows[i]["UserName"].ToString();

            LinkButton link = new LinkButton();
            link.Text = "Add Friend";
            link.CssClass = "NavyLink12";
            link.CausesValidation = false;
            link.ID = "link" + i.ToString();
            link.CommandArgument = ds.Tables[0].Rows[i]["User_ID"].ToString();
            link.Click += new EventHandler(this.AddFriend);

            SearchResultsPanel.Controls.Add(image);
            SearchResultsPanel.Controls.Add(label);
            SearchResultsPanel.Controls.Add(link);
        }
    }
示例#18
0
    protected void DeleteMessages(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        try
        {
            CheckBox check;
            DataSet ds = dat.GetData("SELECT DISTINCT TOP 100 UM.From_UserID, UM.To_UserID, UM.ID FROM UserMessages UM, Users U WHERE (UM.To_UserID=" +
            Session["User"].ToString() + " AND UM.Live=1) ORDER BY UM.From_UserID, UM.To_UserID, UM.ID DESC");

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

            foreach (DataRowView row in dv)
            {
                check = (CheckBox)dat.FindControlRecursive(this, "X" + row["ID"].ToString());

                if (check != null)
                {
                    if (check.Checked)
                    {
                        dat.Execute("UPDATE UserMessages SET Live=0, SentLive=0 WHERE ID=" + row["ID"].ToString());
                    }
                }
            }

            ds = dat.GetData("SELECT DISTINCT TOP 100 UM.From_UserID, UM.To_UserID, UM.ID FROM UserMessages UM, Users U WHERE (UM.From_UserID=" +
            Session["User"].ToString() + " AND UM.SentLive=1) ORDER BY UM.From_UserID, UM.To_UserID, UM.ID DESC");
            dv = new DataView(ds.Tables[0], "", "", DataViewRowState.CurrentRows);

            foreach (DataRowView row in dv)
            {
                check = (CheckBox)dat.FindControlRecursive(this, "XS" + row["ID"].ToString());

                if (check != null)
                {
                    if (check.Checked)
                    {
                        dat.Execute("UPDATE UserMessages SET Live=0, SentLive=0 WHERE ID=" + row["ID"].ToString());
                    }
                }
            }

            MessagesPanel.Controls.Clear();

            UsedMessagesPanel.Controls.Clear();
            LoadControlsNotAJAX();

            StreamWriter tw = new StreamWriter(Server.MapPath("~/js/TotalJS.js"), true);
            tw.WriteLine(" ");
            // close the stream
            tw.Close();

            UpdatePanel2.Update();

            //Response.Redirect("my-account");
        }
        catch (Exception ex)
        {
            UserErrorLabel.Text = ex.ToString();
        }
    }
示例#19
0
 protected void CloseSearchPanel()
 {
     HttpCookie cookie = Request.Cookies["BrowserDate"];
     Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
     Panel SearchFriendPanel = (Panel)dat.FindControlRecursive(this, "SearchFriendPanel");
     SearchFriendPanel.Visible = false;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];

        FormsAuthenticationTicket authTicket = null;
        try
        {
            string group = "";
            if (authCookie != null)
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                group = authTicket.UserData.ToString();
            }

            if (group.Contains("Admin"))
            {
                if (group.Contains("User"))
                {
                    Session["User"] = authTicket.Name;
                }
            }
            else
            {
                ImageButton calendarLink = (ImageButton)dat.FindControlRecursive(this, "CalendarLink");
                calendarLink.Visible = false;
            }
        }
        catch (Exception ex)
        {
        }
    }
示例#21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }

        Session["RedirectTo"] = Request.Url.AbsoluteUri;
        bool fillUserData = false;
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        try
        {
            if (Session["User"] != null)
            {
                fillUserData = true;
                DataSet dsAd = dat.GetData("SELECT User_ID FROM Ads WHERE Ad_ID=" + Request.QueryString["AdID"].ToString());
                if (dsAd.Tables[0].Rows[0]["User_ID"].ToString() == Session["User"].ToString())
                {
                    EditAdLink.Visible = true;
                }
                else
                    EditAdLink.Visible = false;

                LoggedInPanel.Visible = true;
                LoggedOutPanel.Visible = false;
            }
            else
            {
                Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                LoggedOutPanel.Visible = true;
                LoggedInPanel.Visible = false;
            }

            GetFeaturedBulletins();
        }
        catch (Exception ex)
        {
            ErrorLabel.Text = ex.ToString();
        }

        int ID = int.Parse(Request.QueryString["AdID"].ToString());

        Session["FlagID"] = ID;
        Session["FlagType"] = "A";
        DataSet ds = dat.GetData("SELECT * FROM Ads A, Users U WHERE U.User_ID=A.User_ID AND A.Ad_ID=" + ID);
        Cache.Remove(Server.MapPath("Controls/PlayList.xml"));
        if (ds.Tables.Count > 0)
        {
            if (ds.Tables[0].Rows.Count > 0)
            {
                TagCloud.THE_ID = ID;
                ShowHeaderName.Text = "<a id=\""+dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Header"].ToString())+"\" class=\"aboutLink\" href=\"http://" + Request.Url.Authority + "/" +
                    dat.MakeNiceName(ds.Tables[0].Rows[0]["Header"].ToString()) +
                    "_" + ID.ToString() + "_Ad\"><h1>" +
                    dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 50)+"</h1></a>";
                ShowDescription.Text = dat.BreakUpString(ds.Tables[0].Rows[0]["Description"].ToString(), 60);

                #region SEO
                //Create keyword and description meta tags
                topTopLiteral.Text = "<a class=\"NavyLink12UD\" href=\"#" + dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Header"].ToString()) + "\">" +
                    dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Header"].ToString()).Replace("-", " ") + " From The Top</a>";

                HtmlMeta hm = new HtmlMeta();
                HtmlMeta kw = new HtmlMeta();
                HtmlMeta lg = new HtmlMeta();
                HtmlLink cn = new HtmlLink();
                HtmlHead head = (HtmlHead)Page.Header;

                cn.Attributes.Add("rel", "canonical");
                cn.Href = "http://" + Request.Url.Authority + "/" +
                    dat.MakeNiceName(ds.Tables[0].Rows[0]["Header"].ToString()) +
                    "_" + ID.ToString() + "_Ad";
                head.Controls.AddAt(0, cn);

                kw.Name = "keywords";
                hm.Name = "Description";

                lg.Name = "language";
                lg.Content = "English";
                head.Controls.AddAt(0, lg);

                char [] delimeter = {' '};
                string[] keywords = dat.MakeNiceNameFull(ds.Tables[0].Rows[0]["Header"].ToString()).Replace("-", " ").Split(delimeter, StringSplitOptions.RemoveEmptyEntries);
                int count = 0;
                foreach (string token in keywords)
                {
                    if (count < 16)
                    {
                        if (kw.Content != "")
                            kw.Content += " ";
                        kw.Content += token;

                        count++;
                    }
                }
                head.Controls.AddAt(0, kw);

                hm.Content = dat.MakeNiceNameFull(dat.stripHTML(ds.Tables[0].Rows[0]["Description"].ToString()).Replace("   ", " ").Replace("  ", " ")).Replace("-", " ");
                if (hm.Content.Length > 200)
                    hm.Content = hm.Content.Substring(0, 197) + "...";

                head.Controls.AddAt(0, hm);

                this.Title = kw.Content;

                HtmlLink lk = new HtmlLink();
                lk.Href = "http://" + Request.Url.Authority + "/" + dat.MakeNiceName(dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 14)) + "_" + ID.ToString() + "_Ad";
                lk.Attributes.Add("rel", "bookmark");
                head.Controls.AddAt(0, lk);
                #endregion

                DataView dvCats = dat.GetDataDV("SELECT DISTINCT C.ID, ACM.ID AS AID, C.Name AS CategoryName, ACM.tagSize FROM Ad_Category_Mapping ACM, AdCategories C WHERE ACM.CategoryID=C.ID AND ACM.AdID=" + ID + " ORDER BY ACM.ID");

                string justCats = "";

                for (int i = 0; i < dvCats.Count; i++)
                {
                    //kw.Content += ", " + dvCats[i]["CategoryName"].ToString();
                    justCats += dvCats[i]["CategoryName"].ToString() + " ";
                }

               // DiggLiteral.Text = " <table> " +
               //     "<tr>" +
               //       "  <td valign=\"bottom\" style=\"padding-right: 10px;\">" +
               //        "     <a name=\"fb_share\" type=\"button\" href=\"http://www.facebook.com/sharer.php\">Share</a><script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" type=\"text/javascript\"></script>" +
               //        " </td>" +
               //        " <td valign=\"bottom\" style=\"padding-right: 10px;\">" +
               //        "     <a style=\"border: 0; padding: 0; margin: 0;\" id=\"TweeterA\" title=\"Click to send this page to Twitter!\" target=\"_blank\" rel=\"nofollow\"><img style=\"border: 0; padding: 0; margin: 0;\" src=\"http://twitter-badges.s3.amazonaws.com/twitter-a.png\" alt=\"Share on Twitter\"/></a>" +
               //        " </td>" +
               //        " <td valign=\"bottom\" style=\"padding-right: 10px;\">" +
               //        "     <a href=\"javascript:void(window.open('http://www.myspace.com/Modules/PostTo/Pages/?u='+encodeURIComponent(document.location.toString()),'ptm','height=450,width=440').focus())\">" +
               //        "         <img src=\"http://cms.myspacecdn.com/cms/ShareOnMySpace/small.png\" border=\"0\" alt=\"Share on MySpace\" />" +
               //        "     </a>" +
               //        " </td>" +
               //        "  <td valign=\"bottom\" style=\"padding-right: 10px;\"><a alt=\"Digg it!\" class=\"DiggThisButton DiggIcon\" id=\"dibbButt\"" +
               //         "href='http://digg.com/submit?phase=2&url=" + "http://" + Request.Url.Authority +
               //         "/" + dat.MakeNiceName(ds.Tables[0].Rows[0]["Header"].ToString()) + "_" + ID.ToString() + "_Ad" +
               //         "' target=\"_blank\">Digg</a></td>" +
               //       "  <td valign=\"bottom\" style=\"padding-right: 10px;\">" +

               //        "     <a href=\"http://delicious.com/save\" onclick=\"window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;\">" +
               //        "         <img border=\"0\" src=\"http://static.delicious.com/img/delicious.small.gif\" height=\"10\" width=\"10\" alt=\"Delicious\" />" +
               //         "    </a>" +
               //        "</td>" +
               //        " <td>" +
               //         "     <script src=\"http://www.stumbleupon.com/hostedbadge.php?s=4\"></script>" +
               //        " </td>" +
               //    " </tr>" +
               //" </table>";

                Session["Subject"] = dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 14);
                Session["messageText"] = "Bulletin: " +
                    dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 14) + ".";

                Session["messageEmail"] = dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 14) + " \n\r " + ShowDescription.Text;
                Session["EmailMessage"] = dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 14) + " \n\r " + ShowDescription.Text;

                if (bool.Parse(ds.Tables[0].Rows[0]["hasSongs"].ToString()))
                {
                    DataSet dsSongs = dat.GetData("SELECT * FROM Ad_Song_Mapping WHERE AdID=" + ID);
                    ASP.controls_playerxml_songplayer_ascx songs = new ASP.controls_playerxml_songplayer_ascx();
                    int songCount = dsSongs.Tables[0].Rows.Count;

                    if (songCount > 2)
                    {
                        songs.SONG1 = dsSongs.Tables[0].Rows[0]["SongName"].ToString();
                        songs.SONG2 = dsSongs.Tables[0].Rows[1]["SongName"].ToString();
                        songs.SONG3 = dsSongs.Tables[0].Rows[2]["SongName"].ToString();
                        songs.SONG1_TITLE = dsSongs.Tables[0].Rows[0]["SongTitle"].ToString();
                        songs.SONG2_TITLE = dsSongs.Tables[0].Rows[1]["SongTitle"].ToString();
                        songs.SONG3_TITLE = dsSongs.Tables[0].Rows[2]["SongTitle"].ToString();
                    }
                    else if (songCount > 1)
                    {
                        songs.SONG1 = dsSongs.Tables[0].Rows[0]["SongName"].ToString();
                        songs.SONG2 = dsSongs.Tables[0].Rows[1]["SongName"].ToString();
                        songs.SONG3 = "";
                        songs.SONG1_TITLE = dsSongs.Tables[0].Rows[0]["SongTitle"].ToString();
                        songs.SONG2_TITLE = dsSongs.Tables[0].Rows[1]["SongTitle"].ToString();
                    }
                    else
                    {
                        songs.SONG1 = dsSongs.Tables[0].Rows[0]["SongName"].ToString();
                        songs.SONG2 = "";
                        songs.SONG3 = "";
                        songs.SONG1_TITLE = dsSongs.Tables[0].Rows[0]["SongTitle"].ToString();
                    }
                    songs.USER_NAME = ds.Tables[0].Rows[0]["UserName"].ToString();

                    SongPanel.Controls.Add(songs);

                    //XmlDocument xmldoc = new XmlDocument();
                    //xmldoc.Load(Server.MapPath("Controls/PlayList.xml"));

                    //Cache.Insert(Server.MapPath("Controls/PlayList.xml"), fil);

                }

                string youtube = ds.Tables[0].Rows[0]["YouTubeVideo"].ToString();
                int mediaCategory = int.Parse(ds.Tables[0].Rows[0]["mediaCategory"].ToString());
                //Media Categories: NONE: 0, Picture: 1, Video: 2, YouTubeVideo: 3, Slider: 4
                Rotator1.Items.Clear();
                switch (mediaCategory)
                {
                    case 0:
                        break;
                    case 1:
                        RotatorPanel.Visible = true;
                        char[] delim4 = { ';' };
                        string[] youtokens = youtube.Split(delim4);
                        if (youtube != "")
                        {
                            for (int i = 0; i < youtokens.Length; i++)
                            {
                                if (youtokens[i].Trim() != "")
                                {
                                    Literal literal3 = new Literal();
                                    //literal3.Text = "<object width=\"400\" height=\"250\"><param  name=\"wmode\" value=\"opaque\" ><param name=\"movie\" value=\"http://www.youtube.com/cp/vjVQa1PpcFOFUjhw1qTHaE09Z1e9QYKk9y1JrWf5VAc=\"></param><embed wmode=\"opaque\" src=\"http://www.youtube.com/cp/vjVQa1PpcFOFUjhw1qTHaE09Z1e9QYKk9y1JrWf5VAc=\" type=\"application/x-shockwave-flash\" width=\"400\" height=\"250\"></embed></object>";
                                    literal3.Text = "<div class=\"FloatLeft\"><object class=\"toHidde\" width=\"412\" height=\"250\"><param name=\"movie\" value=\"http://www.youtube.com/v/" + youtokens[i] +
                                        "\"></param><param  name=\"wmode2\" value=\"transparent\" ></param><param  name=\"wmode\" value=\"opaque\" ></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://www.youtube.com/v/" +
                                        youtokens[i] + "\" wmode=\"opaque\" wmode2=\"transparent\' type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"412\" height=\"250\"></embed></object></div>";
                                    Telerik.Web.UI.RadRotatorItem r3 = new Telerik.Web.UI.RadRotatorItem();
                                    r3.Controls.Add(literal3);
                                    Rotator1.Items.Add(r3);
                                }
                            }
                        }
                        DataView dsSlider = dat.GetDataDV("SELECT * FROM Ad_Slider_Mapping WHERE AdID=" + ID);
                        DataSet dsUser = dat.GetData("SELECT * FROM Ads A, Users U WHERE A.Ad_ID=" + ID + " AND A.User_ID=U.User_ID");
                        string userName = dsUser.Tables[0].Rows[0]["UserName"].ToString();
                        if (dsSlider.Count > 0)
                        {
                            char[] delim = { '\\' };
                            char[] delim3 = { '.' };
                            string[] fileArray = System.IO.Directory.GetFiles(MapPath(".") + "\\UserFiles\\" +
                                userName + "\\AdSlider\\" + ID);

                            string[] finalFileArray = new string[fileArray.Length];

                            for (int i = 0; i < dsSlider.Count; i++)
                            {
                                int length = fileArray[i].Split(delim).Length;
                                finalFileArray[i] = "http://" + Request.Url.Authority + "/HippoHappenings/UserFiles/" + userName +
                                    "/AdSlider/" + ID + "/" + dsSlider[i]["PictureName"].ToString();
                                string[] tokens = dsSlider[i]["PictureName"].ToString().Split(delim3);

                                if (tokens.Length >= 2)
                                {
                                    if (tokens[1].ToUpper() == "JPG" || tokens[1].ToUpper() == "JPEG" || tokens[1].ToUpper() == "GIF" || tokens[1].ToUpper() == "PNG")
                                    {
                                        System.Drawing.Image image = System.Drawing.Image.FromFile(MapPath(".") + "\\UserFiles\\" +
                                userName + "\\AdSlider\\" + ID + "\\" + dsSlider[i]["PictureName"].ToString());

                                        int width = 410;
                                        int height = 250;

                                        int newHeight = 0;
                                        int newIntWidth = 0;

                                        //if image height is less than resize height
                                        if (height >= image.Height)
                                        {
                                            //leave the height as is
                                            newHeight = image.Height;

                                            if (width >= image.Width)
                                            {
                                                newIntWidth = image.Width;
                                            }
                                            else
                                            {
                                                newIntWidth = width;

                                                double theDivider = double.Parse(image.Width.ToString()) / double.Parse(newIntWidth.ToString());
                                                double newDoubleHeight = double.Parse(newHeight.ToString());
                                                newDoubleHeight = double.Parse(height.ToString()) / theDivider;
                                                newHeight = (int)newDoubleHeight;
                                            }
                                        }
                                        //if image height is greater than resize height...resize it
                                        else
                                        {
                                            //make height equal to the requested height.
                                            newHeight = height;

                                            //get the ratio of the new height/original height and apply that to the width
                                            double theDivider = double.Parse(image.Height.ToString()) / double.Parse(newHeight.ToString());
                                            double newDoubleWidth = double.Parse(newIntWidth.ToString());
                                            newDoubleWidth = double.Parse(image.Width.ToString()) / theDivider;
                                            newIntWidth = (int)newDoubleWidth;

                                            //if the resized width is still to big
                                            if (newIntWidth > width)
                                            {
                                                //make it equal to the requested width
                                                newIntWidth = width;

                                                //get the ratio of old/new width and apply it to the already resized height
                                                theDivider = double.Parse(image.Width.ToString()) / double.Parse(newIntWidth.ToString());
                                                double newDoubleHeight = double.Parse(newHeight.ToString());
                                                newDoubleHeight = double.Parse(image.Height.ToString()) / theDivider;
                                                newHeight = (int)newDoubleHeight;
                                            }
                                        }

                                        Literal literal4 = new Literal();
                                        string[] nameTokens = dsSlider[i]["RealPictureName"].ToString().Split(delim3);
                                        string realName = dat.MakeNiceName(nameTokens[0]).Replace("-", " ");
                                        literal4.Text = "<div class=\"RotatorImage\"><img alt=\"" + realName +
                                            "\" style=\"cursor: pointer; margin-left: " + ((412 - newIntWidth) / 2).ToString() + "px; margin-top: " + ((250 - newHeight) / 2).ToString() + "px;\" onclick=\"OpenEventModal(" + i.ToString() + ", " + ID + ");\" height=\"" + newHeight + "px\" width=\"" + newIntWidth + "px\" src=\""
                                            + "UserFiles/" + userName + "/AdSlider/" + ID + "/" +
                                            dsSlider[i]["PictureName"].ToString() + "\" /></div>";
                                        Telerik.Web.UI.RadRotatorItem r4 = new Telerik.Web.UI.RadRotatorItem();
                                        r4.Controls.Add(literal4);

                                        Rotator1.Items.Add(r4);
                                    }
                                    else if (tokens[1].ToUpper() == "WMV")
                                    {
                                        Literal literal4 = new Literal();
                                        literal4.Text = "<div style=\"width: 410px; height: 250px;\" ><OBJECT stop=\"true\" loop=\"false\" controller=\"true\" wmode2=\"opaque\" wmode=\"transparent\" autoplay=\"false\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" " +
                                        "width=\"410\" height=\"250\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\">" +
                                        "<param name=\"src\" value=\"UserFiles/" +
                                userName + "/AdSlider/" + ID + "/" + fileArray[i].Split(delim)[length - 1].ToString() + "\"></param>" +
                                        "<param name=\"autoplay\" value=\"false\"></param><param name=\"wmode\" value=\"transparent\"></param>" +
                                        "<param name=\"controller\" value=\"true\"></param>" +
                                        "<param name=\"stop\" value=\"true\" ></param>" +
                                        "<param name=\"loop\" value=\"false\"><param  name=\"wmode2\" value=\"opaque\" ></param>" +
                                        "<EMBED stop=\"true\" wmode=\"transparent\" wmode2=\"opaque\" src=\"UserFiles/" +
                                userName + "/AdSlider/" + ID + "/" + fileArray[i].Split(delim)[length - 1].ToString() + "\" width=\"410\" height=\"250\" autoplay=\"false\" " +
                                        "controller=\"true\" loop=\"false\" bgcolor=\"#000000\" pluginspage=\"http://www.apple.com/quicktime/download/\">" +
                                        "</EMBED>" +
                                        "</OBJECT></div>";
                                        Telerik.Web.UI.RadRotatorItem r4 = new Telerik.Web.UI.RadRotatorItem();
                                        r4.Controls.Add(literal4);
                                        Rotator1.Items.Add(r4);
                                    }

                                }
                            }
                        }
                        break;
                    default: break;

                }

                if (fillUserData)
                {
                    ASP.controls_contactad_ascx SendMessage1 = new ASP.controls_contactad_ascx();
                    SendMessage1.THE_TEXT = "Reply to Bulletin";
                    SendMessage1.RE_LABEL = "Re: " + dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 14);
                    SendMessage1.TYPE = "Connect";
                    SendMessage1.ID = ID;

                    ContactPanel.Controls.Add(SendMessage1);

                    ASP.controls_sendmessage_ascx SendMessage33 = new ASP.controls_sendmessage_ascx();
                    SendMessage33.THE_TEXT = "Share this with a friend";
                    SendMessage33.RE_LABEL = "Re: " + Session["UserName"].ToString() +
                            " would like inquire about your ad \"" + dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 14) + "\".";
                    SendMessage33.TYPE = "a";
                    SendMessage33.ID = ID;
                    ContactPanel.Controls.Add(SendMessage33);

                    Session["Subject"] = "Re: " + Session["UserName"].ToString() +
                            " would like inquire about your ad \"" + dat.BreakUpString(ds.Tables[0].Rows[0]["Header"].ToString(), 14) + "\".";
                }
                else
                {
                    Literal literal = new Literal();
                    literal.Text = "<label class=\"AddGreenLink\">You must be <a class=\"AddLink\" href=\"login\">logged in</a> to contact this person.</label>";

                    ContactPanel.Controls.Add(literal);
                }
                //}
                //else
                //{
                //    Response.Redirect("~/home");
                //}
            }
            else
            {
                Response.Redirect("~/home");
            }
        }
        else
        {
            Response.Redirect("~/home");
        }
        if (Rotator1.Items.Count == 0)
            RotatorPanel.Visible = false;
        else
        {
            RotatorPanel.Visible = true;
            if (Rotator1.Items.Count == 1)
            {
                RotatorPanel.CssClass = "HiddeButtons";
            }
        }
    }
示例#22
0
    protected void AddFriend(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        LinkButton link = (LinkButton)sender;

        int To_ID = int.Parse(link.CommandArgument);

        DataSet ds = dat.GetData("SELECT * FROM User_Friends WHERE UserID="+Session["User"].ToString() +
            " AND FriendID="+To_ID);

        bool hasFriend = false;

        if (ds.Tables.Count > 0)
            if (ds.Tables[0].Rows.Count > 0)
                hasFriend = true;
            else
                hasFriend = false;
        else
            hasFriend = false;

        if (!hasFriend)
        {

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());

            conn.Open();
            SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode)"
                + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 2)", conn);
            cmd.Parameters.Add("@content", SqlDbType.Text).Value = "Good Day from Hippo Happenings!, <br/><br/> We wanted to let you know that the user '" + Session["UserName"].ToString() + "' would like " +
                "to add you to their list of friends. To accept this request select the link below. <br/><br/> Have a Happening Day! <br/><br/> ";
            cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "You Have a Hippo Friend Request!";
            cmd.Parameters.Add("@toID", SqlDbType.Int).Value = To_ID;
            cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = Session["User"].ToString();
            cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
            cmd.ExecuteNonQuery();
            conn.Close();

            MessageLabel.Text = "Your friend request has been sent!";

        }
        else
            MessageLabel.Text = "The user you selected is already your friend!";

        Panel SearchResultsPanel = (Panel)dat.FindControlRecursive(this, "SearchResultsPanel");
        SearchResultsPanel.Controls.Clear();

        CloseSearchPanel();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Page.Trace.IsEnabled = true;
        //Page.Trace.TraceMode = TraceMode.SortByTime;

        try
        {
            HtmlMeta hm = new HtmlMeta();
            HtmlMeta kw = new HtmlMeta();

            HtmlHead head = (HtmlHead)Page.Header;

            hm.Name = "Description";
            hm.Content = "Find your local events, venues and classifieds all while " +
                     "ads from your peers, neighborhood, and community are displayed to you purely based on your interests." +
                     "Large corporations are not welcome!";
            head.Controls.AddAt(0, hm);

            HtmlMeta nMT = new HtmlMeta();
            nMT.Name = "google-site-verification";
            nMT.Content = "tw8rmOWW-DlZa-H4DZdGr201J5kC7NVLXUmk5oN8vFM";

            head.Controls.Add(nMT);

            HtmlLink lkl = new HtmlLink();
            lkl.Href = "ror.xml";
            lkl.Attributes.Add("rel", "alternate");
            lkl.Attributes.Add("type", "application/xml");
            lkl.Attributes.Add("title", "ROR");

            head.Controls.Add(lkl);

            HttpCookie cookie = Request.Cookies["BrowserDate"];
            if (cookie == null)
            {
                cookie = new HttpCookie("BrowserDate");
                cookie.Value = DateTime.Now.Date.ToString();
                cookie.Expires = DateTime.Now.AddDays(22);
                Response.Cookies.Add(cookie);
            }
            bool fillUserData = false;
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":").Replace("%28", "(").Replace("%29", ")")));

            kw.Name = "keywords";
            kw.Content = "events, ads, venues, post, search, find, local events, concerts, festivals, world, theatre, technology, " +
                "family, peers, neighborhood, classifieds";

            DataView dvCats = dat.GetDataDV("SELECT * FROM AdCategories");

            for (int i = 0; i < dvCats.Count; i++)
            {
                kw.Content += ", " + dvCats[i]["Name"].ToString();
            }

            dvCats = dat.GetDataDV("SELECT * FROM EventCategories");

            for (int i = 0; i < dvCats.Count; i++)
            {
                kw.Content += ", " + dvCats[i]["Name"].ToString();
            }

            dvCats = dat.GetDataDV("SELECT * FROM VenueCategories");

            for (int i = 0; i < dvCats.Count; i++)
            {
                kw.Content += ", " + dvCats[i]["Name"].ToString();
            }

            head.Controls.AddAt(0, kw);

            string cookieName = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie = Context.Request.Cookies[cookieName];

                //logInPanel.Visible = Session["User"] == null;
                //loggedInPanel.Visible = Session["User"] != null;

            string country = "";
            string state = "";
            string city = "";
            string countryID = "";
            string stateID = "";
            string cityID = "";
            FormsAuthenticationTicket authTicket = null;
            try
            {
                string group = "";
                if (authCookie != null)
                {
                    authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                    group = authTicket.UserData.ToString();
                }

                if (group.Contains("User"))
                {
                    Session["User"] = authTicket.Name;
                    DataSet ds1 = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE U.User_ID=" +
                        authTicket.Name + " AND U.User_ID=UP.UserID ");
                    Session["UserName"] = ds1.Tables[0].Rows[0]["UserName"].ToString();

                    country = ds1.Tables[0].Rows[0]["CatCountry"].ToString();
                    countryID = country;

                    state = ds1.Tables[0].Rows[0]["CatState"].ToString();
                    city = ds1.Tables[0].Rows[0]["CatCity"].ToString();
                    stateID = state;
                    cityID = city;

                    //DataSet ds2 = dat.RetrieveAds(Session["User"].ToString(), false);
                    //DataSet dsMain = dat.RetrieveMainAds(Session["User"].ToString());
                    //Ads1.DATA_SET = ds2;
                    //Ads1.MAIN_AD_DATA_SET = dsMain;

                    fillUserData = true;
                }
                else
                {
                    DataSet ds1 = dat.GetData("SELECT * FROM SearchIPs WHERE IP='" + dat.GetIP() + "'");

                    bool getAnotherDs1 = false;
                    if (ds1.Tables.Count > 0)
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            country = ds1.Tables[0].Rows[0]["Country"].ToString();
                            countryID = country;
                            state = ds1.Tables[0].Rows[0]["State"].ToString();
                            city = ds1.Tables[0].Rows[0]["City"].ToString();
                            stateID = state;
                            cityID = city;
                        }
                        else
                        {
                            getAnotherDs1 = true;
                        }
                    else
                    {
                        getAnotherDs1 = true;
                    }

                    if (getAnotherDs1)
                    {
                        ds1 = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE " +
                            " U.User_ID=UP.UserID AND U.IPs LIKE '%" + dat.GetIP() + "%'");
                        if (ds1.Tables.Count > 0)
                            if (ds1.Tables[0].Rows.Count > 0)
                            {
                                country = ds1.Tables[0].Rows[0]["CatCountry"].ToString();
                                countryID = country;
                                state = ds1.Tables[0].Rows[0]["CatState"].ToString();
                                city = ds1.Tables[0].Rows[0]["CatCity"].ToString();
                                stateID = state;
                                cityID = city;
                            }
                    }

                    //if (!IsPostBack)
                    //{
                    //    Ads1.DATA_SET = dat.RetrieveAllAds(false);
                    //    Ads1.MAIN_AD_DATA_SET = dat.RetrieveAllAds(true);
                    //}
                    Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                    calendarLink.Visible = false;

                }
            }
            catch (Exception ex)
            {

            }

            DataSet ds;

            if (!IsPostBack)
            {
                LocationLabel.Text = "";
                if (country != "")
                    country = " AND E.Country = " + country;

                int c = 0;

                if (state != "")
                {

                    c++;
                }

                if (city != "")
                {

                    c++;
                }

                SqlDbType[] types = new SqlDbType[c];
                object[] data = new object[c];

                if (state != "")
                {
                    types[0] = SqlDbType.NVarChar;
                    data[0] = state;
                    state = " AND E.State=@p0 ";
                    if (city != "")
                    {
                        types[1] = SqlDbType.NVarChar;
                        data[1] = city;
                        city = " AND E.City=@p1 ";
                    }
                }
                else
                {
                    if (city != "")
                    {
                        types[0] = SqlDbType.NVarChar;
                        data[0] = city;
                        city = " AND E.City=@p0 ";
                    }
                }

                ds = dat.GetDataWithParemeters("SELECT DISTINCT TOP 10 EO.DateTimeStart, E.Header, E.Content, EO.EventID FROM Events E, Event_Occurance EO WHERE E.ID=EO.EventID " + country + state + city + " AND EO.DateTimeStart > '" + DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Date + "'", types, data);

                Session["HomeEvents"] = ds;
                LocationLabel.Text = "";
                if (country == "" && state == "" && city == "")
                {
                    LocationLabel.Text = " The World ";
                }
                else
                {
                    if (city != "")
                    {
                        LocationLabel.Text += cityID;
                        if (state != "")
                            LocationLabel.Text += ", " + stateID;
                    }
                    else
                    {
                        if (state != "")
                            LocationLabel.Text += stateID;
                    }
                }

                if (LocationLabel.Text == "")
                {
                    DataSet dsCountry = dat.GetData("SELECT * FROM Countries WHERE country_id=" + countryID);
                    LocationLabel.Text = dsCountry.Tables[0].Rows[0]["country_name"].ToString();
                }
            }
            else
            {
                EventPanel.Controls.Clear();
                LocationLabel.Text = "";
                ds = (DataSet)Session["HomeEvents"];

                if (countryID == "" && stateID == "" && cityID == "")
                {
                    LocationLabel.Text = " The World ";
                }
                else
                {
                    if (cityID != "")
                    {
                        LocationLabel.Text += cityID;
                        if (state != "")
                            LocationLabel.Text += ", " + stateID;
                    }
                    else
                    {
                        if (state != "")
                            LocationLabel.Text += stateID;
                    }
                }

                if (RadCalendar1.SelectedDate.ToShortDateString() != "1/1/0001")
                    LocationLabel.Text += " on " + RadCalendar1.SelectedDate.ToShortDateString();

            }

            ds = (DataSet)Session["HomeEvents"];

            if (ds != null)
            {

                if (ds.Tables.Count > 0)
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            DateTime date = DateTime.Parse(ds.Tables[0].Rows[i]["DateTimeStart"].ToString());
                            ASP.controls_homeevent_ascx eventH = new ASP.controls_homeevent_ascx();
                            eventH.DAY = date.DayOfWeek.ToString().Substring(0, 3);
                            eventH.DAY_NUMBER = date.Day.ToString();
                            eventH.MONTH = dat.GetMonth(date.Month.ToString()).Substring(0, 3);
                            eventH.EVENT_NAME = ds.Tables[0].Rows[i]["Header"].ToString();
                            if (ds.Tables[0].Rows[i]["Content"].ToString().Length > 150)
                                eventH.SUMMARY = dat.BreakUpString(ds.Tables[0].Rows[i]["Content"].ToString().Substring(0, 150), 67) + "...";
                            else
                                eventH.SUMMARY = dat.BreakUpString(ds.Tables[0].Rows[i]["Content"].ToString(), 67) + "...";
                            eventH.EVENT_ID = int.Parse(ds.Tables[0].Rows[i]["EventID"].ToString());
                            EventPanel.Controls.Add(eventH);
                        }

                    }
                    else
                    {

                        Label label = new Label();
                        label.CssClass = "EventBody";
                        label.Text = "No events are listed for this date. Sorry. But perhaps you could enter one... <a class=\"AddLink\" href=\"BlogEvent.aspx\">Enter Events</a>.";
                        EventPanel.Controls.Add(label);
                    }
                else
                {

                    Label label = new Label();
                    label.CssClass = "EventBody";
                    label.Text = "No events are listed for this date. Sorry. But perhaps you could enter one... <a class=\"AddLink\" href=\"BlogEvent.aspx\">Enter Events</a>.";
                    EventPanel.Controls.Add(label);
                }
            }
            else
            {

                Label label = new Label();
                label.CssClass = "EventBody";
                label.Text = "No events are listed for this date. Sorry. But perhaps you could enter one... <a class=\"AddLink\" href=\"BlogEvent.aspx\">Enter Events</a>.";
                EventPanel.Controls.Add(label);
            }

            #region Original Home page code
            //if (ds.Tables.Count > 0)
            //{
            //    if (ds.Tables[0].Rows.Count > 0)
            //    {

            //        ASP.controls_footer_ascx thefooter = (ASP.controls_footer_ascx)dat.FindControlRecursive(this, "TheFooter");
            //        thefooter.EVENT_ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());

            //        string ID = ds.Tables[0].Rows[0]["ID"].ToString();
            //        DataSet dsDate = dat.GetData("SELECT * FROM Event_Occurance WHERE EventID=" + ID);
            //        DataSet dsVenue = dat.GetData("SELECT * FROM Venues WHERE ID=" + ds.Tables[0].Rows[0]["Venue"]);
            //        TagCloud.THE_ID = int.Parse(ID);

            //        DataSet dsComments = dat.GetData("SELECT C.BlogDate AS theDate, * FROM Comments C, Users U WHERE U.User_ID=C.UserID AND C.BlogID=" + ID +" ORDER BY C.BlogDate");
            //        TheComments.DATA_SET = dsComments;
            //        TheComments.DataBind2(true);

            //        if (bool.Parse(ds.Tables[0].Rows[0]["hasSongs"].ToString()))
            //        {
            //            DataSet dsSongs = dat.GetData("SELECT * FROM Event_Song_Mapping WHERE EventID=" + ID);
            //            ASP.controls_songplayer_ascx songs = new ASP.controls_songplayer_ascx();
            //            int songCount = dsSongs.Tables[0].Rows.Count;

            //            if (songCount > 2)
            //            {
            //                songs.SONG1 = dsSongs.Tables[0].Rows[0]["SongName"].ToString();
            //                songs.SONG2 = dsSongs.Tables[0].Rows[1]["SongName"].ToString();
            //                songs.SONG3 = dsSongs.Tables[0].Rows[2]["SongName"].ToString();
            //            }
            //            else if (songCount > 1)
            //            {
            //                songs.SONG1 = dsSongs.Tables[0].Rows[0]["SongName"].ToString();
            //                songs.SONG2 = dsSongs.Tables[0].Rows[1]["SongName"].ToString();
            //            }
            //            else
            //                songs.SONG1 = dsSongs.Tables[0].Rows[0]["SongName"].ToString();

            //            songs.USER_NAME = ds.Tables[0].Rows[0]["UserName"].ToString();

            //            SongPanel.Controls.Add(songs);
            //        }

            //        EventName.Text = ds.Tables[0].Rows[0]["Header"].ToString();
            //        Session["Subject"] = "Re: "+ds.Tables[0].Rows[0]["Header"].ToString();
            //        Session["CommentSubject"] = "Re: " + ds.Tables[0].Rows[0]["Header"].ToString();
            //        EventName.NavigateUrl = "~/Event.aspx?EventID=" + ID;
            //        Session["EventID"] = ID;
            //        VenueName.Text = dsVenue.Tables[0].Rows[0]["Name"].ToString();
            //        VenueName.NavigateUrl = "Venue.aspx?ID="+dsVenue.Tables[0].Rows[0]["ID"].ToString();
            //        DateTime date = (DateTime)dsDate.Tables[0].Rows[0]["DateTimeStart"];
            //        DateAndTimeLabel.Text = date.DayOfWeek.ToString() + ", " + GetMonth(date.Month.ToString()) + " " + date.Day + " " + date.Hour + ":" + date.Minute;
            //        string content = ds.Tables[0].Rows[0]["Content"].ToString();
            //        SendTxtID.MESSAGE = EventName.Text + " occurs at " + VenueName.Text + " on " + DateAndTimeLabel.Text;

            //        string href = Request.Url.AbsoluteUri;
            //        SendEmailID.MESSAGE = "EventName: <a class=\"AddLink\" href=\"" + href +
            //            "\">" + EventName.Text + "</a> \n\r Venue: " + VenueName.Text +
            //            " \n\r Date: " + DateAndTimeLabel.Text + " \n\r " + content;

            //        //if (fillUserData)
            //        //{
            //        //    DataSet ds2 = dat.GetData("SELECT EEL.ExcitmentLevel AS Level FROM User_Calendar UC, Event_ExcitmentLevel EEL WHERE UC.UserID="
            //        //        + Session["User"].ToString() + " AND UC.EventID = " + ID + " AND UC.ExcitmentID=EEL.ID ");

            //        //    bool addEvent = false;

            //        //    if (ds2.Tables.Count > 0)
            //        //        if (ds2.Tables[0].Rows.Count > 0)
            //        //        {
            //        //            Label label = new Label();
            //        //            label.CssClass = "AddLinkGoing";
            //        //            label.Text = "Guess What?!: you're going to this event and you are " + ds2.Tables[0].Rows[0]["Level"].ToString();
            //        //            CalendarPanel.Controls.Add(label);
            //        //        }
            //        //        else
            //        //            addEvent = true;
            //        //    else
            //        //        addEvent = true;

            //        //    if (addEvent)
            //        //    {
            //        //        ASP.controls_addtocalendar_ascx AddTo1 = new ASP.controls_addtocalendar_ascx();
            //        //        AddTo1.ID = "AddTo1";
            //        //        AddTo1.TEXT = "Add this event to calendar";
            //        //        AddTo1.EVENT_ID = int.Parse(ID);
            //        //        CalendarPanel.Controls.Add(AddTo1);
            //        //    }

            //        //}

            //        if (content.Length > 500)
            //        {
            //            ShowDescriptionBegining.Text = content.Substring(0, 500);
            //            int j = 500;
            //            if (content[500] != ' ')
            //            {

            //                while (content[j] != ' ')
            //                {
            //                    ShowDescriptionBegining.Text += content[j];
            //                    j++;
            //                }
            //            }
            //            ShowDescriptionBegining.Text = dat.BreakUpString(ShowDescriptionBegining.Text, 65);
            //            ShowRestOfDescription.Text = dat.BreakUpString(content.Substring(j), 65);
            //        }
            //        else
            //        {
            //            ShowDescriptionBegining.Text = dat.BreakUpString(content, 65);
            //            ShowRestOfDescription.Text = "";
            //        }

            //        //Media Categories: NONE: 0, Picture: 1, Video: 2, YouTubeVideo: 3, Slider: 4
            //        int mediaCategory = int.Parse(ds.Tables[0].Rows[0]["mediaCategory"].ToString());

            //        switch (mediaCategory)
            //        {
            //            case 0:
            //                break;
            //            case 1:
            //                ShowVideoPictureLiteral.Text = "<img style=\"float: left; padding-right: 10px; padding-top: 9px;\" height=\"250px\" width=\"440px\" src=\"UserFiles/" + ds.Tables[0].Rows[0]["Picture"].ToString() + "\" />";
            //                break;
            //            case 2:
            //                ShowVideoPictureLiteral.Text = "<div style=\"float:left; padding-top: 9px; padding-right: 10px;\"><embed  height=\"250px\" width=\"440px\" src=\"UserFiles/" + ds.Tables[0].Rows[0]["Video"].ToString() + "\" /></div>";
            //                break;
            //            case 3:
            //                ShowVideoPictureLiteral.Text = "<div style=\"float:left; padding-top: 9px; padding-right: 10px;\"><object width=\"440\" height=\"250\"><param name=\"movie\" value=\"http://www.youtube.com/v/" + ds.Tables[0].Rows[0]["YouTubeVideo"].ToString() + "\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://www.youtube.com/v/" + ds.Tables[0].Rows[0]["YouTubeVideo"].ToString() + "\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"440\" height=\"250\"></embed></object></div>";
            //                break;
            //            case 4:
            //                ShowVideoPictureLiteral.Text = "";
            //                DataSet dsSlider = dat.GetData("SELECT * FROM Event_Slider_Mapping WHERE EventID=" + ID);
            //                if (dsSlider.Tables.Count > 0)
            //                    if (dsSlider.Tables[0].Rows.Count > 0)
            //                    {
            //                        char[] delim = { '\\' };
            //                        string[] fileArray = System.IO.Directory.GetFiles(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\Slider\\");

            //                        string[] finalFileArray = new string[fileArray.Length];

            //                        for (int i = 0; i < fileArray.Length; i++)
            //                        {
            //                            int length = fileArray[i].Split(delim).Length;
            //                            finalFileArray[i] = "http://" + Request.Url.Authority + "/HippoHappenings/UserFiles/" + Session["UserName"].ToString() + "/Slider/" + fileArray[i].Split(delim)[length - 1];
            //                        }
            //                        Rotator1.DataSource = finalFileArray;
            //                        Rotator1.DataBind();
            //                        RotatorPanel.Visible = true;
            //                    }
            //                break;
            //            default: break;
            //        }

            //        this.Title = EventName.Text;
            //    }
            //}
            #endregion
        }
        catch (Exception ex)
        {
            ErrorLabel.Text = ex.ToString();
        }
    }
示例#24
0
 protected void OpenSearchFriends(object sender, EventArgs e)
 {
     HttpCookie cookie = Request.Cookies["BrowserDate"];
     Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
     Panel SearchFriendPanel = (Panel)dat.FindControlRecursive(this, "SearchFriendPanel");
     SearchFriendPanel.Visible = true;
 }
示例#25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Page.Trace.IsEnabled = true;
        //Page.Trace.TraceMode = TraceMode.SortByTime;

        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.Date.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        bool fillUserData = false;

        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);
        #region Take Care of Buttons
        SmallButton1.SERVER_CLICK += Suggest;
        TodayButton.SERVER_CLICK += SelectToday;
        TomorrowButton.SERVER_CLICK += SelectTomorrow;
        ThisWeekButton.SERVER_CLICK += SelectThisWeek;
        ThisWeekendButton.SERVER_CLICK += SelectThisWeekend;
        ThisMonthButton.SERVER_CLICK += SelectThisMonth;
        TodayButton.BUTTON_TEXT = "<img alt=\"Events today\" class=\"PostButton\" src=\"NewImages/TodayText.png\"/>";
        TomorrowButton.BUTTON_TEXT = "<img alt=\"Events tomorrow\" class=\"PostButton\" src=\"NewImages/TomorrowText.png\"/>";
        ThisWeekButton.BUTTON_TEXT = "<img alt=\"Events this week\" class=\"PostButton\" src=\"NewImages/ThisWeekText.png\"/>";
        ThisWeekendButton.BUTTON_TEXT = "<img alt=\"Events this weekend\" class=\"PostButton\" src=\"NewImages/ThisWeekendText.png\"/>";
        ThisMonthButton.BUTTON_TEXT = "<img alt=\"Events this month\" class=\"PostButton\" src=\"NewImages/ThisMonth.png\"/>";
        SearchButton.BUTTON_TEXT += "<img style=\"border: 0; padding-top: 3px;\" src=\"NewImages/search.png\"/>";
        #endregion

        if (!IsPostBack)
        {

            try
            {
                HtmlControl body = (HtmlControl)dat.FindControlRecursive(this.Page, "bodytag");

                body.Attributes["onload"] += "StartRotator();";

                //Literal lit = new Literal();
                //lit.Text = "<script type=\"text/javascript\">StopRotator();StartRotator();</script>";
                //HtmlGenericControl body = (HtmlGenericControl)dat.FindControlRecursive(this.Page, "bodytag");
                //body.Controls.Add(lit);

                #region SEO
                HtmlMeta hm = new HtmlMeta();
                HtmlMeta kw = new HtmlMeta();
                HtmlMeta lg = new HtmlMeta();
                HtmlLink cn = new HtmlLink();
                HtmlHead head = (HtmlHead)Page.Header;

                hm.Name = "Description";
                hm.Content = "Find and post for free all local events locales trips adventures and bulletins in your city. ";
                head.Controls.AddAt(0, hm);

                kw.Name = "keywords";
                kw.Content = "event happening trip adventure locale venue city";
                head.Controls.AddAt(0, kw);

                lg.Name = "Language";
                lg.Content = "English";
                head.Controls.AddAt(0, lg);

                cn.Attributes.Add("rel", "canonical");
                cn.Href = "http://hippohappenings.com";
                head.Controls.AddAt(0, cn);

                HtmlMeta nMT = new HtmlMeta();
                nMT.Name = "google-site-verification";
                nMT.Content = "tw8rmOWW-DlZa-H4DZdGr201J5kC7NVLXUmk5oN8vFM";

                head.Controls.Add(nMT);

                HtmlLink lkl = new HtmlLink();
                lkl.Href = "ror.xml";
                lkl.Attributes.Add("rel", "alternate");
                lkl.Attributes.Add("type", "application/xml");
                lkl.Attributes.Add("title", "ROR");

                head.Controls.Add(lkl);
                #endregion

                DataSet ds = GetEvents(TimeFrame.Beginning);

                PostEvents(ds);

                TimeFrameLabel.Text = "<span class='HomeTitle'>F</span>eatured <span class='HomeTitle'>E</span>vents <span class='HomeTitle'>N</span>ear <span class='HomeTitle'>Y</span>ou";

                //DoMayors();

                //if (Session["User"] != null)
                //    if (Session["User"].ToString() == "80" || Session["User"].ToString() == "307")
                //        DoCraigslist();

            }
            catch (Exception ex)
            {
                ErrorLabel.Text += ex.ToString();
            }
        }
    }
示例#26
0
    protected void Page_Init(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string USER_ID = "";
        try
        {
            //Ajax.Utility.RegisterTypeForAjax(typeof(User));

            //if (!IsPostBack)
            //{
            //    FriendsButton.Attributes.Add("onmouseover", "this.src='image/MyFriendsHover.png'");
            //    FriendsButton.Attributes.Add("onmouseout", "this.src='image/MyFriends.png'");

            //}
            //else
            //{
            //    FriendsButton.Attributes.Remove("onmouseover");
            //    FriendsButton.Attributes.Remove("onmouseout");
            //    MessagesButton.Attributes.Remove("onmouseover");
            //    MessagesButton.Attributes.Remove("onmouseout");
            //}

            //FOR USER PREFERENCES
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            MessageRadWindowManager.VisibleOnPageLoad = false;

            if (!IsPostBack)
            {
                try
                {

                    if (Session["User"] != null)
                    {
                    }
                    else
                    {
                        Button calendarLink = (Button)dat.FindControlRecursive(this, "CalendarLink");
                        calendarLink.Visible = false;
                        Response.Redirect("~/login");
                    }
                }
                catch (Exception ex)
                {
                    ErrorLabel.Text = ex.ToString();
                   Response.Redirect("~/login");
                }

                USER_ID = Session["User"].ToString();

                //DataSet dsCat = dat.GetData("SELECT * FROM Categories");
                //CategoriesCheckBoxes.DataSource = dsCat;
                //CategoriesCheckBoxes.DataTextField = "CategoryName";
                //CategoriesCheckBoxes.DataValueField = "ID";
                //CategoriesCheckBoxes.DataBind();

                DataSet dsProvider = dat.GetData("SELECT * FROM PhoneProviders");
                ProviderDropDown.DataSource = dsProvider;
                ProviderDropDown.DataTextField = "Provider";
                ProviderDropDown.DataValueField = "ID";
                ProviderDropDown.DataBind();

                Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
                DataSet ds = d.GetData("SELECT * FROM Events E, Venues V, Event_Occurance EO, User_Calendar UC WHERE UC.EventID=E.ID AND E.ID=EO.EventID AND E.Venue=V.ID AND UC.UserID=" + USER_ID);
                DataSet dsUser = d.GetData("SELECT * FROM Users WHERE User_ID=" + USER_ID);
                DataSet dsUserPrefs = d.GetData("SELECT * FROM UserPreferences WHERE UserID=" + USER_ID);

                WeeklyCheckBox.Checked = bool.Parse(dsUser.Tables[0].Rows[0]["Weekly"].ToString());

                if (dsUser.Tables[0].Rows[0]["FirstName"] != null)
                    FirstNameTextBox.Text = dsUser.Tables[0].Rows[0]["FirstName"].ToString();

                if (dsUser.Tables[0].Rows[0]["LastName"] != null)
                    LastNameTextBox.Text = dsUser.Tables[0].Rows[0]["LastName"].ToString();

                if (dsUserPrefs.Tables.Count > 0)
                    if (dsUserPrefs.Tables[0].Rows.Count > 0)
                    {
                        //AgeTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Age"].ToString();
                        SexTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Sex"].ToString();

                        LocationTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Location"].ToString();

                        if (dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString() != null)
                        {
                            PublicPrivateCheckList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CalendarPrivacyMode"].ToString();
                        }

                        //if (dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString() != null)
                        //{
                        //    PollRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["PollPreferences"].ToString();
                        //}

                        if (dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString() != null)
                        {
                            CommentsRadioList.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CommentsPreferences"].ToString();
                        }
                        //if (dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString() != null)
                        //{
                        //    if (bool.Parse(dsUserPrefs.Tables[0].Rows[0]["CategoriesOnOff"].ToString()))
                        //        CategoriesOnOffRadioList.SelectedValue = "1";
                        //    else
                        //        CategoriesOnOffRadioList.SelectedValue = "2";
                        //}

                        if (dsUserPrefs.Tables[0].Rows[0]["RecommendationPrefs"].ToString() != null)
                        {
                            string recom = dsUserPrefs.Tables[0].Rows[0]["RecommendationPrefs"].ToString();
                            if (recom.Contains("1"))
                                RecommendationsCheckList.Items[0].Selected = true;
                            if (recom.Contains("2"))
                                RecommendationsCheckList.Items[1].Selected = true;
                            if (recom.Contains("3"))
                                RecommendationsCheckList.Items[2].Selected = true;
                        }

                        if (dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString() != null)
                        {
                            CommunicationPrefsRadioList.SelectedValue =
                                dsUserPrefs.Tables[0].Rows[0]["CommunicationPrefs"].ToString();
                        }

                        //if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString() != null)
                        //{
                        //    if (dsUserPrefs.Tables[0].Rows[0]["Country"].ToString().Trim() != "")
                        //    {
                        //        if (dsUserPrefs.Tables[0].Rows[0]["Address"].ToString() != null)
                        //        {
                        //            AddressTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["Address"].ToString();
                        //        }

                        //        if (dsUserPrefs.Tables[0].Rows[0]["City"].ToString() != null)
                        //        {
                        //            BillCityTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["City"].ToString();
                        //        }

                        //        if (dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString() != null)
                        //        {
                        //            ZipTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["ZIP"].ToString();
                        //        }
                        //        BillCountryDropDown.DataBind();
                        //        BillCountryDropDown.ClearSelection();
                        //        BillCountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["Country"].ToString();

                        //        DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["Country"].ToString());

                        //        bool isText = false;
                        //        if (dsStates.Tables.Count > 0)
                        //            if (dsStates.Tables[0].Rows.Count > 0)
                        //            {
                        //                BillStateDropDown.DataSource = dsStates;
                        //                BillStateDropDown.DataTextField = "state_2_code";
                        //                BillStateDropDown.DataValueField = "state_id";
                        //                BillStateDropDown.DataBind();
                        //                BillStateDropDown.Items.Insert(0, new ListItem("Select State..", "-1"));

                        //                if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null)
                        //                {
                        //                    ListItem a = BillStateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["State"].ToString());
                        //                    if (a != null)
                        //                        BillStateDropDown.SelectedValue = a.Value;
                        //                }

                        //                BillStateDropPanel.Visible = true;
                        //                BillStateTextPanel.Visible = false;
                        //            }
                        //            else
                        //            {
                        //                isText = true;
                        //            }
                        //        else
                        //            isText = true;

                        //        if (isText)
                        //        {
                        //            if (dsUserPrefs.Tables[0].Rows[0]["State"].ToString() != null)
                        //            {
                        //                BillStateTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["State"].ToString();
                        //            }
                        //            BillStateTextPanel.Visible = true;
                        //            BillStateDropPanel.Visible = false;
                        //        }
                        //    }
                        //    else
                        //    {
                        //        BillCountryDropDown.DataBind();
                        //        BillCountryDropDown.SelectedValue = "223";
                        //    }
                        //}
                        //else
                        //{
                        //    BillCountryDropDown.DataBind();
                        //    BillCountryDropDown.SelectedValue = "223";
                        //}

                        if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString() != null)
                        {
                            if (dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString().Trim() != "")
                            {
                                if (dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString() != null)
                                {
                                    CityTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["CatCity"].ToString();
                                }

                                CatZipTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["CatZip"].ToString();

                                CountryDropDown.DataBind();
                                CountryDropDown.SelectedValue = dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString();
                                ChangeState(CountryDropDown, new EventArgs());

                                DataSet dsStates = dat.GetData("SELECT * FROM State WHERE country_id=" + dsUserPrefs.Tables[0].Rows[0]["CatCountry"].ToString());

                                bool isText = false;
                                if (dsStates.Tables.Count > 0)
                                    if (dsStates.Tables[0].Rows.Count > 0)
                                    {
                                        StateDropDown.DataSource = dsStates;
                                        StateDropDown.DataTextField = "state_2_code";
                                        StateDropDown.DataValueField = "state_id";
                                        StateDropDown.DataBind();

                                        if (dsUserPrefs.Tables[0].Rows[0]["CatState"] != null)
                                        {
                                            StateDropDown.SelectedValue = StateDropDown.Items.FindByText(dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString()).Value;
                                        }

                                        StateDropDownPanel.Visible = true;
                                        StateTextBoxPanel.Visible = false;
                                        RequiredFieldValidator2.Visible = false;
                                    }
                                    else
                                    {
                                        isText = true;
                                    }
                                else
                                    isText = true;

                                if (isText)
                                {
                                    RequiredFieldValidator2.Visible = true;
                                    if (dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString() != null)
                                    {
                                        StateTextBox.Text = dsUserPrefs.Tables[0].Rows[0]["CatState"].ToString();
                                    }
                                    StateTextBoxPanel.Visible = true;
                                    StateDropDownPanel.Visible = false;
                                }
                                ChangeCity(new object(), new EventArgs());
                                if (CountryDropDown.SelectedValue == "223")
                                    MajorCityDrop.Items.FindByValue(dsUserPrefs.Tables[0].Rows[0]["MajorCity"].ToString()).Selected = true;
                            }
                        }
                        if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString() != null)
                        {
                            if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("1"))
                                TextingCheckBoxList.Items[0].Selected = true;
                            //if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("2"))
                            //    TextingCheckBoxList.Items[1].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["TextingPrefs"].ToString().Contains("3"))
                                TextingCheckBoxList.Items[2].Selected = true;
                        }

                        if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString() != null)
                        {
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("1"))
                                EmailCheckList.Items[0].Selected = true;
                            //if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("2"))
                            //    EmailCheckList.Items[1].Selected = true;

                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[0].Value))
                                EmailUserCheckList1.Items[0].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[1].Value))
                                EmailUserCheckList1.Items[1].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[2].Value))
                                EmailUserCheckList1.Items[2].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList1.Items[3].Value))
                                EmailUserCheckList1.Items[3].Selected = true;

                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[0].Value))
                                EmailUserCheckList2.Items[0].Selected = true;
                            if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[1].Value))
                                EmailUserCheckList2.Items[1].Selected = true;
                            //if (dsUserPrefs.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains(EmailUserCheckList2.Items[2].Value))
                            //    EmailUserCheckList2.Items[2].Selected = true;
                        }
                    }

                DataSet dsComments = d.GetData("SELECT * FROM User_Comments CU, Users U WHERE CU.CommenterID=U.User_ID AND CU.UserID=" + USER_ID.ToString());
                //Label UserNameLabel = (Label)Tab3.FindControl("UserNameLabel");

                //UserNameLabel.Text = dsUser.Tables[0].Rows[0]["UserName"].ToString();

                if (dsUser.Tables[0].Rows[0]["Email"].ToString() != null)
                {
                    EmailTextBox.Text = dsUser.Tables[0].Rows[0]["Email"].ToString();
                }

                if (dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString() != null)
                {
                    PhoneTextBox.Text = dsUser.Tables[0].Rows[0]["PhoneNumber"].ToString();
                }

                if (dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString() != null)
                {
                    ProviderDropDown.SelectedValue = dsUser.Tables[0].Rows[0]["PhoneProvider"].ToString();
                }

                Image FriendImage = (Image)Tab3.FindControl("FriendImage");

                if (dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString() != null)
                {
                    if (System.IO.File.Exists(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString()))
                    {
                        System.Drawing.Image theimg = System.Drawing.Image.FromFile(Server.MapPath(".") + "/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() +
                "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString());

                        double width = double.Parse(theimg.Width.ToString());
                        double height = double.Parse(theimg.Height.ToString());

                        if (width > height)
                        {
                            if (width <= 150)
                            {

                            }
                            else
                            {
                                double dividor = double.Parse("150.00") / double.Parse(width.ToString());
                                width = double.Parse("150.00");
                                height = height * dividor;
                            }
                        }
                        else
                        {
                            if (width == height)
                            {
                                width = double.Parse("150.00");
                                height = double.Parse("150.00");
                            }
                            else
                            {
                                double dividor = double.Parse("150.00") / double.Parse(height.ToString());
                                height = double.Parse("150.00");
                                width = width * dividor;
                            }
                        }

                        FriendImage.Width = int.Parse((Math.Round(decimal.Parse(width.ToString()))).ToString());
                        FriendImage.Height = int.Parse((Math.Round(decimal.Parse(height.ToString()))).ToString());

                        FriendImage.ImageUrl = "~/UserFiles/" + dsUser.Tables[0].Rows[0]["UserName"].ToString() + "/Profile/" + dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString();
                        Session["ProfilePicture"] = dsUser.Tables[0].Rows[0]["ProfilePicture"].ToString();
                    }
                    else
                    {
                        FriendImage.ImageUrl = "~/NewImages/NoAvatar150.jpg";
                    }
                }
                else
                    FriendImage.ImageUrl = "~/NewImages/NoAvatar150.jpg";
            }
            else
            {
                if (Session["User"] == null)
                {
                    ErrorLabel.Text = "something happen";
                    //Session.Abandon();
                    Response.Redirect("~/login");

                }
            }

            DataSet dsVenues = dat.GetData("SELECT * FROM UserVenues UV, Venues V WHERE V.ID=UV.VenueID AND UV.UserID=" + Session["User"].ToString());

            CheckBoxList VenueCheckBoxes = new CheckBoxList();
            VenueCheckBoxes.Width = 530;
            VenueCheckBoxes.CssClass = "VenueCheckBoxes";
            VenueCheckBoxes.ID = "VenueCheckBoxes";
            VenueCheckBoxes.RepeatColumns = 4;
            VenueCheckBoxes.RepeatDirection = RepeatDirection.Horizontal;

            VenueCheckBoxes.DataSource = dsVenues;
            VenueCheckBoxes.DataTextField = "NAME";
            VenueCheckBoxes.DataValueField = "ID";
            VenueCheckBoxes.DataBind();

            Literal lit = new Literal();
            lit.Text = "<div class=\"Pad2\">";
            VenuesChecksPanel.Controls.Add(lit);
            for (int i = 0; i < VenueCheckBoxes.Items.Count; i++)
            {
                VenueCheckBoxes.Items[i].Selected = true;
            }

            if (VenueCheckBoxes.Items.Count == 0)
            {
                Label label = new Label();
                label.CssClass = "VenueCheckBoxes";
                label.Text = "You have no venues specified as your favorite. To add venues as your favorites search for them on the <a href=\"venue-search\" class=\"NavyLink12\">Venues Page</a>";
                VenuesChecksPanel.Controls.Add(label);
            }
            else
            {
                VenuesChecksPanel.Controls.Add(VenueCheckBoxes);
            }
            lit = new Literal();
            lit.Text = "</div>";

            VenuesChecksPanel.Controls.Add(lit);
        }
        catch (Exception ex)
        {
            UserErrorLabel.Text = ex.ToString();
        }

        if (Request.QueryString["p"] != null)
        {
            RadTabStrip2.Tabs[2].Selected = true;
            RadTabStrip2.Tabs[2].CssClass = "MyTabsPreferencesSelected";
            RadTabStrip2.Tabs[0].CssClass = "MyTabsMessages";
            RadTabStrip2.Tabs[1].CssClass = "MyTabsFriends";
            TheMultipage.PageViews[2].Selected = true;
        }

        if (Request.QueryString["G"] != null)
        {
            RadTabStrip2.Tabs[3].Selected = true;
            RadTabStrip2.Tabs[3].CssClass = "MyTabsGroupsSelected";
            RadTabStrip2.Tabs[0].CssClass = "MyTabsMessages";
            RadTabStrip2.Tabs[1].CssClass = "MyTabsFriends";
            RadTabStrip2.Tabs[2].CssClass = "MyTabsPreferences";
            TheMultipage.PageViews[3].Selected = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];

        FormsAuthenticationTicket authTicket = null;
        try
        {
            string group = "";
            if (authCookie != null)
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                group = authTicket.UserData.ToString();
            }

            if (group.Contains("User"))
            {
                Session["User"] = authTicket.Name;
                Session["UserName"] = dat.GetData("SELECT UserName FROM USERS WHERE User_ID=" + Session["User"].ToString()).Tables[0].Rows[0]["UserName"].ToString();
            }
            else
            {
            }
        }
        catch (Exception ex)
        {
        }

        Label messageLabel = (Label)dat.FindControlRecursive(this, "MessageLabel");

        if (messsageMode == Mode.Private)
            messageLabel.Text = messageText;
        else if (messsageMode == Mode.HippoRequest)
        {
            Label label = new Label();
            label.Text = messageText;

            LinkButton link = new LinkButton();
            link.Text = "Accept This Friend";
            link.CssClass = "AddLink";
            link.CausesValidation = false;
            link.Click += new EventHandler(this.AcceptFriendReply);

            MessagePanel.Controls.Add(label);
            MessagePanel.Controls.Add(link);

            SearchBottomButton.Visible = false;
            MessageTextBox.Visible = false;
        }
        else if (messsageMode == Mode.HippoReply)
        {
            Label label = new Label();
            label.Text = messageText;

            MessagePanel.Controls.Add(label);

            SearchBottomButton.Visible = false;
            MessageTextBox.Visible = false;
        }
    }
示例#28
0
    protected void PrefsSave(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
            string message = "";
            if (cookie == null)
            {
                cookie = new HttpCookie("BrowserDate");
                cookie.Value = DateTime.Now.ToString();
                cookie.Expires = DateTime.Now.AddDays(22);
                Response.Cookies.Add(cookie);
            }
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

            string prefs = "";

            LinkButton saveB = (LinkButton)sender;
            string friend = saveB.CommandArgument;

            Label label = (Label)dat.FindControlRecursive(this, "ErrorLabel" + friend);

            try
            {
                CheckBox imbE = (CheckBox)dat.FindControlRecursive(this, "email" + friend);

                if (imbE != null)
                {
                    if (imbE.Checked)
                        prefs += "0";

                }

                imbE = (CheckBox)dat.FindControlRecursive(this, "email2" + friend);

                if (imbE != null)
                {
                    if (imbE.Checked)
                        prefs += "2";
                }

                imbE = (CheckBox)dat.FindControlRecursive(this, "email3" + friend);

                if (imbE != null)
                {
                    if (imbE.Checked)
                        prefs += "4";
                }

                imbE = (CheckBox)dat.FindControlRecursive(this, "email4" + friend);

                if (imbE != null)
                {
                    if (imbE.Checked)
                        prefs += "6";
                }

                imbE = (CheckBox)dat.FindControlRecursive(this, "email5" + friend);

                if (imbE != null)
                {
                    if (imbE.Checked)
                        prefs += "8";
                }

                DataView dvF = dat.GetDataDV("SELECT * FROM UserFriendPrefs WHERE FriendID=" + friend);

                if (dvF.Count > 0)
                {
                    dat.Execute("UPDATE UserFriendPrefs SET Preferences = '" + prefs + "' WHERE UserID=" +
                        Session["User"].ToString() + " AND FriendID=" + friend);
                }
                else
                {
                    dat.Execute("INSERT INTO UserFriendPrefs (Preferences, UserID, FriendID) VALUES('" + prefs + "', " +
                        Session["User"].ToString() + ", " + friend + ")");
                }
            }
            catch (Exception ex)
            {
                label.Text += message+"<br/><br/>"+ex.ToString();
            }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlLink lk = new HtmlLink();
        HtmlHead head = (HtmlHead)Page.Header;
        lk.Attributes.Add("rel", "canonical");
        lk.Href = "http://hippohappenings.com/EnterVenue.aspx";
        head.Controls.AddAt(0, lk);

        HttpCookie cookie = Request.Cookies["BrowserDate"];
        if (cookie == null)
        {
            cookie = new HttpCookie("BrowserDate");
            cookie.Value = DateTime.Now.ToString();
            cookie.Expires = DateTime.Now.AddDays(22);
            Response.Cookies.Add(cookie);
        }
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];

        FormsAuthenticationTicket authTicket = null;

        ImageButton5.PostBackUrl = Request.Url.AbsoluteUri;

        Button button = (Button)dat.FindControlRecursive(this, "Button2");
        button.CssClass = "NavBarImageAddVenueSelected";

        DataView dv = dat.GetDataDV("SELECT * FROM TermsAndConditions");
        Literal lit1 = new Literal();
        lit1.Text = dv[0]["Content"].ToString();
        TACTextBox.Controls.Add(lit1);

        if (!IsPostBack)
        {

            Session.Remove("CategoriesSet");
            Session["CategoriesSet"] = null;

            CountryDropDown.SelectedValue = "223";
            DataSet dsCountries = dat.GetData("SELECT * FROM State WHERE country_id=223");

            StateDropDown.DataSource = dsCountries;
            StateDropDown.DataTextField = "state_2_code";
            StateDropDown.DataValueField = "state_id";
            StateDropDown.DataBind();
            StateDropDownPanel.Visible = true;
            StateTextBoxPanel.Visible = false;
        }

        try
        {
            Session["RedirectTo"] = Request.Url.AbsoluteUri;

            if (Session["User"] != null)
            {

                //ASP.controls_ads_ascx Ads1 = new ASP.controls_ads_ascx();
                //Ads1.DATA_SET = dat.RetrieveAds(Session["User"].ToString(), false);
                //Ads1.MAIN_AD_DATA_SET = dat.RetrieveMainAds(Session["User"].ToString());
                //Ads1.Controls.Add(Ads1);
                BigEventPanel.Visible = true;
                LoggedOutPanel.Visible = false;
                LoadControls();

                if (!IsPostBack)
                {
                    if (Request.QueryString["ID"] != null)
                    {

                        fillVenue();

                    }
                }

            }
            else
            {
                WelcomeLabel.Text = "On Hippo Happenings, the users have all the power to post event, ads and venues alike. In order to do so, and for us to maintain clean and manageable content,  "
                    + " we require that you <a class=\"AddLink\" href=\"Register.aspx\">create an account</a> with us. <a class=\"AddLink\" href=\"UserLogin.aspx\">Log in</a> if you have an account already. " +
                    "Having an account with us will allow you to do many other things as well. You'll will be able to add events to your calendar, communicate with others going to events, add your friends, filter content based on your preferences, " +
                    " feature your ads thoughout the site and much more. <br/><br/>So let's go <a class=\"AddLink\" style=\"font-size: 16px;\" href=\"Register.aspx\">Register!</a>";

                BigEventPanel.Visible = false;
                LoggedOutPanel.Visible = true;

            }
        }
        catch (Exception ex)
        {
            ErrorLabel.Text = ex.ToString();
            LoggedOutPanel.Visible = true;
            BigEventPanel.Visible = false;
        }
    }
示例#30
0
    protected void ServerAcceptFriend(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];

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

            LinkButton link = (LinkButton)sender;
            string[] delim = { "accept" };

            int To_ID = int.Parse(link.CommandArgument.Split(delim, StringSplitOptions.None)[1]);

            Panel panel = (Panel)dat.FindControlRecursive(this, "RadPanel" + link.CommandArgument.Split(delim, StringSplitOptions.None)[0]);
            Panel wrapPanel = (Panel)dat.FindControlRecursive(this, "acceptWrap" + link.CommandArgument.Split(delim, StringSplitOptions.None)[0]);

            DataSet ds = dat.GetData("SELECT * FROM User_Friends WHERE UserID=" + Session["User"].ToString() +
                " AND FriendID=" + To_ID);

            bool hasFriend = false;

            if (ds.Tables.Count > 0)
                if (ds.Tables[0].Rows.Count > 0)
                    hasFriend = true;
                else
                    hasFriend = false;
            else
                hasFriend = false;

            if (!hasFriend)
            {

                SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());

                conn.Open();
                SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, " +
                    "From_UserID, To_UserID, Date, [Read], Mode)"
                    + " VALUES(@content, @subject, "+dat.HIPPOHAPP_USERID.ToString()+", @toID, @date, 'False', 0)", conn);
                cmd.Parameters.Add("@content", SqlDbType.Text).Value = "Congratulations!, <br/><br/> " +
                    "We wanted to let you know that " + Session["UserName"].ToString()
                    + " has accepted your friend request. Good luck in your journey!<br/><br/> Have a " +
                    "Happening Day! <br/><br/> ";
                cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "Friend Request Approved from " + Session["UserName"].ToString();
                cmd.Parameters.Add("@toID", SqlDbType.Int).Value = To_ID;
                cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
                cmd.ExecuteNonQuery();

                DataSet dsUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + Session["User"].ToString());
                DataSet dsTo = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.User_ID=" + To_ID);

                //only send to email if users preferences are set to do so.
                if (dsTo.Tables[0].Rows[0]["EmailPrefs"].ToString().Contains("8"))
                {
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"],
                    System.Configuration.ConfigurationManager.AppSettings["emailName"],
                        dsTo.Tables[0].Rows[0]["Email"].ToString(), "Congratulations!, <br/><br/> " +
                        "We wanted to let you know that " + Session["UserName"].ToString()
                        + " has accepted your friend request. Good luck in your journey!<br/><br/> Have a " +
                        "Happening Day! <br/><br/> ", "Friend Request Approved from " + Session["UserName"].ToString());
                }
                dat.Execute("INSERT INTO User_Friends (UserID, FriendID) VALUES(" + Session["User"].ToString()
                    + ", " + To_ID + ")");
                dat.Execute("INSERT INTO User_Friends (UserID, FriendID) VALUES(" + To_ID
                    + ", " + Session["User"].ToString() + ")");

                conn.Close();

            }

            Literal lit = new Literal();
            lit.Text = "<div style=\"float: right; width: 220px;height: 30px; margin: 5px;\" " +
                "class=\"Green12LinkNF\">You have accepted this gal/guy as a friend! Good luck, you two!</div>";

            panel.Controls.AddAt(7, lit);

            wrapPanel.Visible = false;
        }
        catch (Exception ex)
        {
            AleksLabel.Text = ex.ToString();
            UpdatePanel2.Update();
        }
    }