本文整理汇总了C#中Data.GetAllZipsInRadius方法的典型用法代码示例。如果您正苦于以下问题:C# Data.GetAllZipsInRadius方法的具体用法?C# Data.GetAllZipsInRadius怎么用?C# Data.GetAllZipsInRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.GetAllZipsInRadius方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostIt
//.........这里部分代码省略.........
{
appSeshCountry = CountryDropDown.SelectedValue;
cmd.Parameters.Add("@catCountry", SqlDbType.Int).Value = CountryDropDown.SelectedValue;
string state = "";
if (StateDropDownPanel.Visible)
{
if (StateDropDown.SelectedIndex != -1)
state = StateDropDown.SelectedItem.Text;
}
else
state = StateTextBox.THE_TEXT;
appSeshState = state;
if (state != "")
cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = state;
else
cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = DBNull.Value;
if (CityTextBox.Text.Trim() != "")
{
appSeshCity = CityTextBox.Text.Trim();
cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = CityTextBox.Text.Trim();
}
else
cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = DBNull.Value;
if (ZipTextBox.Text.Trim() != "")
{
appSeshZip = ZipTextBox.Text.Trim();
appSeshRadius = RadiusDropDown.SelectedValue;
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value =
dat.GetAllZipsInRadius(RadiusDropDown.SelectedValue, ZipTextBox.Text.Trim(), true);
}
else
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value = DBNull.Value;
if(CountryDropDown.SelectedValue == "223")
cmd.Parameters.Add("@radius", SqlDbType.Int).Value = RadiusDropDown.SelectedValue;
}
else
{
cmd.Parameters.Add("@catCountry", SqlDbType.Int).Value = DBNull.Value;
cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = DBNull.Value;
cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = DBNull.Value;
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value = DBNull.Value;
cmd.Parameters.Add("@radius", SqlDbType.Int).Value = DBNull.Value;
}
cmd.Parameters.Add("@displayAll", SqlDbType.Bit).Value = DisplayCheckList.Items[0].Selected;
//Media Categories: NONE: 0, Slider: 1.
bool isSlider = false;
if (PictureCheckList.Items.Count > 0)
isSlider = true;
cmd.ExecuteNonQuery();
cmd = new SqlCommand("SELECT @@IDENTITY AS ID", conn);
SqlDataAdapter da2 = new SqlDataAdapter(cmd);
DataSet ds3 = new DataSet();
da2.Fill(ds3);
string ID = ds3.Tables[0].Rows[0]["ID"].ToString();
if (isEdit)
{
示例2: Save
protected void Save(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data d = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
bool hasState = false;
if (StateDropDown.Visible && StateDropDown.SelectedValue != "-1")
hasState = true;
if (!StateDropDown.Visible && StateTextBox.THE_TEXT.Trim() != "")
hasState = true;
bool hasCity = false;
if (CityTextBox.THE_TEXT.Trim() != "")
hasCity = true;
if (hasState && hasCity)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
conn.Open();
string ID = Request.QueryString["ID"].Trim();
string radius = "";
if (RadiusPanel.Visible)
{
radius = ", Radius=" + RadiusDropDown.SelectedValue;
}
SqlCommand cmd = new SqlCommand("UPDATE UserPreferences SET " +
" [email protected], [email protected], [email protected], [email protected]" + radius +
" WHERE [email protected] ", conn);
cmd.Parameters.Add("@id", SqlDbType.Int).Value = ID;
cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = CityTextBox.THE_TEXT;
if (CatZipTextBox.THE_TEXT.Trim() != "")
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value = d.GetAllZipsInRadius(RadiusDropDown.SelectedValue,
CatZipTextBox.THE_TEXT.Trim(), true);
else
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value = DBNull.Value;
cmd.Parameters.Add("@catCountry", SqlDbType.Int).Value = CountryDropDown.SelectedValue;
Session["UserCountry"] = CountryDropDown.SelectedValue;
string state = "";
if (StateDropDownPanel.Visible)
state = StateDropDown.SelectedItem.Text;
else
state = StateTextBox.THE_TEXT;
cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = state;
Session["UserState"] = state;
Session["UserCity"] = CityTextBox;
Session["UserCity"] = CatZipTextBox.THE_TEXT.Trim();
cmd.ExecuteNonQuery();
conn.Close();
LocationPanel.Visible = false;
DonePanel.Visible = true;
}
else
{
MessageLabel.Text = "Please Include City and State.";
}
}
示例3: MakeItSo
//.........这里部分代码省略.........
+ "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 " +
" [email protected], [email protected], [email protected], [email protected]" +
radius +
" WHERE [email protected] ", conn);
cmd.Parameters.Add("@id", SqlDbType.Int).Value = ID;
cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = CityTextBox.THE_TEXT;
if (CatZipTextBox.THE_TEXT.Trim() != "")
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value =
dat.GetAllZipsInRadius(RadiusDropDown.SelectedValue,
CatZipTextBox.THE_TEXT.Trim(), true);
else
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value = DBNull.Value;
cmd.Parameters.Add("@catCountry", SqlDbType.Int).Value = CountryDropDown.SelectedValue;
Session["UserCountry"] = CountryDropDown.SelectedValue;
string state = "";
if (StateDropDownPanel.Visible)
state = StateDropDown.SelectedItem.Text;
else
state = StateTextBox.THE_TEXT;
cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = state;
Session["UserState"] = state;
Session["UserCity"] = CityTextBox;
Session["UserCity"] = CatZipTextBox.THE_TEXT.Trim();
cmd.ExecuteNonQuery();
conn.Close();
string groups = "User, Admin";
//FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, false);
FormsAuthenticationTicket authTicket =
new FormsAuthenticationTicket(1, ds.Tables[0].Rows[0]["User_ID"].ToString(),
DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")),
DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).AddMinutes(60),
false, groups);
// Now encrypt the ticket.
string encryptedTicket =
FormsAuthentication.Encrypt(authTicket);
示例4: Save
//.........这里部分代码省略.........
cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = DBNull.Value;
}
if (CountryDropDown.SelectedValue != "-1")
{
cmd.Parameters.Add("@catCountry", SqlDbType.Int).Value = CountryDropDown.SelectedValue;
Session["UserCountry"] = CountryDropDown.SelectedValue;
string state = "";
if (StateDropDownPanel.Visible)
state = StateDropDown.SelectedItem.Text;
else
state = StateTextBox.THE_TEXT;
if (state != "")
{
cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = state;
}
else
cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = DBNull.Value;
Session["UserState"] = state;
if (CityTextBox.THE_TEXT != "")
{
cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = CityTextBox.THE_TEXT.Trim();
}
else
cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = DBNull.Value;
Session["UserCity"] = CityTextBox.THE_TEXT.Trim();
if (CatZipTextBox.THE_TEXT.Trim() != "")
{
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value = d.GetAllZipsInRadius(RadiusDropDown.SelectedValue,
CatZipTextBox.THE_TEXT.Trim(), true);
}
else
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value = DBNull.Value;
Session["UserZip"] = CatZipTextBox.THE_TEXT.Trim();
Session["UserRadius"] = RadiusDropDown.SelectedValue;
if (CityTextBox.THE_TEXT.Trim() != usersPrevPrefs[0]["CatCity"].ToString() ||
state != usersPrevPrefs[0]["CatState"].ToString() ||
CountryDropDown.SelectedValue != usersPrevPrefs[0]["CatCountry"].ToString() ||
CatZipTextBox.THE_TEXT.Trim() != usersPrevPrefs[0]["CatZip"].ToString() ||
RadiusDropDown.SelectedValue != usersPrevPrefs[0]["Radius"].ToString())
{
resetAds = true;
}
}
else
{
cmd.Parameters.Add("@catCountry", SqlDbType.Int).Value = DBNull.Value;
cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = DBNull.Value;
cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = DBNull.Value;
cmd.Parameters.Add("@catZip", SqlDbType.NVarChar).Value = DBNull.Value;
}
cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = ZipTextBox.THE_TEXT;
cmd.Parameters.Add("@textprefs", SqlDbType.Int).Value = prefs;
cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = emailPrefs;
cmd.Parameters.Add("@id", SqlDbType.Int).Value = USER_ID;
cmd.ExecuteNonQuery();