Exemple #1
0
        public string GetRegionIdPath(long regionId)
        {
            string str;

            List <ProvinceMode> .Enumerator enumerator = GetRegions().ToList().GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ProvinceMode current = enumerator.Current;
                    if (current.Id != regionId)
                    {
                        List <CityMode> .Enumerator enumerator1 = current.City.ToList().GetEnumerator();
                        try
                        {
                            while (enumerator1.MoveNext())
                            {
                                CityMode cityMode = enumerator1.Current;
                                if (cityMode.Id != regionId)
                                {
                                    if (cityMode.County == null)
                                    {
                                        continue;
                                    }
                                    List <CountyMode> .Enumerator enumerator2 = cityMode.County.ToList().GetEnumerator();
                                    try
                                    {
                                        while (enumerator2.MoveNext())
                                        {
                                            CountyMode countyMode = enumerator2.Current;
                                            if (countyMode.Id != regionId)
                                            {
                                                continue;
                                            }
                                            string[] strArrays = new string[] { current.Id.ToString(), ",", cityMode.Id.ToString(), ",", countyMode.Id.ToString() };
                                            str = string.Concat(strArrays);
                                            return(str);
                                        }
                                    }
                                    finally
                                    {
                                        ((IDisposable)enumerator2).Dispose();
                                    }
                                }
                                else
                                {
                                    string str1 = current.Id.ToString();
                                    long   id   = cityMode.Id;
                                    str = string.Concat(str1, ",", id.ToString());
                                    return(str);
                                }
                            }
                        }
                        finally
                        {
                            ((IDisposable)enumerator1).Dispose();
                        }
                    }
                    else
                    {
                        str = current.Id.ToString();
                        return(str);
                    }
                }
                return(string.Empty);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(str);
        }
Exemple #2
0
        private string GetRegionName(long regionId)
        {
            string name;

            List <ProvinceMode> .Enumerator enumerator = GetRegions().ToList().GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ProvinceMode current = enumerator.Current;
                    if (current.Id != regionId)
                    {
                        List <CityMode> .Enumerator enumerator1 = current.City.ToList().GetEnumerator();
                        try
                        {
                            while (enumerator1.MoveNext())
                            {
                                CityMode cityMode = enumerator1.Current;
                                if (cityMode.Id != regionId)
                                {
                                    if (cityMode.County == null)
                                    {
                                        continue;
                                    }
                                    List <CountyMode> .Enumerator enumerator2 = cityMode.County.ToList().GetEnumerator();
                                    try
                                    {
                                        while (enumerator2.MoveNext())
                                        {
                                            CountyMode countyMode = enumerator2.Current;
                                            if (countyMode.Id != regionId)
                                            {
                                                continue;
                                            }
                                            name = countyMode.Name;
                                            return(name);
                                        }
                                    }
                                    finally
                                    {
                                        ((IDisposable)enumerator2).Dispose();
                                    }
                                }
                                else
                                {
                                    name = cityMode.Name;
                                    return(name);
                                }
                            }
                        }
                        finally
                        {
                            ((IDisposable)enumerator1).Dispose();
                        }
                    }
                    else
                    {
                        name = current.Name;
                        return(name);
                    }
                }
                return(string.Empty);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(name);
        }
Exemple #3
0
        public string GetRegionFullName(long regionId, string seperator = " ")
        {
            string name;

            List <ProvinceMode> .Enumerator enumerator = GetRegions().ToList().GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ProvinceMode current = enumerator.Current;
                    if (current.Id != regionId)
                    {
                        List <CityMode> .Enumerator enumerator1 = current.City.ToList().GetEnumerator();
                        try
                        {
                            while (enumerator1.MoveNext())
                            {
                                CityMode cityMode = enumerator1.Current;
                                if (cityMode.Id != regionId)
                                {
                                    if (cityMode.County == null)
                                    {
                                        continue;
                                    }
                                    List <CountyMode> .Enumerator enumerator2 = cityMode.County.ToList().GetEnumerator();
                                    try
                                    {
                                        while (enumerator2.MoveNext())
                                        {
                                            CountyMode countyMode = enumerator2.Current;
                                            if (countyMode.Id != regionId)
                                            {
                                                continue;
                                            }
                                            string[] strArrays = new string[] { current.Name, seperator, cityMode.Name, seperator, countyMode.Name };
                                            name = string.Concat(strArrays);
                                            return(name);
                                        }
                                    }
                                    finally
                                    {
                                        ((IDisposable)enumerator2).Dispose();
                                    }
                                }
                                else
                                {
                                    name = string.Concat(current.Name, seperator, cityMode.Name);
                                    return(name);
                                }
                            }
                        }
                        finally
                        {
                            ((IDisposable)enumerator1).Dispose();
                        }
                    }
                    else
                    {
                        name = current.Name;
                        return(name);
                    }
                }
                return(string.Empty);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(name);
        }