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


C# Data.GetDataWithParemeters方法代码示例

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


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

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        SignInButton.SERVER_CLICK += MakeItSo;
        HtmlLink lk = new HtmlLink();
        HtmlHead head = (HtmlHead)Page.Header;
        lk.Attributes.Add("rel", "canonical");
        lk.Href = "http://hippohappenings.com/ResetPassword.aspx";
        head.Controls.AddAt(0, lk);

        HtmlMeta hm = new HtmlMeta();
        hm.Name = "ROBOTS";
        hm.Content = "NOINDEX, FOLLOW";
        head.Controls.AddAt(0, hm);

        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", ":")));
        //Ads1.DATA_SET = dat.RetrieveAllAds(false);
        //Ads1.MAIN_AD_DATA_SET = dat.RetrieveAllAds(true);
        if (Request.QueryString["CODE"] == null || Request.QueryString["UserName"] == null)
        {
            Response.Redirect("home");
        }
        else
        {
            SqlDbType[] types = { SqlDbType.NVarChar };
            object[] parameters = { Request.QueryString["UserName"].ToString() };
            DataSet ds = dat.GetDataWithParemeters("SELECT * FROM Users WHERE [email protected]", types, parameters);

            bool isNot = false;
            if (ds.Tables.Count > 0)
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string code = ds.Tables[0].Rows[0]["PasswordReset"].ToString();
                    if (code != Request.QueryString["CODE"].ToString())
                        Response.Redirect("home");
                    else
                    {
                        UserLabel.Text = Request.QueryString["UserName"].ToString();
                    }
                }
                else
                    isNot = true;
            else
                isNot = true;

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

示例2: SendIt

    protected void SendIt(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);
        }
        if (EmailTextBox.Text != "")
        {
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
            SqlDbType [] types = {SqlDbType.NVarChar};
            EmailTextBox.Text = dat.stripHTML(EmailTextBox.Text.Trim());
            object[] parameters = { EmailTextBox.Text };
            DataSet ds = dat.GetDataWithParemeters("SELECT * FROM Users WHERE [email protected]", types, parameters);

            bool isNot = false;
            if (ds.Tables.Count > 0)
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Encryption encrypt = new Encryption();
                    Random r = new Random(0);
                    string code = encrypt.encrypt(ds.Tables[0].Rows[0]["UserName"].ToString() + r.Next().ToString());
                    dat.Execute("UPDATE Users SET PasswordReset='" + code + "' WHERE User_ID="+ds.Tables[0].Rows[0]["User_ID"].ToString());
                    string body = "You have requested to re-set your password with Hippo Happenings. <br/>" +
                        "Please visit <a href=\"http://HippoHappenings.com/ResetPassword.aspx?CODE=" + code + "&UserName=" +
                        ds.Tables[0].Rows[0]["UserName"].ToString() + "\">http://HippoHappenings.com/ResetPassword.aspx?CODE=" + code + "&UserName=" +
                        ds.Tables[0].Rows[0]["UserName"].ToString() + "</a> to do so.";
                    dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
                        ds.Tables[0].Rows[0]["Email"].ToString(), body, "Hippo Happenings Reset Password Request");
                    MessageLabel.Text = "An email with the instructions has been sent to your account.";
                }
                else
                    isNot = true;
            else
                isNot = true;

            if (isNot)
            {
                MessageLabel.Text = "There is no user associated with this email address. Please make sure you have typed it correctly.";
            }
        }
        else
        {
            MessageLabel.Text = "Please include the Email";
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:50,代码来源:PasswordAlert.aspx.cs

示例3: GetThoseVenues

    protected void GetThoseVenues()
    {
        try
        {
            HttpCookie cookie = Request.Cookies["BrowserDate"];
            Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

            TimeFrameDiv.InnerHtml = "Select Venue >";

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

            string state = "";
            if (VenueState.Visible)
                state = VenueState.SelectedItem.Text;
            else
                state = VenueStateTextBox.Text;

            SqlDbType[] types = { SqlDbType.NVarChar };
            object[] data = { state };
            DataSet ds = dat.GetDataWithParemeters("SELECT CASE WHEN SUBSTRING(Name, 1, 4) = 'The' THEN " +
                "SUBSTRING(Name, 5, LEN(Name)-4) ELSE Name END AS Name1, * FROM Venues WHERE Country=" +
                VenueCountry.SelectedValue + " AND [email protected] ORDER BY Name1 ASC", types, data);

            Session["LocationVenues"] = ds;

            fillVenues(ds);

        }
        catch (Exception ex)
        {
            MessagePanel.Visible = true;
            YourMessagesLabel.Text += ex.ToString();
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:35,代码来源:EnterGroupEvent.aspx.cs

示例4: 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

示例5: GetEvents


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

                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] ";
                    }
                }

                ds = dat.GetDataWithParemeters("SELECT DISTINCT TOP " + totalCount.ToString() + " " +
                "E.Header, E.Featured, EO.DateTimeStart AS StartTime, EO.DateTimeEnd AS EndTime, E.DaysFeatured, E.PostedOn, E.Content, EO.EventID, 'E' AS Type FROM Events E, Event_Occurance EO WHERE " +
                "E.LIVE='True' AND E.ID=EO.EventID " + country + state + city + timeframe + highestPrice +
                " ORDER BY E.Featured, E.PostedOn, EO.DateTimeStart", types, data);
            }

            //totalCount = totalCount - ds.Tables[0].Rows.Count;

            #endregion

            if (totalCount > 0)
            {
                #region Get Trips
                string theDate = "";
                subtraction = 0;
                startDate = "";
                endDate = "";

                string dayToday = itBeNow.Day.ToString();
                string monthTody = itBeNow.Month.ToString();
                string yearToday = itBeNow.Year.ToString();

                string dateToday = monthTody + "/" + dayToday + "/" + yearToday;

                string dayOfWeek = dat.getDayOfWeek(itBeNow.DayOfWeek);

                string timeNow = itBeNow.TimeOfDay.ToString();

                string dayStart = "";
                string dayEnd = "";
                string startMonth = "";
                string endMonth = "";
                string startYear = "";
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:Home.aspx.cs

示例6: Page_Load


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

                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] ";
                    }
                }

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

示例7: 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

示例8: Search

    //[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
    //public string SendIt(string friendID)
    //{
    //    Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
    //    try
    //    {
    //        SqlConnection conn = dat.GET_CONNECTED;
    //        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 = Session["UserName"].ToString() +" would like to extend a Hippo Happ friend invitation to you. You can find out about this user <a target=\"_blank\" class=\"AddLink\" href=\"Friend.aspx?ID="+Session["User"].ToString()+"\">here</a>. To accept this Hippo user as a friend, click on the link below.";
    //        cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "Hippo Happs Friend Request!";
    //        cmd.Parameters.Add("@toID", SqlDbType.Int).Value = friendID;
    //        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();
    //        return "stuff success";
    //    }
    //    catch (Exception ex)
    //    {
    //        return ex.ToString();
    //    }
    //}
    //protected void SendIt(object sender, EventArgs e)
    //{
    //    Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
    //    try
    //    {
    //        SqlConnection conn = dat.GET_CONNECTED;
    //        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 = Session["UserName"].ToString() +
    //            " would like to extend a Hippo Happ friend invitation to you. You can find out about this user <a target=\"_blank\" class=\"AddLink\" href=\"Friend.aspx?ID=" + Session["User"].ToString() + "\">here</a>. To accept this Hippo user as a friend, click on the link below.";
    //        cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = "Hippo Happs Friend Request!";
    //        cmd.Parameters.Add("@toID", SqlDbType.Int).Value = friendID;
    //        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();
    //    }
    //    catch (Exception ex)
    //    {
    //    }
    //}
    protected void Search(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));

        char[] delim = { ' ' };
        string[] tokens = SearchTextBox.Text.Split(delim);

        string query = "SELECT DISTINCT UserName, ProfilePicture, FirstName, LastName, User_ID FROM USERS WHERE User_ID <> " +
            Session["User"].ToString() + " AND ";
        SqlDbType[] types = new SqlDbType[tokens.Length];
        for (int i = 0; i < tokens.Length; i++)
        {
            types[i] = SqlDbType.NVarChar;
            if (i != 0)
                query += " OR ";
            query += " ( FirstName LIKE '%'[email protected]" + i.ToString() + "+'%' OR LastName LIKE '%'[email protected]" +
                i.ToString() + "+'%' OR UserName LIKE '%'[email protected]" + i.ToString() + "+'%' OR Email LIKE '%'[email protected]" + i.ToString() + "+'%' ) ";
        }

        DataSet ds = dat.GetDataWithParemeters(query, types, tokens);
        Session["SearchDS"] = ds;
        FillFriends(ds);
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:68,代码来源:AddFriendAlert.aspx.cs

示例9: 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

示例10: Page_Load


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

                    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] ";
                        }
                    }

                    ds = dat.GetDataWithParemeters("SELECT DISTINCT TOP 10 EO.DateTimeStart, E.Header, E.Content, EO.EventID FROM Events E, Event_Occurance EO WHERE E.LIVE='True' AND E.ID=EO.EventID " + country + state + city + " AND EO.DateTimeStart > '" + DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Date + "' ORDER BY EO.DateTimeStart", 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 = "";
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:67,代码来源:Home.aspx.cs


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