本文整理汇总了C#中Data.SetLocationForIP方法的典型用法代码示例。如果您正苦于以下问题:C# Data.SetLocationForIP方法的具体用法?C# Data.SetLocationForIP怎么用?C# Data.SetLocationForIP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.SetLocationForIP方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
//.........这里部分代码省略.........
conn.Open();
SqlCommand cmd = new SqlCommand(searchStr, conn);
if (SearchTextBox.THE_TEXT.Trim() != "")
{
tokens = SearchTextBox.THE_TEXT.Trim().Split(delim);
for (int i = 0; i < tokens.Length; i++)
{
cmd.Parameters.Add("@search" + i.ToString(), SqlDbType.NVarChar).Value = "%" + tokens[i] + "%";
}
}
if (!RadiusDropPanel.Visible)
{
cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = zipParameter;
}
if (state != "")
cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = stateParam;
if (city != "")
cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = "%" + cityParam + "%";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
conn.Close();
//ErrorLabel.Text = searchStr;
Session["SearchDS"] = ds;
Session["Searching"] = "Venues";
bool setZero = false;
if (ds.Tables.Count > 0)
if (ds.Tables[0].Rows.Count > 0)
{
//SearchElements2.VENUE_DS = ds;
//SearchElements2.DataBind2();
//int eventCount = ds.Tables[0].Rows.Count;
//if (dat.SearchCutOffNumber < eventCount)
//{
// SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(Search cut off at " + dat.SearchCutOffNumber.ToString() + ")</div></div>";
//}
//else
//{
// SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(" + ds.Tables[0].Rows.Count + " Records Found)</div></div>";
//}
}
else
{
setZero = true;
}
else
setZero = true;
Session["SearchResults"] = "Results " + resultsStr;
if (setZero)
{
//SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(0 Records Found)</div></div>";
//SortDropDown.Visible = false;
Session["SearchDS"] = null;
RadWindow RadWindow3 = Master.RAD_WINDOW_3;
RadWindow3.Left = 178;
RadWindow3.Width = 910;
RadWindow3.Height = 550;
RadWindow3.Top = 100;
RadWindow3.VisibleOnPageLoad = true;
}
else
{
//SortDropDown.Visible = true;
RadWindow RadWindow3 = Master.RAD_WINDOW_3;
RadWindow3.Left = 178;
RadWindow3.Width = 910;
RadWindow3.Height = 550;
RadWindow3.Top = 100;
RadWindow3.VisibleOnPageLoad = true;
}
//Label ResultsLabel = (Label)SearchPanel.Items[1].Items[0].FindControl("ResultsLabel");
//ResultsLabel.Text = "Results " + resultsStr;
//Save search location base on IP if user not logged in.
if (Session["User"] != null)
{
dat.SetLocationForIP(CountryDropDown.SelectedValue, cityParam, stateParam);
}
//SearchButton.PostBackUrl = "~/VenueSearch.aspx";
}
else
{
MessageLabel.Text = message;
//SearchPanel.Items[1].Expanded = false;
//SearchPanel.Items[0].Expanded = true;
}
}
示例2: Search
//.........这里部分代码省略.........
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
DataSet dsAll = ds;
//Search Group Events
if (GroupCheckBox.Checked)
{
cmd = new SqlCommand(groupSearchStr, conn);
if (Session["SetVenue"] == null)
{
if (!RadiusDropPanel.Visible)
{
cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = zipParameter;
}
for (int i = 0; i < tokens.Length; i++)
{
cmd.Parameters.Add("@search" + i.ToString(), SqlDbType.NVarChar).Value = "%" + tokens[i] + "%";
}
if (state != "")
cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = stateParam;
if (city != "")
cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = cityParam;
}
DataSet dsGroups = new DataSet();
da = new SqlDataAdapter(cmd);
da.Fill(dsGroups);
if (dsAll.Tables[0].Rows.Count == 0)
dsAll = dsGroups;
else
dsAll = MergeDS(ds, dsGroups);
}
Session["SearchDS"] = dsAll;
Session["Searching"] = "Events";
Session["SearchResults"] = "Results " + resultsStr;
conn.Close();
bool setZero = false;
if (dsAll.Tables.Count > 0)
if (dsAll.Tables[0].Rows.Count > 0)
{
}
else
{
setZero = true;
}
else
setZero = true;
//DropDownList SortDropDown = (DropDownList)SearchPanel.Items[1].Items[0].FindControl("SortDropDown");
if (setZero)
{
//SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(0 Records Found)</div></div>";
//SortDropDown.Visible = false;
Session["SearchDS"] = null;
RadWindow RadWindow3 = Master.RAD_WINDOW_3;
RadWindow3.Left = 178;
RadWindow3.Width = 910;
RadWindow3.Height = 550;
RadWindow3.Top = 100;
RadWindow3.VisibleOnPageLoad = true;
}
else
{
//SortDropDown.Visible = true;
RadWindow RadWindow3 = Master.RAD_WINDOW_3;
RadWindow3.Left = 178;
RadWindow3.Width = 910;
RadWindow3.Height = 550;
RadWindow3.Top = 100;
RadWindow3.VisibleOnPageLoad = true;
}
//ResultsLabel.Text = "Results "+resultsStr;
//Save search location base on IP if user not logged in.
if (Session["User"] != null)
{
dat.SetLocationForIP(CountryDropDown.SelectedValue, cityParam, stateParam);
}
}
else
{
MessageLabel.Text = message;
//SearchPanel.Items[1].Expanded = false;
//SearchPanel.Items[0].Expanded = true;
//SearchButton.PostBackUrl = "~/EventSearch.aspx#SearchTag";
}
}
catch (Exception ex)
{
MessageLabel.Text += ex.ToString();
}
}
示例3: DoSearch
//.........这里部分代码省略.........
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
if (conn.State != ConnectionState.Open)
conn.Open();
SqlCommand cmd = new SqlCommand(searchStr, conn);
for (int i = 0; i < tokens.Length; i++)
{
cmd.Parameters.Add("@search" + i.ToString(), SqlDbType.NVarChar).Value = "%" + tokens[i] + "%";
}
if (state != "")
cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = stateParam;
if (city != "")
cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = cityParam;
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
conn.Close();
Session["SearchResults"] = "Results " + resultsStr;
bool setZero = false;
Session["Searching"] = "Groups";
//SearchPanel.Items[0].Expanded = false;
//SearchPanel.Items[1].Expanded = true;
if (ds.Tables.Count > 0)
if (ds.Tables[0].Rows.Count > 0)
{
//SearchElements2.AD_DS = ds;
//SearchElements2.DataBind2();
Session["SearchDS"] = ds;
Session["SessionSearch"] = ds;
//int eventCount = ds.Tables[0].Rows.Count;
//if (dat.SearchCutOffNumber < eventCount)
//{
// SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(Search cut off at " + dat.SearchCutOffNumber.ToString() + ")</div></div>";
//}
//else
//{
// SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(" + ds.Tables[0].Rows.Count + " Records Found)</div></div>";
//}
}
else
{
setZero = true;
}
else
setZero = true;
if (setZero)
{
//SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(0 Records Found)</div></div>";
//SortDropDown.Visible = false;
Session["SearchDS"] = null;
RadWindow RadWindow3 = Master.RAD_WINDOW_3;
RadWindow3.Top = 10;
RadWindow3.Left = 765;
RadWindow3.Width = 480;
RadWindow3.Height = 620;
RadWindow3.VisibleOnPageLoad = true;
}
else
{
//SortDropDown.Visible = true;
RadWindow RadWindow3 = Master.RAD_WINDOW_3;
RadWindow3.Top = 10;
RadWindow3.Left = 765;
RadWindow3.Width = 480;
RadWindow3.Height = 620;
RadWindow3.VisibleOnPageLoad = true;
}
//Label ResultsLabel = (Label)SearchPanel.Items[1].Items[0].FindControl("ResultsLabel");
//ResultsLabel.Text = "Results " + resultsStr;
//Save search location base on IP if user not logged in.
if (Session["User"] == null)
{
dat.SetLocationForIP(CountryDropDown.SelectedValue, cityParam, stateParam);
}
}
else
{
MessageLabel.Text = message;
//SearchPanel.Items[1].Expanded = false;
//SearchPanel.Items[0].Expanded = true;
//SearchButton.PostBackUrl = "~/VenueSearch.aspx#SearchTag";
}
}
catch (Exception ex)
{
MessageLabel.Text = ex.ToString();
}
}
示例4: Search
//.........这里部分代码省略.........
//Page.Trace.Write("after construct dsAll");
Session["SearchDS"] = dsAll;
Session["Searching"] = "Events";
Session["SearchResults"] = "Results " + resultsStr;
ResultsLabel.Text = "Search results " + resultsStr;
conn.Close();
DataColumn dc = new DataColumn("DateTimeStart");
dsAll.Tables[0].Columns.Add(dc);
dc = new DataColumn("ReoccurrID");
dsAll.Tables[0].Columns.Add(dc);
DataView dv = new DataView(dsAll.Tables[0], "", "", DataViewRowState.CurrentRows);
DataView dvEvent;
bool doOverRow = false;
foreach (DataRowView rowster in dv)
{
if (rowster["Type"].ToString() == "E")
{
dvEvent = dat.GetDataDV("SELECT *, EO.ID AS ReoccurrID FROM Events E, " +
"Event_Occurance EO WHERE E.ID=EO.EventID AND E.ID=" + rowster["EID"].ToString() + " ORDER BY DateTimeStart ASC");
foreach (DataRowView row in dvEvent)
{
if (DateTime.Parse(row["DateTimeStart"].ToString()) >= DateTime.Now)
{
rowster["DateTimeStart"] = row["DateTimeStart"];
rowster["ReoccurrID"] = row["ReoccurrID"];
break;
}
}
if (rowster["DateTimeStart"] == null)
doOverRow = true;
else if (rowster["DateTimeStart"].ToString().Trim() == "")
doOverRow = true;
if (doOverRow)
{
rowster["DateTimeStart"] = dvEvent[dvEvent.Count - 1]["DateTimeStart"].ToString();
rowster["ReoccurrID"] = dvEvent[dvEvent.Count - 1]["ReoccurrID"].ToString();
}
}
}
//Page.Trace.Write("Search: before fill results");
bool setZero = false;
if (dsAll.Tables.Count > 0)
if (dsAll.Tables[0].Rows.Count > 0)
{
}
else
{
setZero = true;
}
else
setZero = true;
if (setZero)
{
//SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(0 Records Found)</div></div>";
//SortDropDown.Visible = false;
NumsLabel.Text = "0 Results Found";
Session["SearchDS"] = null;
NoResultsPanel.Visible = true;
MapPanel.Visible = false;
SortDropDown.Visible = false;
}
else
{
NumsLabel.Text = dv.Count + " Results Found";
NoResultsPanel.Visible = false;
Session["SearchDS"] = dsAll;
FillResults(dsAll);
MapPanel.Visible = true;
SortDropDown.Visible = true;
}
//Page.Trace.Write("Search: after fill results");
//ResultsLabel.Text = "Results "+resultsStr;
//Save search location base on IP if user not logged in.
if (Session["User"] != null)
{
dat.SetLocationForIP(CountryDropDown.SelectedValue, cityParam, stateParam);
}
}
else
{
MessageLabel.Text = message;
}
}
catch (Exception ex)
{
MessageLabel.Text += ex.ToString() + "<br/>" + message;
}
}
示例5: Search
//.........这里部分代码省略.........
}
string searchStr = "SELECT DISTINCT E.ID AS EID, '$'+CONVERT(NVARCHAR,E.MinPrice)+' - $'+CONVERT(NVARCHAR, E.MaxPrice)" +
"AS PriceRange, E.MinPrice AS Price, E.Means, dbo.GetDuration(E.Duration, 0) AS " +
"TimeFrame, dbo.GetDuration(E.Duration, 1) AS Duration, E.Header, " +
" E.Featured, E.DaysFeatured FROM TripDirections TDir, Trips E, TripMonths TM, TripDays TDS "
+ includeSearchTerms + " WHERE TDir.TripID=E.ID AND TM.TripID=TDS.TripID AND TM.TripID=E.ID AND E.Live='True' " +
country + state + city + zip + " AND " + date + duration + means + timeFrame +
allSearchTerms + highestP + categories + " ORDER BY E.Header";
//ErrorLabel.Text = searchStr;
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
if (conn.State != ConnectionState.Open)
conn.Open();
SqlCommand cmd = new SqlCommand(searchStr, conn);
if (!RadiusDropPanel.Visible)
{
cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = zipParameter;
}
for (int i = 0; i < tokens.Length; i++)
{
cmd.Parameters.Add("@search" + i.ToString(), SqlDbType.NVarChar).Value = "%" + tokens[i] + "%";
}
if (state != "")
cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = stateParam;
if (city != "")
cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = cityParam;
message = searchStr;
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
DataSet dsAll = ds;
Session["SearchDS"] = dsAll;
Session["Searching"] = "Trips";
Session["SearchResults"] = "Results " + resultsStr;
ResultsLabel.Text = "Search results " + resultsStr;
conn.Close();
DataView dv = new DataView(dsAll.Tables[0], "", "", DataViewRowState.CurrentRows);
DataView dvEvent;
bool setZero = false;
if (dsAll.Tables.Count > 0)
if (dsAll.Tables[0].Rows.Count > 0)
{
}
else
{
setZero = true;
}
else
setZero = true;
if (setZero)
{
//SearchPanel.Items[1].Text = "<div style='position: relative;'><span style='font-family: Arial; font-size: 20px; color: White;'>Search Results: </span><div style='position: absolute; right: 5px; top: 3px;'>(0 Records Found)</div></div>";
//SortDropDown.Visible = false;
NumsLabel.Text = "0 Results Found";
Session["SearchDS"] = null;
NoResultsPanel.Visible = true;
MapPanel.Visible = false;
SortDropDown.Visible = false;
}
else
{
NumsLabel.Text = dv.Count + " Results Found";
NoResultsPanel.Visible = false;
Session["SearchDS"] = dsAll;
FillResults(dsAll);
MapPanel.Visible = true;
SortDropDown.Visible = true;
}
//ResultsLabel.Text = "Results "+resultsStr;
//Save search location base on IP if user not logged in.
if (Session["User"] != null)
{
dat.SetLocationForIP(CountryDropDown.SelectedValue, cityParam, stateParam);
}
}
else
{
MessageLabel.Text = message;
}
}
else
{
DurationErrorLabel.Text = "Duration must be a number.";
}
}
catch (Exception ex)
{
MessageLabel.Text += ex.ToString() + "<br/>" + message;
}
}
示例6: Search
//.........这里部分代码省略.........
// }
// if (catHiTemp.Trim().Substring(0, 3).ToLower() == "and")
// catHiTemp = catHiTemp.Trim().Substring(3, catHiTemp.Trim().Length - 3);
// featureString = "AND (( " + catHiTemp + " ) OR " +
// "(E.Ad_ID=EST.AdID AND SearchDate = '" + featureDate + "' " + featureSearchTerms +
// "))";
// includeSearchTerms = ", AdSearchTerms EST";
// }
// else
// {
// featureString = catHiTemp;
// }
//}
string dateOfAds = DateTime.Now.AddDays(-30).ToShortDateString();
string searchStr = "SELECT DISTINCT TOP 200 E.Featured, E.Description, E.DatesOfAd, E.Ad_ID AS VID, E.Header " +
" FROM Ads E " + includeSearchTerms +
" WHERE E.DateAdded >= CONVERT(DATETIME, '" + dateOfAds +
"') AND E.Live='True' " + country + state + city + allSearchTerms + categories + " ORDER BY E.Header ";
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
if (conn.State != ConnectionState.Open)
conn.Open();
SqlCommand cmd = new SqlCommand(searchStr, conn);
if (KeywordsTextBox.Text.Trim() != "")
{
tokens = KeywordsTextBox.Text.Trim().Split(delim);
for (int i = 0; i < tokens.Length; i++)
{
cmd.Parameters.Add("@search" + i.ToString(), SqlDbType.NVarChar).Value = "%" + tokens[i] + "%";
}
}
//if (!RadiusDropPanel.Visible)
//{
// cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = zipParameter;
//}
if (state != "")
cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = stateParam;
if (city != "")
cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = "%" + cityParam + "%";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
conn.Close();
//ErrorLabel.Text = searchStr;
Session["SearchDS"] = ds;
Session["Searching"] = "Ads";
bool setZero = false;
if (ds.Tables.Count > 0)
if (ds.Tables[0].Rows.Count > 0)
{
}
else
{
setZero = true;
}
else
setZero = true;
Session["SearchResults"] = "Results " + resultsStr;
ResultsLabel.Text = "Search results " + resultsStr;
if (setZero)
{
NumsLabel.Text = "0 Results Found";
Session["SearchDS"] = null;
NoResultsPanel.Visible = true;
SortDropDown.Visible = false;
}
else
{
NumsLabel.Text = ds.Tables[0].Rows.Count.ToString() + " Results Found";
NoResultsPanel.Visible = false;
Session["SearchDS"] = ds;
FillResults(ds);
SortDropDown.Visible = true;
}
if (Session["User"] != null)
{
dat.SetLocationForIP(CountryDropDown.SelectedValue, cityParam, stateParam);
}
}
else
{
MessageLabel.Text = message;
}
}
catch (Exception ex)
{
ErrorLabel.Text += ex.ToString();
}
}