本文整理汇总了C#中City.SetCityID方法的典型用法代码示例。如果您正苦于以下问题:C# City.SetCityID方法的具体用法?C# City.SetCityID怎么用?C# City.SetCityID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类City
的用法示例。
在下文中一共展示了City.SetCityID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ButtonSend_Click
protected void ButtonSend_Click(object sender, EventArgs e)
{
if (this.CheckBoxAgreement.Checked)
{
string ID = this.TextBoxID.Text;
string userName = this.TextBoxUserName.Text;
string pass = this.TextBoxPass.Text;
string passVerification = this.TextBoxPass2.Text;
string email = this.TextBoxEmail.Text;
string phone = this.DropDownList1.SelectedItem + this.TextBoxPhone.Text;
string city = this.DropDownListCities.Text;
string address = this.TextBoxAddress.Text;
int cityID = Convert.ToInt32(this.DropDownListCities.SelectedValue);
string fName = this.TextBoxFirstName.Text;
string lName = this.TextBoxLastName.Text;
City userCity = new City();
userCity.SetCityID(cityID);
userCity.SetCityName(city);
CityService cs = new CityService();
userCity.SetCenterID(cs.GetCenterIDByCityID(cityID));
OleDbConnection myCon = new OleDbConnection(Connect.getConnectionString());
OleDbCommand cmd = new OleDbCommand("SELECT * FROM Clients WHERE UserName='" + userName + "';", myCon);
myCon.Open();
if (cmd.ExecuteScalar() == null)
{
string sqlCommand = "INSERT INTO Clients (CityID,UserName,Pass,Phone,Email,Address,FirstName,LastName,ID,Activity) VALUES(" + cityID + ",'" + userName + "','" + pass + "','" + phone + "','" + email + "','" + address + "','" + fName + "','" + lName + "','"+ID+"','UnActive');";
cmd.CommandText = sqlCommand;
cmd.ExecuteNonQuery();
}
myCon.Close();
}
else
{
Response.Write("<script type=\"text/javascript\">alert('אנא אשר את תנאי האתר')</script>");
}
}