コード例 #1
0
        /// <summary>
        /// 组合新地址
        /// </summary>
        /// <param name="addressPath"></param>
        /// <param name="address"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public static string RenderAddress(string addressPath, string address, int level)
        {
            if (!string.IsNullOrWhiteSpace(addressPath))
            {
                string   fullName = RegionApplication.GetRegionName(addressPath);
                string[] arr      = fullName.Split(',');//省,市,区,街道
                if (arr.Length > 0)
                {
                    for (int i = 0; i < arr.Length; i++)
                    {
                        address = address.Replace(arr[i], "");//去掉原详细地址中的省市区街道。(为兼容旧门店数据)
                    }
                }

                if (level <= arr.Length)
                {
                    for (int i = 0; i < level; i++)
                    {
                        fullName = fullName.Replace(arr[i], "");
                    }
                    address = fullName + address;
                }
            }
            return(address.Replace(",", ""));
        }
コード例 #2
0
        /// <summary>
        /// 地址组合
        /// </summary>
        /// <param name="addressPath"></param>
        /// <returns></returns>
        public static string GetShopBranchsFullAddress(string addressPath)
        {
            string str = string.Empty;

            if (!string.IsNullOrEmpty(addressPath))
            {
                str = RegionApplication.GetRegionName(addressPath, ",");
            }
            return(str.Replace(",", ""));
        }