/// <summary> /// 根据城市编号返回城市名 如果是中国,则返回“省名-城市名”,否则返回国家名 /// </summary> protected string getCityName(object o, object countryId) { string str = string.Empty; int nationId = 0; Int32.TryParse(Convert.ToString(countryId), out nationId); if (nationId != 0) { if (nationId == 224) { if (!string.IsNullOrEmpty(Convert.ToString(o))) { //列表MODEL中没有城市名 EyouSoft.BLL.SystemStructure.SysCity BLL = new EyouSoft.BLL.SystemStructure.SysCity(); EyouSoft.Model.SystemStructure.SysCity Model = BLL.GetSysCityModel(Utils.GetInt(o.ToString())); if (null != Model) { str = string.IsNullOrEmpty(Model.ProvinceName)?"":Model.ProvinceName + "-" + Model.CityName; } } } else { //返回国家名 EyouSoft.BLL.SystemStructure.BSysCountry nationBLL = new EyouSoft.BLL.SystemStructure.BSysCountry(); EyouSoft.Model.SystemStructure.MSysCountry nationModel = nationBLL.GetCountry(nationId); if (null != nationModel) { str = string.Format("{0}({1})", nationModel.CName, nationModel.EnName); } } } return(str); }
/// <summary> /// 初始化国家 /// </summary> private void InitCountryList() { //this.ddlCountry.Items.Add(new ListItem("-请选择-", "-1")); ////string countryInfo = this.ddlCountry.SelectedItem.Value; //IList<EyouSoft.Model.TicketStructure.TicketNationInfo> list = EyouSoft.BLL.TicketStructure.TicketNationInfo.CreateInstance().GetList(""); //if (null != list && list.Count > 0) //{ // for (int i = 0; i < list.Count; i++) // { // ListItem liCountry = new ListItem(); // liCountry.Text = list[i].CountryCode + "--" + list[i].CountryName; // liCountry.Value = list[i].NationId.ToString(); // this.ddlCountry.Items.Add(liCountry); // } //} //this.ddlCountry.DataBind(); this.ddlCountry.Items.Add(new ListItem("-请选择-", "-1")); EyouSoft.BLL.SystemStructure.BSysCountry nationBLL = new EyouSoft.BLL.SystemStructure.BSysCountry(); IList <EyouSoft.Model.SystemStructure.MSysCountry> lst = nationBLL.GetCountryList(); if (null != lst && lst.Count > 0) { for (int i = 0; i < lst.Count; i++) { ListItem liCountry = new ListItem(); liCountry.Text = lst[i].CName + "--" + lst[i].EnName; liCountry.Value = lst[i].CountryId.ToString(); this.ddlCountry.Items.Add(liCountry); } this.ddlCountry.DataBind(); } }
protected void INitCountry() { string JsonCountryHtmlS = string.Empty; if (Utils.GetQueryStringValue("Method") == "actionC") { if (Utils.GetQueryStringValue("ID") != null && Utils.GetQueryStringValue("ID") != "") { JsonCountryHtmlS = "{\"CountryList\":["; IList <EyouSoft.Model.SystemStructure.MSysCountry> listCountry = new EyouSoft.BLL.SystemStructure.BSysCountry().GetCountryList((EyouSoft.Model.SystemStructure.Continent)Enum.Parse(typeof(EyouSoft.Model.SystemStructure.Continent), Utils.GetQueryStringValue("ID"))); if (listCountry != null && listCountry.Count > 0) { for (int j = 0; j < listCountry.Count; j++) { JsonCountryHtmlS += "{\"CountryID\":\"" + listCountry[j].CountryId + "\",\"CountryName\":\"" + listCountry[j].CName + "\"},"; } } } JsonCountryHtmlS += "]}"; Response.Clear(); Response.Write(JsonCountryHtmlS); Response.End(); } }