当前位置: 首页>>代码示例>>C#>>正文


C# Data.GetIP方法代码示例

本文整理汇总了C#中Data.GetIP方法的典型用法代码示例。如果您正苦于以下问题:C# Data.GetIP方法的具体用法?C# Data.GetIP怎么用?C# Data.GetIP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Data的用法示例。


在下文中一共展示了Data.GetIP方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Suggest

    protected void Suggest(object sender, EventArgs e)
    {
        if (VenueSuggestTextBox.Text.Trim() != "")
        {
            Data dat = new Data(DateTime.Now);
            VenueSuggestTextBox.Text = dat.stripHTML(VenueSuggestTextBox.Text.Trim());

            dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString()
                , "Gotten a venue suggestions from: IP: " + dat.GetIP() + ", Message: " + VenueSuggestTextBox.Text + ", Email: " + EmailTextBox.Text,
                "Venue Suggestion Submitted");

            SuggestErrorLabel.Text = "Your suggestion has been made! Thanks!";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:16,代码来源:Home.aspx.cs

示例2: PostIt

    protected void PostIt(object sender, EventArgs e)
    {
        object appSeshCountry;
        object appSeshState;
        object appSeshCity;
        object appSeshZip;
        object appSeshRadius;
        HttpCookie cookie = Request.Cookies["BrowserDate"];

        DateTime isn = DateTime.Now;

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

        AuthorizePayPal d = new AuthorizePayPal();

        if (AgreeCheckBox.Checked)
        {
            bool chargeCard = false;
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
            conn.Open();

            //Add case for if Paypal is filled in...
            //Authorize Credit Card
            decimal price = 0.00M;
            bool goOn = false;
            string message = "";
            string transactionID = "";
            if (FeaturePanel.Visible && TotalLabel.Text.Trim() != "")
            {
                if (decimal.TryParse(TotalLabel.Text.Trim(), out price))
                {
                    if (price != 0.00M)
                    {
                        if (PaymentPanel.Visible)
                        {
                            if (FirstNameTextBox.Text.Trim() == "" || LastNameTextBoxtBox.Text.Trim() == "" ||
                               BillingStreetAddressTextBox.Text.Trim() == "" || BillingCityTextBox.Text.Trim() == "" ||
                               BillingZipCodeTextBox.Text.Trim() == "" || BillingStateTextBox.Text.Trim() == "" ||
                                CardNumberTextBox.Text.Trim() == "" || CSVTextBox.Text.Trim() == "")
                            {
                                goOn = false;
                                Session["Featured"] = false;
                                message = "Please fill in all of the billing information.";
                            }
                            else
                            {
                                goOn = false;
                                Session["Featured"] = false;
                                string country = dat.GetDataDV("SELECT country_2_code FROM Countries WHERE country_id=" + BillingCountry.SelectedValue)[0]["country_2_code"].ToString();
                                com.paypal.sdk.util.NVPCodec status = d.DoPayment("Authorization", TotalLabel.Text, CardTypeDropDown.SelectedValue, CardNumberTextBox.Text.Trim(),
                                    ExpirationMonth.SelectedItem.Text, ExpirationYear.SelectedItem.Text, CSVTextBox.Text.Trim(), FirstNameTextBox.Text.Trim(), LastNameTextBoxtBox.Text.Trim(),
                                    BillingStreetAddressTextBox.Text.Trim(), BillingCityTextBox.Text, BillingStateTextBox.Text, country, BillingZipCodeTextBox.Text.Trim(), dat.GetIP());
                                message = status.ToString();
                                string successORFailure = status["ACK"];
                                switch (successORFailure.ToLower())
                                {
                                    case "failure":
                                        goOn = false;
                                        Session["Featured"] = false;
                                        message = status["L_LONGMESSAGE0"];
                                        break;
                                    case "successwithwarning":
                                        goOn = false;
                                        Session["Featured"] = false;
                                        message = status["L_SHORTMESSAGE0"];
                                        if (message == "Transaction approved but with invalid CSC format.")
                                            message = "Your CVC/CSV format for this card is not valid.";
                                        break;
                                    case "success":
                                        transactionID = status["TRANSACTIONID"];
                                        Session["TransID"] = transactionID;
                                        goOn = true;
                                        chargeCard = true;
                                        Session["Featured"] = true;
                                        break;
                                    default:
                                        goOn = false;
                                        Session["Featured"] = false;
                                        message = "There was an internal problem. Please contact support at: [email protected] Please include as much detail as possible about what you are trying to do.";
                                        foreach (string key in status.Keys)
                                        {
                                            message += "key: " + key.ToString() + ", value: " + status[key].ToString() + "<br/>";
                                        }
                                        break;
                                }
                            }
                        }
                        else
                        {
                            goOn = true;
                            Session["Featured"] = true;
                        }
                    }
                    else
                    {
                        if (SearchTermsListBox.Items.Count > 0 && price == 0.00M)
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:PostAnAd.aspx.cs

示例3: GoToSearch

    protected void GoToSearch(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];

        string country = "";
        string state = "";
        string city = "";

        FormsAuthenticationTicket authTicket = null;

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

        if (group.Contains("User"))
        {
            DataSet ds1 = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE U.User_ID=" +
                authTicket.Name + " AND U.User_ID=UP.UserID ");

            if(ds1.Tables.Count > 0)
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    country = ds1.Tables[0].Rows[0]["CatCountry"].ToString();
                    state = ds1.Tables[0].Rows[0]["CatState"].ToString();
                    city = ds1.Tables[0].Rows[0]["CatCity"].ToString();
                }
        }
        else
        {
            DataSet ds1 = dat.GetData("SELECT * FROM SearchIPs WHERE IP='" + dat.GetIP() + "'");

            if(ds1.Tables.Count > 0)
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    country = ds1.Tables[0].Rows[0]["Country"].ToString();
                    state = ds1.Tables[0].Rows[0]["State"].ToString();
                    city = ds1.Tables[0].Rows[0]["City"].ToString();
                }

        }

        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 [email protected] ";
            if (city != "")
            {
                types[1] = SqlDbType.NVarChar;
                data[1] = city;
                city = " AND [email protected] ";
            }
        }
        else
        {
            if (city != "")
            {
                types[0] = SqlDbType.NVarChar;
                data[0] = city;
                city = " AND [email protected] ";
            }
        }

        DataSet 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 CONVERT(NVARCHAR, MONTH(EO.DateTimeStart)) + '/' + CONVERT(NVARCHAR, DAY(EO.DateTimeStart)) + '/' + CONVERT(NVARCHAR, YEAR(EO.DateTimeStart)) = '" + RadCalendar1.SelectedDate.ToShortDateString() + "'", types, data);

        EventPanel.Controls.Clear();
        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());
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:Home_OLD.aspx.cs

示例4: Page_Load


//.........这里部分代码省略.........
            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();
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:Home_OLD.aspx.cs

示例5: MakeItSo


//.........这里部分代码省略.........
                            if (PasswordTextBox.Text == ConfirmPasswordTextBox.Text)
                                safeToGo = true;
                            else
                            {
                                safeToGo = false;
                                MessageLabel.Text = "*The Confirm Password must match the Password.";
                            }

                            if (safeToGo)
                            {
                                //if (CheckImageButton.ImageUrl == "image/CheckSelected.png")
                                //    safeToGo = true;
                                //else
                                //{
                                //    safeToGo = false;
                                //    MessageLabel.Text = "*Read and agree to the Terms And Conditions in order to sign up.";
                                //}

                                if (safeToGo)
                                {
                                    Encryption encrypt = new Encryption();
                                    string namesStart = "";
                                    string namesEnd = "";
                                    if (FirstNameTextBox.THE_TEXT.Trim() != "")
                                    {
                                        namesStart = ", FirstName, LastName";
                                        namesEnd = ", '" +
                                        dat.stripHTML(FirstNameTextBox.THE_TEXT.Trim().Replace("'", "''")) + "', '" +
                                        dat.stripHTML(LastNameTextBox.THE_TEXT.Trim().Replace("'", "''")) + "'";
                                    }
                                    dat.Execute("INSERT INTO Users (HowHeard, UserName, Email, Password, IPs" + namesStart + ", DateCreated) VALUES('" +
                                        HowHeardTextBox.THE_TEXT.Trim().Replace("'", "").Replace("\"", "") + "','" +
                                        UserNameTextBox.THE_TEXT + "', '" + EmailLabel.Text + "', '" +
                                        encrypt.encrypt(PasswordTextBox.Text) + "', ';" + dat.GetIP() + ";'" + namesEnd + ", GETDATE())");
                                    DataSet dsID = dat.GetData("SELECT User_ID FROM Users WHERE UserName='" + UserNameTextBox.THE_TEXT + "'");
                                    string ID = dsID.Tables[0].Rows[0]["User_ID"].ToString();
                                    string message2 = "Welcome to Hippo Happenings! <br/> It is now your place for Events, "
                                    + "Venues, Classifieds and connecting with people in your area. <br/> To start, select your preferences"
                                    + " for filtering your content on the site by going to <a class=\"AddLink\" href=\"UserPreferences.aspx\">My Preferences</a>. ";
                                    dat.Execute("INSERT INTO UserPreferences (UserID, EventsAttended, CalendarPrivacyMode, CommunicationPrefs, CommentsPreferences, PollPreferences, CatCountry, EmailPrefs, RecommendationPrefs) VALUES (" + ID + ", 0, 1, 1, 1, 1, 223, '123456789C', 3)");
                                    dat.Execute("INSERT INTO UserMessages (MessageContent, MessageSubject, "
                                        + "From_UserID, To_UserID, Date, [Read], Mode, Live) VALUES('" + message2 +
                                        "', 'Hippo Happenings Welcome!', 6, " + ID + ", '" + DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).ToString() + "', 'False', 1, 'True')");

                                    ds = dat.GetData("SELECT U.Password, U.User_ID, UP.CatCountry, UP.CatState, UP.CatCity, U.UserName FROM Users U, UserPreferences UP WHERE U.User_ID=UP.UserID AND U.UserName='"+UserNameTextBox.THE_TEXT+"'");
                                    Session["UserName"] = UserNameTextBox.THE_TEXT.Trim();
                                    Session["User"] = ID;

                                    //insert all ad categories
                                    DataView dvCats = dat.GetDataDV("SELECT * FROM AdCategories WHERE isParent = 'True'");

                                    for (int i = 0; i < dvCats.Count; i++)
                                    {
                                        dat.Execute("INSERT INTO UserCategories (UserID, CategoryID) VALUES(" + ID + ", " + dvCats[i]["ID"].ToString() + ")");
                                    }

                                    string radius = "";
                                    if (RadiusPanel.Visible)
                                    {
                                        radius = ", Radius=" + RadiusDropDown.SelectedValue;
                                    }
                                    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());

                                    if (conn.State != ConnectionState.Open)
                                        conn.Open();
                                    SqlCommand cmd = new SqlCommand("UPDATE UserPreferences SET  " +
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:CompleteRegistration.aspx.cs

示例6: Page_Load

    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", ":")));
        DataSet ds;

        HtmlHead head = (HtmlHead)Page.Header;

        if (Request.QueryString["ID"] != null)
        {
            string catID = Request.QueryString["ID"].ToString();

            string location = "";

            //Get the location
            if (Session["User"] != null)
            {
                DataView dvPrefs = dat.GetDataDV("SELECT * FROM UserPreferences WHERE UserID=" + Session["User"].ToString());
                location = " AND G.State='" + dvPrefs[0]["CatState"].ToString() + "' AND G.City='" +
                    dvPrefs[0]["CatCity"].ToString() + "'";
            }
            else
            {
                DataView dvIP = dat.GetDataDV("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.IPs LIKE '%;" + dat.GetIP() + ";%'");

                //If one or multiple found, look up ads on city and state of the first record
                if (dvIP.Count > 0)
                {
                    location = " AND G.State='" + dvIP[0]["CatState"].ToString() +
                        "' AND G.City='" + dvIP[0]["CatCity"].ToString() + "'";
                }
                //If not found look in searches table, get the city and state
                else
                {
                    DataView dvSearch = dat.GetDataDV("SELECT * FROM SearchIPs WHERE IP='" + dat.GetIP() + "'");
                    location = " AND G.State='" + dvSearch[0]["State"].ToString() +
                        "' AND G.City='" + dvSearch[0]["City"].ToString() + "'";
                }
            }

            ds = dat.GetData("SELECT * FROM Groups G, Group_Category GC, GroupCategories GCC WHERE GCC.ID=" +
                catID + " AND GC.Category_ID=GCC.ID AND G.ID=GC.Group_ID " + location);

            SearchElements.GROUP_DS = ds;
            SearchElements.DataBind2();

            NumResultsLabel.Text = "(" + ds.Tables[0].Rows.Count + " Records Found)";

            string theLink = "http://" + Request.Url.Authority + "/" +
            dat.MakeNiceName(ds.Tables[0].Rows[0]["GroupName"].ToString()) + "_" + catID + "_Group_Category";

            HtmlLink lk = new HtmlLink();
            lk.Href = theLink;
            lk.Attributes.Add("rel", "bookmark");
            head.Controls.AddAt(0, lk);

            HtmlMeta hm = new HtmlMeta();
            HtmlMeta kw = new HtmlMeta();
            HtmlMeta dc = new HtmlMeta();

            kw.Name = "keywords";
            kw.Content = ds.Tables[0].Rows[0]["GroupName"].ToString() + " Group Category";

            head.Controls.AddAt(0, kw);

            dc.Name = "description";
            dc.Content = "Results for group category: " + ds.Tables[0].Rows[0]["GroupName"].ToString();

            head.Controls.AddAt(0, dc);

            SearchResultsTitleLabel.Text = "<a href=\"" + theLink + "\" style=\"text-decoration: none; color: white;\" >Groups in '" +
                ds.Tables[0].Rows[0]["GroupName"].ToString() + "' Category</a>";
        }
        else
        {
            Response.Redirect("home");
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:85,代码来源:GroupCategorySearch.aspx.cs

示例7: SaveLocation

    protected void SaveLocation(object sender, EventArgs e)
    {
        try
        {
            HttpCookie cookie = Request.Cookies["BrowserDate"];
            DateTime isn = DateTime.Now;

            DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn);

            Data dat = new Data(isn);
            if ((StateTextBoxPanel.Visible && StateTextBox.Text.Trim() != "") ||
                (!StateTextBoxPanel.Visible && StateDropDown.SelectedItem.Text != "State"))
            {
                if (CityTextBox.Text.Trim() != "")
                {
                    CityTextBox.Text = dat.stripHTML(CityTextBox.Text.Trim());
                    Session["LocCountry"] = CountryDropDown.SelectedItem.Value.Trim();
                    string state = "";
                    if (StateTextBoxPanel.Visible)
                    {
                        Session["LocState"] = StateTextBox.Text.Trim();
                        state = StateTextBox.Text.Trim();
                    }
                    else
                    {
                        Session["LocState"] = StateDropDown.SelectedItem.Text.Trim();
                        state = StateDropDown.SelectedItem.Text.Trim();
                    }

                    Session["LocCity"] = CityTextBox.Text.Trim();

                    if (CountryDropDown.SelectedValue == "223")
                    {
                        DataView dvCity = dat.GetDataDV("SELECT * FROM MajorZips MZ, MajorCities MC, State S WHERE " +
                        "MZ.MajorCityID=MC.ID AND S.state_2_code='" + state +
                        "' AND S.state_name=State AND MajorCity='" + CityTextBox.Text.Trim() + "'");

                        //ErrorLabel.Text = "SELECT * FROM MajorZips MZ, MajorCities MC, State S WHERE " +
                        //"MZ.MajorCityID=MC.ID AND S.state_2_code='" + state +
                        //"' AND S.state_name=State AND MajorCity='" + CityTextBox.Text.Trim() + "'";

                        string zip = "";

                        if (dvCity.Count == 0)
                        {
                            dvCity = dat.GetDataDV("SELECT * FROM MajorZips MZ, MajorCities MC, State S WHERE " +
                                "MZ.MajorCityID=MC.ID AND S.state_2_code='" + state +
                                "' AND S.state_name=State");
                            zip = dvCity[0]["MajorCityZip"].ToString();
                        }
                        else
                        {
                            zip = dvCity[0]["MajorCityZip"].ToString();
                        }

                        DataView dvZip = dat.GetDataDV("SELECT * FROM ZipCodes WHERE Zip=" + zip);
                        int count = 1;
                        while (dvZip.Count == 0)
                        {
                            if (dvCity.Count >= count + 1)
                            {
                                zip = dvCity[count]["MajorCityZip"].ToString();
                                count++;
                                dvZip = dat.GetDataDV("SELECT * FROM ZipCodes WHERE Zip=" + zip);
                            }
                            else
                            {
                                break;
                            }
                        }

                        if (dvZip.Count != 0)
                        {
                            Session["LocLat"] = dvZip[0]["Latitude"].ToString();
                            Session["LocLong"] = dvZip[0]["Longitude"].ToString();
                        }
                    }

                    DataView dvCheck = dat.GetDataDV("SELECT * FROM IpToLocation WHERE IP='" + dat.GetIP() + "'");

                    if (dvCheck.Count > 0)
                    {
                        dat.Execute("UPDATE IpToLocation SET State = '" + Session["LocState"].ToString() +
                            "', City = '" + Session["LocCity"].ToString() + "', Country = '" + Session["LocCountry"].ToString() + "' WHERE IP='" + dat.GetIP() + "'");
                    }
                    else
                    {
                        dat.Execute("INSERT INTO IpToLocation (State, City, Country, IP) VALUES ('" + Session["LocState"].ToString() +
                            "', '" + Session["LocCity"].ToString() + "', '" + Session["LocCountry"].ToString() + "','" + dat.GetIP() + "')");
                    }

                    BottomScript.Text = "<script type=\"text/javascript\">Search('anything');</script>";
                }
                else
                {
                    ErrorLabel.Text = "<br />Please Include the City.<br /><br />";
                }
            }
            else
            {
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:Changelocation.aspx.cs

示例8: PostIt

    protected void PostIt(object sender, EventArgs e)
    {
        MessagePanel.Visible = false;
        YourMessagesLabel.Text = "";

        string problem = "";
        bool hasEditChanged = false;
        bool chargeCard = false;
        AuthorizePayPal d = new AuthorizePayPal();
        HttpCookie cookie = Request.Cookies["BrowserDate"];

        DateTime isn = DateTime.Now;

        if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn))
            isn = DateTime.Now;
        DateTime isNow = isn;
        Data dat = new Data(isn); string email = "";
        try
        {
            if (OnwardsIT())
            {
                //Add case for if Paypal is filled in...
                //Authorize Credit Card
                bool goOn = false;
                string message = "";
                decimal price = 0.00M;
                string transactionID = "";

                if (AgreeCheckBox.Checked)
                {
                    if (TotalLabel.Text.Trim() != "")
                    {
                        if (decimal.TryParse(TotalLabel.Text.Trim(), out price))
                        {
                            if (price != 0.00M)
                            {
                                if (FirstNameTextBox.Text.Trim() == "" || LastNameTextBoxtBox.Text.Trim() == "" ||
                                   BillingStreetAddressTextBox.Text.Trim() == "" || BillingCityTextBox.Text.Trim() == "" ||
                                   BillingZipCodeTextBox.Text.Trim() == "" || BillingStateTextBox.Text.Trim() == "" ||
                                   CardNumberTextBox.Text.Trim() == "" || CSVTextBox.Text.Trim() == "")
                                {
                                    goOn = false;
                                    Session["Featured"] = false;
                                    message = "Please fill in all of the billing information.";
                                }
                                else
                                {
                                    goOn = false;
                                    Session["Featured"] = false;
                                    string country = dat.GetDataDV("SELECT country_2_code FROM Countries WHERE country_id=" + BillingCountry.SelectedValue)[0]["country_2_code"].ToString();

                                    com.paypal.sdk.util.NVPCodec status = d.DoPayment("Authorization", TotalLabel.Text, CardTypeDropDown.SelectedValue, CardNumberTextBox.Text.Trim(),
                                        ExpirationMonth.SelectedItem.Text, ExpirationYear.SelectedItem.Text, CSVTextBox.Text.Trim(), FirstNameTextBox.Text.Trim(), LastNameTextBoxtBox.Text.Trim(),
                                        BillingStreetAddressTextBox.Text.Trim(), BillingCityTextBox.Text, BillingStateTextBox.Text, country, BillingZipCodeTextBox.Text.Trim(), dat.GetIP());
                                    message = status.ToString();
                                    string successORFailure = status["ACK"];

                                    switch (successORFailure.ToLower())
                                    {
                                        case "failure":
                                            goOn = false;
                                            Session["Featured"] = false;
                                            message = status["L_LONGMESSAGE0"];
                                            break;
                                        case "successwithwarning":
                                            goOn = false;
                                            Session["Featured"] = false;
                                            message = status["L_SHORTMESSAGE0"];
                                            if (message == "Transaction approved but with invalid CSC format.")
                                                message = "Your CVC/CSV format for this card is not valid.";
                                            break;
                                        case "success":
                                            chargeCard = true;
                                            transactionID = status["TRANSACTIONID"];
                                            Session["TransID"] = transactionID;
                                            goOn = true;
                                            Session["Featured"] = true;
                                            break;
                                        default:
                                            goOn = false;
                                            Session["Featured"] = false;
                                            message = "There was an internal problem. Please contact support at: [email protected] Please include as much detail as possible about what you are trying to do.";
                                            foreach (string key in status.Keys)
                                            {
                                                message += "key: " + key.ToString() + ", value: " + status[key].ToString() + "<br/>";
                                            }
                                            break;
                                    }
                                }
                            }
                            else
                            {
                                goOn = true;
                                Session["Featrued"] = false;
                            }
                        }
                        else
                        {
                            goOn = true;
                            Session["Featured"] = false;
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:BlogEvent.aspx.cs

示例9: Page_Load

    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);
        }
        DateTime today = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
        Data dat = new Data(today);
        DataSet ds;
        if (Request.QueryString["ID"] != null)
        {
            string catID = Request.QueryString["ID"].ToString();

            string location = "";

            //Get the location
            if (Session["User"] != null)
            {
                DataView dvPrefs = dat.GetDataDV("SELECT * FROM UserPreferences WHERE UserID=" + Session["User"].ToString());
                location = " AND V.State='" + dvPrefs[0]["CatState"].ToString() + "' AND V.City='" + dvPrefs[0]["CatCity"].ToString() + "'";
            }
            else
            {
                DataView dvIP = dat.GetDataDV("SELECT * FROM Users U, UserPreferences UP WHERE UP.UserID=U.User_ID AND U.IPs LIKE '%;" + dat.GetIP() + ";%'");

                //If one or multiple found, look up ads on city and state of the first record
                if (dvIP.Count > 0)
                {
                    location = " AND V.State='" + dvIP[0]["CatState"].ToString() +
                        "' AND V.City='" + dvIP[0]["CatCity"].ToString() + "'";
                }
                //If not found look in searches table, get the city and state
                else
                {
                    DataView dvSearch = dat.GetDataDV("SELECT * FROM SearchIPs WHERE IP='" + dat.GetIP() + "'");
                    location = " AND V.State='" + dvSearch[0]["State"].ToString() +
                        "' AND V.City='" + dvSearch[0]["City"].ToString() + "'";
                }
            }

            //get only events after today, since showing all events might be too much
            string timeline = " AND EO.DateTimeStart >= CONVERT(DATETIME, '" + today.Month.ToString() + "/" + today.Day.ToString() + "/" + today.Year.ToString() + "')";

            string command = "SELECT E.ID AS EID, EO.ID AS ReoccurrID, EO.DateTimeStart, 'False' AS isGroup, CONVERT(NVARCHAR, E.ID)+'E' AS HashID, C.Name AS CategoryName, V.ID AS VID, * " +
                "FROM Event_Occurance EO, Event_Category_Mapping ECM, Events E, Venues V, EventCategories C " +
                "WHERE EO.EventID=E.ID AND C.ID=ECM.CategoryID AND E.Venue=V.ID AND ECM.EventID=E.ID AND " +
                "ECM.CategoryID=" + catID + location + timeline;

            ds = dat.GetData(command);
            SearchElements.EVENTS_DS = ds;
            SearchElements.DataBind2();

            NumResultsLabel.Text = "(" + ds.Tables[0].Rows.Count + " Records Found)";

            DataView dvName = dat.GetDataDV("SELECT * FROM EventCategories WHERE ID=" + catID);

            HtmlHead head = (HtmlHead)Page.Header;

            string theLink = "http://" + Request.Url.Authority + "/" +
               dvName[0]["Name"].ToString() + "_Event_Category";

            HtmlLink lk = new HtmlLink();
            lk.Href = theLink;
            lk.Attributes.Add("rel", "bookmark");
            head.Controls.AddAt(0, lk);

            HtmlMeta hm = new HtmlMeta();
            HtmlMeta kw = new HtmlMeta();
            HtmlMeta dc = new HtmlMeta();

            kw.Name = "keywords";
            kw.Content = dvName[0]["Name"].ToString() + " event Category";

            head.Controls.AddAt(0, kw);

            dc.Name = "description";
            dc.Content = "Results for event category: " + dvName[0]["Name"].ToString();

            head.Controls.AddAt(0, dc);

            SearchResultsTitleLabel.Text = "<a href=\"" + theLink +
                "\" style=\"text-decoration: none; color: white;\" >Events in '" +
                dvName[0]["Name"].ToString() + "' Category</a>";

        }else
        {
            Response.Redirect("Home.aspx");
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:93,代码来源:EventCategorySearch.aspx.cs

示例10: Page_Load


//.........这里部分代码省略.........
                //}

                string country = "";
                string state = "";
                string city = "";
                string countryID = "";
                string stateID = "";
                string cityID = "";
                try
                {
                    if (Session["User"] != null)
                    {
                        DataSet ds1 = dat.GetData("SELECT * FROM Users U, UserPreferences UP WHERE U.User_ID=" +
                            Session["User"].ToString() + " AND U.User_ID=UP.UserID ");

                        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 Users U, UserPreferences UP WHERE " +
                                " U.User_ID=UP.UserID AND U.IPs LIKE '%" + dat.GetIP() + "%'");

                        bool getAnotherDs1 = false;
                        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;
                            }
                            else
                            {
                                getAnotherDs1 = true;
                            }
                        else
                        {
                            getAnotherDs1 = true;
                        }

                        if (getAnotherDs1)
                        {
                            ds1 = dat.GetData("SELECT * FROM SearchIPs WHERE IP='" + dat.GetIP() + "'");

                            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();
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:Home.aspx.cs

示例11: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        //2/23/2010%2020%3A54%3A38
        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", ":")));

        bool isPageNew = bool.Parse(ConfigurationSettings.AppSettings["isPageNew"].ToString());
        if (isPageNew)
            ConfigurationSettings.AppSettings["isPageNew"] = "false";

        if ((Session["User"] == null && Session["UserName"] != null) ||
            (Session["UserName"] == null && Session["User"] != null))
        {
            dat.Execute("DELETE FROM Events_Seen_By_User WHERE userID=" + Session["User"].ToString());
            string save1 = "";
            if (Session["AnonymousUser"] != null)
                save1 = Session["AnonymousUser"].ToString();

            string save2 = "";
            if (Session["BigAnonymousUser"] != null)
                save2 = Session["BigAnonymousUser"].ToString();

            Session.Remove("User");
            Session.Remove("UserName");
            FormsAuthentication.SignOut();

            if (save1 != "")
                Session["AnonymousUser"] = save1;

            if (save2 != "")
                Session["BigAnonymousUser"] = save2;

            Response.Redirect("UserLogin.aspx");
        }

        //if (!IsPostBack)
        //{
            try
            {
                HttpCookie cookieZone = Request.Cookies["TimeZone"];

                if (!IsPostBack)
                {
                    if (Session["User"] == null)
                    {
                        dat.Execute("INSERT INTO IP_User_Traffic (IP, PageName, DateAndTime) " +
                            "VALUES ('" + dat.GetIP() + "', '" + Request.Url.AbsolutePath.ToLower() +
                            "', GETDATE())");
                    }
                    else
                    {
                        dat.Execute("INSERT INTO IP_User_Traffic (IP, UserID, PageName, DateAndTime) " +
                            "VALUES ('" + dat.GetIP() + "', " + Session["User"].ToString() +
                            ",'" + Request.Url.AbsolutePath.ToLower() + "', GETDATE())");
                    }
                }

                if (Session["Searching"] != null)
                {
                    RadWindow3.Title = "Your " + Session["Searching"].ToString().Replace("s", "") + " Search Results";
                }

                if (Session["SearchDS"] != null)
                {
                    if (Session["Searching"].ToString() == "Events" &&
                        Request.Url.AbsolutePath.ToLower() == "/eventsearch.aspx" ||
                        Session["Searching"].ToString() == "Venues" &&
                        Request.Url.AbsolutePath.ToLower() == "/venuesearch.aspx")
                    {
                        RadWindow3.Width = 910;
                        RadWindow3.Height = 550;
                        RadWindow3.Top = 100;
                        RadWindow3.Left = 178;
                    }
                    else
                    {
                        RadWindow3.Top = 10;
                        RadWindow3.Left = 765;
                        RadWindow3.Width = 480;
                        RadWindow3.Height = 620;
                        RadWindow3.VisibleOnPageLoad = true;
                    }

                    RadWindow3.VisibleOnPageLoad = true;
                }
                else
                {
                    RadWindow3.VisibleOnPageLoad = false;
                }

            }
            catch (Exception ex)
            {
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:MasterPage.master.cs

示例12: ImageGoTo

    protected void ImageGoTo(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        string arg = ((ImageButton)sender).CommandArgument.ToString();
        Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        switch (arg)
        {
            case "A1":
                Response.Redirect("~/About.aspx");
                break;
            case "A2":
                Response.Redirect("~/Feedback.aspx");
                break;
            case "A3":
                Response.Redirect("~/Vote.aspx");
                break;
            case "G":
                SearchTextBox.Text = d.stripHTML(SearchTextBox.Text);
                if (SearchTextBox.Text != "")
                {
                    char[] delim = { ' ' };
                    string[] tokens;

                    tokens = SearchTextBox.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();

                    //Check if signed in, get address
                    string country = "";
                    string state = "";
                    string stateParam = "";
                    string city = "";
                    string cityParam = "";

                    DataSet dsAddress = new DataSet();
                    if (Session["User"] != null)
                    {
                        dsAddress = d.GetData("SELECT * FROM UserPreferences WHERE UserID=" +
                            Session["User"].ToString());

                        //Get search on address
                        if (dsAddress.Tables.Count > 0)
                            if (dsAddress.Tables[0].Rows.Count > 0)
                            {
                                country = " AND E.Country=" + dsAddress.Tables[0].Rows[0]["CatCountry"].ToString();

                                if (dsAddress.Tables[0].Rows[0]["CatState"].ToString() != "")
                                {
                                    state = " AND [email protected] ";
                                    stateParam = dsAddress.Tables[0].Rows[0]["CatState"].ToString();

                                    if (dsAddress.Tables[0].Rows[0]["CatCity"].ToString() != "")
                                    {
                                        city = " AND [email protected] ";
                                        cityParam = dsAddress.Tables[0].Rows[0]["CatCity"].ToString();
                                    }
                                }
                            }
                    }
                    else
                    {
                        //Check if IP in User table, get address
                        DataSet dsCheck = d.GetData("SELECT * FROM Users WHERE IPs LIKE '%" + d.GetIP() + "%'");

                        bool getSearchIP = false;
                        if (dsCheck.Tables.Count > 0)
                        {
                            if (dsCheck.Tables[0].Rows.Count > 0)
                            {
                                dsAddress = d.GetData("SELECT * FROM UserPreferences WHERE UserID=" +
                            dsCheck.Tables[0].Rows[0]["User_ID"].ToString());

                                //Get search on address
                                if (dsAddress.Tables.Count > 0)
                                    if (dsAddress.Tables[0].Rows.Count > 0)
                                    {
                                        country = " AND E.Country=" + dsAddress.Tables[0].Rows[0]["CatCountry"].ToString();

                                        if (dsAddress.Tables[0].Rows[0]["CatState"].ToString() != "")
                                        {
                                            state = " AND [email protected] ";
                                            stateParam = dsAddress.Tables[0].Rows[0]["CatState"].ToString();

                                            if (dsAddress.Tables[0].Rows[0]["CatCity"].ToString() != "")
                                            {
                                                city = " AND [email protected] ";
                                                cityParam = dsAddress.Tables[0].Rows[0]["CatCity"].ToString();
                                            }
                                        }
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:Header.ascx.cs

示例13: GetMainEvents

    private void GetMainEvents()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        int rowCount = 0;

        try
        {

            if (Session["User"] != null)
            {
                EventsPanel.Controls.Clear();

                DataSet ds = d.GetEventsInLocation(true);

                if (ds.Tables.Count > 0)
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        rowCount = ds.Tables[0].Rows.Count;
                        if (rowCount > cutOff)
                            rowCount = cutOff;
                        for (int i = 0; i < rowCount; i++)
                        {
                            ASP.controls_otherevent_ascx anEvent = new ASP.controls_otherevent_ascx();
                            anEvent.EVENT_ID = ds.Tables[0].Rows[i]["ID"].ToString();
                            anEvent.TITLE = ds.Tables[0].Rows[i]["Header"].ToString();
                            anEvent.SUMMARY = ds.Tables[0].Rows[i]["ShortDescription"].ToString();
                            anEvent.PRESENTED_BY = d.GetDataDV("SELECT DateTimeStart FROM Event_Occurance WHERE EventID=" +
                                ds.Tables[0].Rows[i]["ID"].ToString())[0]["DateTimeStart"].ToString();
                            EventsPanel.Controls.Add(anEvent);
                            //goto NotMuchElse;

                            d.Execute("INSERT INTO Events_Seen_By_User (eventID, userID, Date, SessionID) " +
                                " VALUES(" + ds.Tables[0].Rows[i]["ID"].ToString() + ", " + Session["User"].ToString() + ", " +
                                " '" + DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).ToString() +
                                "', '" + Session["UserSession" + Session["User"].ToString()].ToString() + "')");
                        }

                    }
            }
            else
            {
                DataView dvLocation = d.GetDataDV("SELECT * FROM Users WHERE IPs LIKE '&;" + d.GetIP() + ";%'");

                if(dvLocation.Count == 0)
                    dvLocation =  d.GetDataDV("SELECT * FROM SearchIPs WHERE IP = '" + d.GetIP() + "'");
                DataSet ds = new DataSet();
                bool getUS = false;
                if (Session["GenericEventSession"] == null)
                {
                    Random rand = new Random(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).ToUniversalTime().Millisecond);
                    Session["GenericEventSession"] = rand.Next();
                }

                if (dvLocation.Count > 0)
                {
                    string country = "";
                    string state = "";
                    string city = "";
                    if (dvLocation[0]["Country"].ToString() != "")
                        country = " AND E.Country = " + dvLocation[0]["Country"].ToString();
                    if (dvLocation[0]["State"].ToString() != "")
                        state = " AND E.State = @p0 ";
                    if (dvLocation[0]["City"].ToString() != "")
                        city = " AND E.City = @p1 ";

                    DataSet dsSeenAds = d.GetData("SELECT * FROM Events_Seen_Generic WHERE IP='" +
                        d.GetIP() + "' AND SessionID='" +
                        Session["GenericEventSession"].ToString() + "'");
                    string notTheseAds = "";

                    if (dsSeenAds.Tables.Count > 0)
                        if (dsSeenAds.Tables[0].Rows.Count > 0)
                        {
                            for (int j = 0; j < dsSeenAds.Tables[0].Rows.Count; j++)
                            {
                                if (notTheseAds != "")
                                    notTheseAds += " AND ";
                                notTheseAds += " E.ID <> " + dsSeenAds.Tables[0].Rows[j]["eventID"].ToString();

                            }
                        }
                    if (notTheseAds != "")
                        notTheseAds = " AND ( " + notTheseAds + " ) ";

                    bool couldGetMore = false;

                    if (state != "")
                    {
                        if (city != "")
                        {
                            SqlDbType[] types = { SqlDbType.NVarChar, SqlDbType.NVarChar };
                            object[] data = { dvLocation[0]["State"].ToString(), dvLocation[0]["City"].ToString() };
                            ds = d.GetDataWithParemeters("SELECT  DISTINCT EO.EventID, E.Header, E.Content, E.SponsorPresenter, EO.DateTimeStart FROM Events E, Event_Occurance EO WHERE EO.DateTimeStart >= GETDATE() AND  E.ID=EO.EventID " + notTheseAds + country + state + city, types, data);
                        }
                        else
                        {
                            SqlDbType[] types = { SqlDbType.NVarChar };
                            object[] data = { dvLocation[0]["State"].ToString() };
                            ds = d.GetDataWithParemeters("SELECT  DISTINCT EO.EventID, E.Header, E.Content, E.SponsorPresenter, EO.DateTimeStart FROM Events E, Event_Occurance EO WHERE EO.DateTimeStart >= GETDATE() AND  E.ID=EO.EventID " + notTheseAds + country + state, types, data);
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:Copy+of+Footer.ascx.cs

示例14: GetMainEvents

    private void GetMainEvents()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        int rowCount = 0;

        try
        {

            if (Session["User"] != null)
            {
                EventsPanel.Controls.Clear();

                if (Session["UserSessionEvents"] == null)
                {
                    DataSet dsT = d.GetEventsInLocation(true);
                    Session["UserSessionEvents"] = dsT;
                }

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

                if (Session["UserSessionLastSeenEvent"] == null)
                    Session["UserSessionLastSeenEvent"] = "-1";

                if (ds.Tables.Count > 0)
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        rowCount = ds.Tables[0].Rows.Count;
                        if (rowCount > cutOff)
                            rowCount = cutOff;

                        int startIndex = 0;
                        if (Session["UserSessionLastSeenEvent"].ToString() != "-1")
                            startIndex = int.Parse(Session["UserSessionLastSeenEvent"].ToString());

                        int endIndex = startIndex + cutOff;

                        Session["UserSessionLastSeenEvent"] = endIndex - 1;

                        if (endIndex > ds.Tables[0].Rows.Count)
                        {
                            endIndex = ds.Tables[0].Rows.Count;
                            Session["UserSessionLastSeenEvent"] = "-1";
                        }

                        for (int i = startIndex; i < endIndex; i++)
                        {
                            ASP.controls_otherevent_ascx anEvent = new ASP.controls_otherevent_ascx();
                            anEvent.EVENT_ID = ds.Tables[0].Rows[i]["ID"].ToString();
                            anEvent.TITLE = ds.Tables[0].Rows[i]["Header"].ToString();
                            anEvent.SUMMARY = ds.Tables[0].Rows[i]["Content"].ToString();
                            anEvent.PRESENTED_BY = d.GetDataDV("SELECT DateTimeStart FROM Event_Occurance WHERE EventID=" +
                                ds.Tables[0].Rows[i]["ID"].ToString())[0]["DateTimeStart"].ToString();
                            EventsPanel.Controls.Add(anEvent);
                        }
                    }
            }
            else
            {

                if (Session["GenericEventSession"] == null)
                {
                    DataView dvLocation = d.GetDataDV("SELECT * FROM Users WHERE IPs LIKE '&;" + d.GetIP() + ";%'");

                    if (dvLocation.Count == 0)
                        dvLocation = d.GetDataDV("SELECT * FROM SearchIPs WHERE IP = '" + d.GetIP() + "'");
                    DataSet ds = new DataSet();
                    bool getUS = false;

                    if (dvLocation.Count > 0)
                    {
                        string country = "";
                        string state = "";
                        string city = "";
                        if (dvLocation[0]["Country"].ToString() != "")
                            country = " AND E.Country = " + dvLocation[0]["Country"].ToString();
                        if (dvLocation[0]["State"].ToString() != "")
                            state = " AND E.State = @p0 ";
                        if (dvLocation[0]["City"].ToString() != "")
                            city = " AND E.City = @p1 ";

                        bool couldGetMore = false;

                        if (state != "")
                        {
                            if (city != "")
                            {
                                SqlDbType[] types = { SqlDbType.NVarChar, SqlDbType.NVarChar };
                                object[] data = { dvLocation[0]["State"].ToString(), dvLocation[0]["City"].ToString() };
                                ds = d.GetDataWithParemeters("SELECT  DISTINCT EO.EventID, E.Header, E.Content, E.SponsorPresenter, EO.DateTimeStart FROM Events E, Event_Occurance EO WHERE EO.DateTimeStart >= GETDATE() AND  E.ID=EO.EventID " + country + state + city, types, data);
                            }
                            else
                            {
                                SqlDbType[] types = { SqlDbType.NVarChar };
                                object[] data = { dvLocation[0]["State"].ToString() };
                                ds = d.GetDataWithParemeters("SELECT  DISTINCT EO.EventID, E.Header, E.Content, E.SponsorPresenter, EO.DateTimeStart FROM Events E, Event_Occurance EO WHERE EO.DateTimeStart >= GETDATE() AND  E.ID=EO.EventID " + country + state, types, data);
                            }
                        }
                        else
                            ds = d.GetData("SELECT  DISTINCT EO.EventID, E.Header, E.Content, E.SponsorPresenter, EO.DateTimeStart FROM Events E, Event_Occurance EO WHERE EO.DateTimeStart >= GETDATE() AND  E.ID=EO.EventID " + country);
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:Footer.ascx.cs

示例15: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        //2/23/2010%2020%3A54%3A38
        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);
        }

        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);

        if ((Session["User"] == null && Session["UserName"] != null) ||
            (Session["UserName"] == null && Session["User"] != null))
        {
            Response.Redirect("login");
        }

        //if (!IsPostBack)
        //{
        try
        {
            if (!IsPostBack)
            {
                //TextWriter tw = new StreamWriter(Server.MapPath("~/js/TotalJS.js"), false);
                //string str = "function timedout(){var today=new Date();var month=today.getMonth()+1;" +
                //    "var day=today.getDate();var year=today.getFullYear();var hours=today." +
                //    "getHours();var mins=today.getMinutes();var seconds=today.getSeconds();" +
                //    "var todayDate=month+'/'+day+'/'+year+' '+hours+':'+mins+':'+seconds;" +
                //    "setCookie(\"TimeZone\",today.getTimezoneOffset(),1);setCookie(\"BrowserDate\"," +
                //        "todayDate,1);}function setCookie(c_name,value,expiredays){var exdate=new " +
                //        "Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=" +
                //        "c_name+\"=\"+escape(value)+((expiredays==null)?\"\":\";expires=\"+exdate" +
                //        ".toGMTString())}function getCookie(c_name){if(document.cookie.length>0)" +
                //        "{c_start=document.cookie.indexOf(c_name+\"=\");if(c_start!=-1){c_start" +
                //        "=c_start+c_name.length+1;c_end=document.cookie.indexOf(\";\",c_start);" +
                //                        "if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie." +
                //                        "substring(c_start,c_end))}}return\"\"}" +
                //        "function setWidth(randNum)" +
                //        "{" +
                //           " var theWidthDiv = document.getElementById('widthDiv'+randNum);" +
                //         "   var theWrapDiv = document.getElementById('WrapDiv'+randNum);" +
                //         "   theWrapDiv.style.width = theWidthDiv.childNodes[3].offsetWidth + 14 + 'px';" +
                //         "   var somtinhere = 0;" +
                //        "}" +
                //        "function setWidthGreen(randNum)" +
                //        "{" +
                //         "   var theWidthDiv = document.getElementById('widthDiv'+randNum);" +
                //         "   var theWrapDiv = document.getElementById('WrapDiv'+randNum);" +
                //         "   theWrapDiv.style.width = theWidthDiv.childNodes[3].offsetWidth + 16 + 'px';" +
                //         "   var somtinhere = 0;" +
                //        "}" +
                //        "function setWait(event)" +
                //        "{" +
                //            "var thisGuy = document.getElementById(event.target.id);" +
                //            "if(thisGuy != null && thisGuy != undefined)" +
                //           "     thisGuy.style.cursor = 'wait';" +
                //            "return true;" +
                //        "}";
                //// write a line of text to the file
                //tw.WriteLine(str);

                //// close the stream
                //tw.Close();

                bool isPageNew = bool.Parse(ConfigurationSettings.AppSettings["isPageNew"].ToString());
                if (!isPageNew)
                    ConfigurationSettings.AppSettings["isPageNew"] = "true";

                if (Session["User"] == null)
                {
                    dat.Execute("INSERT INTO IP_User_Traffic (IP, PageName, DateAndTime) " +
                        "VALUES ('" + dat.GetIP() + "', '" + Request.Url.AbsolutePath.ToLower() +
                        "', GETDATE())");
                }
                else
                {
                    dat.Execute("INSERT INTO IP_User_Traffic (IP, UserID, PageName, DateAndTime) " +
                        "VALUES ('" + dat.GetIP() + "', " + Session["User"].ToString() +
                        ",'" + Request.Url.AbsolutePath.ToLower() + "', GETDATE())");
                }
            }
        }
        catch (Exception ex)
        {

        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:95,代码来源:SecondMasterPage.master.cs


注:本文中的Data.GetIP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。