本文整理汇总了C#中City.GetCityName方法的典型用法代码示例。如果您正苦于以下问题:C# City.GetCityName方法的具体用法?C# City.GetCityName怎么用?C# City.GetCityName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类City
的用法示例。
在下文中一共展示了City.GetCityName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ButtonSubmit_Click
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
//השגת הנתונים לגבי המשתמש
int clientID = Convert.ToInt32(Session["UserID"]);
Client orderingClient = new Client(clientID);
City collectingCity = new City(orderingClient.GetCityID());
string collectingCityName = collectingCity.GetCityName();
int collectingCityID = orderingClient.GetCityID();
string collectingAddress = orderingClient.GetAddress();
string date = DateTime.Now.ToShortDateString();
string item = this.TextBoxItemDescription.Text;
string itemWeight = this.TextBoxItemWeight.Text;
int destinationCityID = Convert.ToInt32(this.DropDownListDestinationCities.SelectedValue);
string destinationCityName = this.DropDownListDestinationCities.SelectedItem.ToString();
string destinationAddress = this.TextBoxAddress.Text;
string destinationDate = DateTime.Now.AddDays(30).ToShortDateString();
//חישוב המחיר
CityService cs=new CityService();
int collectingCenterID = collectingCity.GetCenterID();
int destinationCenterID = cs.GetCenterIDByCityID(destinationCityID);
int temp = destinationCenterID - collectingCenterID;
if (temp < 0)
temp *= -1;
temp += 1;
double price;
price= 5 * Math.Log(double.Parse(itemWeight)) + 10 + (temp * 10);
if (this.CheckBoxUrgent.Checked)
{
price += 10;
}
if (price < 20)
price = 20;
int roundedPrice = Convert.ToInt32(price);
try
{
string sqlCommand = "INSERT INTO Orders (CollectingCityID,CollectingCityName,CollectingAddress,OrderingDate,DestinationCityID,DestinationCityName,DestinationAddress,DestinationDate,Item,ItemWeight,WorkerID,ClientID,Price,Status) VALUES (" + collectingCityID + ",'" + collectingCityName + "','" + collectingAddress + "','" + date + "'," + destinationCityID + ",'" + destinationCityName + "','" + destinationAddress + "','" + destinationDate + "','" + item + "'," + itemWeight + ",0," + clientID + "," + roundedPrice + ",'New');";
OleDbConnection myCon = new OleDbConnection(Connect.getConnectionString());
OleDbCommand cmd = new OleDbCommand(sqlCommand, myCon);
myCon.Open();
cmd.ExecuteNonQuery();
myCon.Close();
Response.Redirect("HomePage.aspx");
}
catch (Exception ex)
{
throw ex;
}
}
示例2: ButtonSubmit_Click
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
int clientID = Convert.ToInt32(Session["UserID"]);
Client orderingClient = new Client(clientID);
City collectingCity = new City(orderingClient.GetCityID());
string collectingCityName = collectingCity.GetCityName();
int collectingCityID = orderingClient.GetCityID();
string collectingAddress = orderingClient.GetAddress();
string date = DateTime.Now.ToShortDateString();
string item = this.TextBoxItemDescription.Text;
string itemWeight = this.TextBoxItemWeight.Text;
int destinationCityID = Convert.ToInt32(this.DropDownListDestinationCities.SelectedValue);
string destinationCityName = this.DropDownListDestinationCities.SelectedItem.ToString();
string destinationAddress = this.TextBoxAddress.Text;
string destinationDate = DateTime.Now.AddDays(30).ToShortDateString();
int price = CalculatePrice(1);
try
{
string sqlCommand = "INSERT INTO Orders (CollectingCityID,CollectingCityName,CollectingAddress,OrderingDate,DestinationCityID,DestinationCityName,DestinationAddress,DestinationDate,Item,ItemWeight,WorkerID,ClientID,Price,Status) VALUES (" + collectingCityID + ",'" + collectingCityName + "','" + collectingAddress + "','" + date + "'," + destinationCityID + ",'" + destinationCityName + "','" + destinationAddress + "','" + destinationDate + "','" + item + "'," + itemWeight + ",0," + clientID + "," + price + ",'New');";
OleDbConnection myCon = new OleDbConnection(Connect.getConnectionString());
OleDbCommand cmd = new OleDbCommand(sqlCommand, myCon);
myCon.Open();
cmd.ExecuteNonQuery();
myCon.Close();
Response.Write("<script type=\"text/javascript\">alert('הזמנת המשלוח בוצעה בהצלחה')</script>");
}
catch (Exception ex)
{
throw ex;
}
}