コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <summary>
        /// 获取城市名称
        /// </summary>
        /// <param name="cityId">城市编号</param>
        /// <returns></returns>
        internal static string GetCityName(int cityId)
        {
            string cityName = string.Empty;

            if (cityId > 0)
            {
                BLL.SystemStructure.SysCity   bll  = new EyouSoft.BLL.SystemStructure.SysCity();
                Model.SystemStructure.SysCity item = bll.GetSysCityModel(cityId);
                if (item != null)
                {
                    cityName = item.CityName;
                }
            }
            return(cityName);
        }