Example #1
0
        public static string GetFullPath(int currentRegionId, bool isEndOnProvince = true)
        {
            Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(currentRegionId, true);
            if (region == null)
            {
                return(string.Empty);
            }
            int    regionId = region.RegionId;
            string text     = regionId.ToString();
            int    num      = 0;

            if (isEndOnProvince)
            {
                num = 1;
            }
            if (region.Depth > num)
            {
                Hidistro.Entities.Store.RegionInfo region2 = RegionHelper.GetRegion(region.ParentRegionId, true);
                while (region2 != null && region2.Depth >= num)
                {
                    regionId = region2.RegionId;
                    text     = regionId.ToString() + "," + text;
                    region2  = RegionHelper.GetRegion(region2.ParentRegionId, true);
                }
            }
            return(text);
        }
Example #2
0
        public static int GetCityId(int currentRegionId)
        {
            int result = 0;

            Hidistro.Entities.Store.RegionInfo region     = RegionHelper.GetRegion(currentRegionId, true);
            Hidistro.Entities.Store.RegionInfo regionInfo = null;
            if (region != null)
            {
                if (region.Depth == 4)
                {
                    regionInfo = RegionHelper.GetRegion(region.ParentRegionId, true);
                    if (regionInfo != null)
                    {
                        result = regionInfo.ParentRegionId;
                    }
                }
                if (region.Depth == 3)
                {
                    result = region.ParentRegionId;
                }
                else if (region.Depth == 2)
                {
                    result = currentRegionId;
                }
            }
            return(result);
        }
Example #3
0
        private void EditRegion(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int    regionId = 0;
            string text     = context.Request["RegionName"];

            if (!int.TryParse(context.Request["RegionId"], out regionId) || string.IsNullOrEmpty(text))
            {
                context.Response.Write("{\"Status\":\"0\"}");
            }
            else
            {
                Hidistro.Entities.Store.RegionInfo regionByRegionId = RegionHelper.GetRegionByRegionId(regionId);
                if (regionByRegionId == null)
                {
                    context.Response.Write("{\"Status\":\"-1\"}");
                }
                else if (RegionHelper.IsSameName(text, regionByRegionId.ParentRegionId, regionByRegionId.RegionId))
                {
                    context.Response.Write("{\"Status\":\"same\"}");
                }
                else
                {
                    bool flag = RegionHelper.UpdateRegionName(regionId, text);
                    context.Response.Write("{\"Status\":\"" + flag.ToString() + "\"}");
                }
            }
        }
Example #4
0
        public static int GetRegionId(string street, string country, string city, string province)
        {
            int regionId = RegionHelper.GetRegionId(country, city, province);

            if (regionId <= 0 || string.IsNullOrEmpty(street))
            {
                return(regionId);
            }
            IList <Hidistro.Entities.Store.RegionInfo> regionChildList = RegionHelper.GetRegionChildList(regionId, true);

            try
            {
                Hidistro.Entities.Store.RegionInfo regionInfo = RegionHelper.FindNodeByRegionName(regionChildList, street);
                return(regionInfo?.RegionId ?? 0);
            }
            catch (Exception ex)
            {
                IDictionary <string, string> dictionary = new Dictionary <string, string>();
                dictionary.Add("Province", province.ToNullString());
                dictionary.Add("city", city.ToNullString());
                dictionary.Add("county", country.ToNullString());
                dictionary.Add("street", country.ToNullString());
                Globals.WriteExceptionLog(ex, dictionary, "GetRegionId");
            }
            return(0);
        }
Example #5
0
 public static Dictionary <int, string> GetStreets(int countryId, bool containDel = true)
 {
     Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(countryId, true);
     if (region != null)
     {
         Dictionary <int, string> childList = RegionHelper.GetChildList(countryId, containDel);
         if (childList == null || childList.Count == 0)
         {
             IList <Hidistro.Entities.Store.RegionInfo> streetsOfCity = new RegionDao().GetStreetsOfCity(region.ParentRegionId, containDel);
             if (streetsOfCity == null || streetsOfCity.Count == 0)
             {
                 return(new Dictionary <int, string>());
             }
             IList <Hidistro.Entities.Store.RegionInfo> allRegions = RegionHelper.GetAllRegions();
             allRegions = allRegions.Concat(streetsOfCity).ToList();
             HiCache.Remove("FileCache-Regions");
             HiCache.Insert("FileCache-Regions", allRegions);
             streetsOfCity = ((!containDel) ? (from r in streetsOfCity
                                               where r.ParentRegionId == countryId && !r.IsDel
                                               select r).ToList() : (from r in streetsOfCity
                                                                     where r.ParentRegionId == countryId
                                                                     select r).ToList());
             childList = new Dictionary <int, string>();
             foreach (Hidistro.Entities.Store.RegionInfo item in streetsOfCity)
             {
                 childList.Add(item.RegionId, item.RegionName);
             }
             return(childList);
         }
         return(childList);
     }
     return(null);
 }
Example #6
0
        public static IList <Hidistro.Entities.Store.RegionInfo> GetRegionChildList(int parentRegionId, bool containDel = true)
        {
            Dictionary <int, string> dictionary = new Dictionary <int, string>();
            IList <Hidistro.Entities.Store.RegionInfo> allRegions = RegionHelper.GetAllRegions();
            IList <Hidistro.Entities.Store.RegionInfo> list       = (!containDel) ? (from a in allRegions
                                                                                     where a.ParentRegionId == parentRegionId && !a.IsDel
                                                                                     select a).ToList() : (from a in allRegions
                                                                                                           where a.ParentRegionId == parentRegionId
                                                                                                           select a).ToList();

            if (list == null || list.Count == 0)
            {
                Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(parentRegionId, containDel);
                if (region.Depth == 3)
                {
                    IList <Hidistro.Entities.Store.RegionInfo> streetsOfCity = new RegionDao().GetStreetsOfCity(region.ParentRegionId, containDel);
                    if (streetsOfCity == null || streetsOfCity.Count == 0)
                    {
                        return(list);
                    }
                    IList <Hidistro.Entities.Store.RegionInfo> allRegions2 = RegionHelper.GetAllRegions();
                    allRegions2 = allRegions2.Concat(streetsOfCity).ToList();
                    HiCache.Remove("FileCache-Regions");
                    HiCache.Insert("FileCache-Regions", allRegions2);
                    return((from r in streetsOfCity
                            where r.ParentRegionId == parentRegionId
                            select r).ToList());
                }
                return(list);
            }
            return(list);
        }
Example #7
0
        private static Hidistro.Entities.Store.RegionInfo FindNodeByRegionName(string regionName, int depth)
        {
            IList <Hidistro.Entities.Store.RegionInfo> allRegions = RegionHelper.GetAllRegions();

            Hidistro.Entities.Store.RegionInfo regionInfo = null;
            try
            {
                regionInfo = (from r in allRegions
                              where r.RegionName.StartsWith(regionName) && r.Depth == depth
                              select r).First();
            }
            catch
            {
            }
            if (regionInfo == null)
            {
                regionInfo = new RegionDao().GetRegionByRegionName(regionName, depth);
                if (regionInfo != null && regionInfo.Depth == 4)
                {
                    Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(regionInfo.ParentRegionId, true);
                    if (region != null)
                    {
                        IList <Hidistro.Entities.Store.RegionInfo> streetsOfCity = new RegionDao().GetStreetsOfCity(region.ParentRegionId, true);
                        if (streetsOfCity != null && streetsOfCity.Count > 0)
                        {
                            IList <Hidistro.Entities.Store.RegionInfo> allRegions2 = RegionHelper.GetAllRegions();
                            allRegions2 = allRegions2.Concat(streetsOfCity).ToList();
                            HiCache.Remove("FileCache-Regions");
                            HiCache.Insert("FileCache-Regions", allRegions2);
                        }
                    }
                }
            }
            return(regionInfo);
        }
Example #8
0
        public static int GetTopRegionId(int currentRegionId, bool isEndOnProvince = true)
        {
            Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(currentRegionId, true);
            if (region == null)
            {
                return(0);
            }
            int result = currentRegionId;
            int num    = 0;

            if (isEndOnProvince)
            {
                num = 1;
            }
            if (region.Depth > num)
            {
                Hidistro.Entities.Store.RegionInfo region2 = RegionHelper.GetRegion(region.ParentRegionId, true);
                while (region2 != null && region2.Depth >= num)
                {
                    result  = region2.RegionId;
                    region2 = RegionHelper.GetRegion(region2.ParentRegionId, true);
                }
            }
            return(result);
        }
Example #9
0
 private static void GetRegions(HttpContext context)
 {
     try
     {
         context.Response.ContentType = "application/json";
         int num = 0;
         int.TryParse(context.Request["parentId"], out num);
         int num2 = 1;
         IDictionary <int, string> dictionary;
         if (num == 0)
         {
             dictionary = RegionHelper.GetAllProvinces(false);
             num2       = 1;
         }
         else
         {
             Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(num, true);
             if (region == null)
             {
                 context.Response.Write("{\"Status\":\"0\"}");
                 goto end_IL_0001;
             }
             num2       = region.Depth + 1;
             dictionary = ((region.Depth != 1) ? ((region.Depth != 2) ? RegionHelper.GetStreets(num, false) : RegionHelper.GetCountys(num, false)) : RegionHelper.GetCitys(num, false));
             if (dictionary == null || dictionary.Count == 0)
             {
                 context.Response.Write("{\"Status\":\"0\"}");
                 goto end_IL_0001;
             }
         }
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append("{");
         stringBuilder.Append("\"Status\":\"OK\",");
         stringBuilder.Append("\"Regions\":[");
         foreach (int key in dictionary.Keys)
         {
             stringBuilder.Append("{");
             stringBuilder.AppendFormat("\"RegionId\":\"{0}\",", key.ToString(CultureInfo.InvariantCulture));
             stringBuilder.AppendFormat("\"RegionName\":\"{0}\"", dictionary[key]);
             stringBuilder.Append("},");
         }
         stringBuilder.Remove(stringBuilder.Length - 1, 1);
         stringBuilder.Append("]}");
         dictionary.Clear();
         context.Response.Write(stringBuilder.ToString());
         end_IL_0001 :;
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
     }
 }
Example #10
0
        public static bool AddRegion(Hidistro.Entities.Store.RegionInfo regionInfo)
        {
            int  num  = regionInfo.RegionId = new RegionDao().GetNewRegionId();
            bool flag = new RegionDao().Add(regionInfo, null) > 0;

            if (flag)
            {
                string fullPath = RegionHelper.GetFullPath(num, true);
                new RegionDao().UpdateFullRegionPath(num, fullPath);
                HiCache.Remove("FileCache-Regions");
            }
            return(flag);
        }
Example #11
0
 private static Hidistro.Entities.Store.RegionInfo FindNodeByRegionName(IList <Hidistro.Entities.Store.RegionInfo> regions, string regionName)
 {
     Hidistro.Entities.Store.RegionInfo result = null;
     try
     {
         result = (from r in regions
                   where r.RegionName == regionName
                   select r).First();
     }
     catch
     {
     }
     return(result);
 }
Example #12
0
 public static int GetRegionId(string county, string city, string province)
 {
     try
     {
         Hidistro.Entities.Store.RegionInfo regionInfo = RegionHelper.FindNodeByRegionName(province.Replace("市", ""), 1);
         if (regionInfo == null)
         {
             regionInfo = RegionHelper.FindNodeByRegionName(province + "省", 1);
         }
         if (regionInfo != null)
         {
             int regionId = regionInfo.RegionId;
             if (string.IsNullOrEmpty(city))
             {
                 return(regionId);
             }
             IList <Hidistro.Entities.Store.RegionInfo> regionChildList = RegionHelper.GetRegionChildList(regionId, true);
             regionInfo = RegionHelper.FindNodeByRegionName(regionChildList, city);
             if (regionInfo == null)
             {
                 regionInfo = RegionHelper.FindNodeByRegionName(regionChildList, city + "市");
             }
             if (regionInfo != null)
             {
                 if (string.IsNullOrEmpty(county))
                 {
                     return(regionId);
                 }
                 regionId = regionInfo.RegionId;
                 IList <Hidistro.Entities.Store.RegionInfo> regionChildList2 = RegionHelper.GetRegionChildList(regionId, true);
                 regionInfo = RegionHelper.FindNodeByRegionName(regionChildList2, county);
                 if (regionInfo != null)
                 {
                     regionId = regionInfo.RegionId;
                 }
             }
             return(regionId);
         }
     }
     catch (Exception ex)
     {
         IDictionary <string, string> dictionary = new Dictionary <string, string>();
         dictionary.Add("Province", province.ToNullString());
         dictionary.Add("city", city.ToNullString());
         dictionary.Add("county", county.ToNullString());
         Globals.WriteExceptionLog(ex, dictionary, "GetRegionId");
     }
     return(0);
 }
Example #13
0
        protected override void AttachChildControls()
        {
            this.countDownId = this.Page.Request.QueryString["countDownId"].ToInt(0);
            this.storeId     = this.Page.Request.QueryString["StoreId"].ToInt(0);
            CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(this.countDownId, this.storeId);

            if (countDownInfo == null)
            {
                this.ShowWapMessage("抢购信息不存在", "goHomeUrl");
            }
            MemberInfo user = HiContext.Current.User;

            if (user.UserId != 0 && user.IsReferral() && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            {
                string text = HttpContext.Current.Request.Url.ToString();
                text = ((text.IndexOf("?") <= -1) ? (text + "?ReferralUserId=" + HiContext.Current.UserId) : (text + "&ReferralUserId=" + HiContext.Current.UserId));
                this.Page.Response.Redirect(text);
            }
            else
            {
                string text2    = this.Page.Request["lat"].ToNullString();
                string text3    = this.Page.Request["lng"].ToNullString();
                string cityName = this.Page.Request["city"].ToNullString();
                string address  = this.Page.Request["address"].ToNullString();
                if (!string.IsNullOrEmpty(text2) && !string.IsNullOrEmpty(text3))
                {
                    Hidistro.Entities.Store.RegionInfo regionByCityAddress = RegionHelper.GetRegionByCityAddress(cityName, address);
                    if (regionByCityAddress != null)
                    {
                        int num = regionByCityAddress.RegionId;
                        if (regionByCityAddress.FullRegionPath.Split(',').Length >= 2)
                        {
                            num = regionByCityAddress.FullRegionPath.Split(',')[1].ToInt(0);
                        }
                        WebHelper.SetCookie("UserCoordinateCookie", "CityRegionId", num.ToNullString(), null);
                        WebHelper.SetCookie("UserCoordinateCookie", "RegionId", regionByCityAddress.RegionId.ToNullString(), null);
                        WebHelper.SetCookie("UserCoordinateCookie", "FullRegionPath", regionByCityAddress.FullRegionPath, null);
                    }
                    WebHelper.SetCookie("UserCoordinateCookie", "NewCoordinate", $"{text2},{text3}", null);
                }
                this.FindControls();
                this.SetControlsValue(countDownInfo);
                PageTitle.AddSiteNameTitle("限时抢购商品详情");
            }
        }
Example #14
0
        private void GetRegionInfo(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int num = 0;

            int.TryParse(context.Request["regionId"], out num);
            if (num <= 0)
            {
                context.Response.Write("{\"Status\":\"0\"}");
            }
            else
            {
                Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(num, true);
                if (region == null)
                {
                    context.Response.Write("{\"Status\":\"0\"}");
                }
                else
                {
                    string fullRegion = RegionHelper.GetFullRegion(num, ",", true, 0);
                    int    depth      = region.Depth;
                    string str        = (depth > 1) ? RegionHelper.GetFullPath(num, true) : "";
                    string str2       = "";
                    if (region.Depth != 1)
                    {
                        str2 = region.ParentRegionId.ToString();
                    }
                    string str3 = "{";
                    str3 += "\"Status\":\"OK\",";
                    str3  = str3 + "\"RegionId\":\"" + num.ToString(CultureInfo.InvariantCulture) + "\",";
                    str3  = str3 + "\"RegionName\":\"" + fullRegion + "\",";
                    str3  = str3 + "\"Depth\":\"" + depth.ToString(CultureInfo.InvariantCulture) + "\",";
                    str3  = str3 + "\"Path\":\"" + str + "\",";
                    str3  = str3 + "\"ParentId\":\"" + str2 + "\"";
                    str3 += "}";
                    context.Response.Write(str3);
                }
            }
        }
Example #15
0
        private void AddRegion(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string szJson = context.Request["DataJson"];

            Hidistro.Entities.Store.RegionInfo regionInfo = JsonHelper.ParseFormJson <Hidistro.Entities.Store.RegionInfo>(szJson);
            int num2;

            if (!string.IsNullOrEmpty(regionInfo.RegionName))
            {
                int num = regionInfo.ParentRegionId;
                if (!string.IsNullOrEmpty(num.ToString()))
                {
                    num = regionInfo.Depth;
                    if (!string.IsNullOrEmpty(num.ToString()))
                    {
                        num2 = (string.IsNullOrEmpty(regionInfo.FullRegionPath) ? 1 : 0);
                        goto IL_0071;
                    }
                }
            }
            num2 = 1;
            goto IL_0071;
IL_0071:
            if (num2 != 0)
            {
                context.Response.Write("{\"Status\":\"0\"}");
            }
            else if (RegionHelper.IsSameName(regionInfo.RegionName, regionInfo.ParentRegionId, 0))
            {
                context.Response.Write("{\"Status\":\"same\"}");
            }
            else
            {
                bool flag = RegionHelper.AddRegion(regionInfo);
                context.Response.Write("{\"Status\":\"" + flag.ToString() + "\"}");
            }
        }
Example #16
0
        public static Hidistro.Entities.Store.RegionInfo GetRegion(int regionId, bool containDel = true)
        {
            IList <Hidistro.Entities.Store.RegionInfo> allRegions = RegionHelper.GetAllRegions();

            Hidistro.Entities.Store.RegionInfo regionInfo = null;
            try
            {
                regionInfo = ((!containDel) ? (from r in allRegions
                                               where r.RegionId == regionId && !r.IsDel
                                               select r).First() : (from r in allRegions
                                                                    where r.RegionId == regionId
                                                                    select r).First());
            }
            catch
            {
            }
            if (regionInfo == null)
            {
                regionInfo = new RegionDao().Get <Hidistro.Entities.Store.RegionInfo>(regionId);
                if (regionInfo != null && regionInfo.Depth == 4)
                {
                    Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(regionInfo.ParentRegionId, true);
                    if (region != null)
                    {
                        IList <Hidistro.Entities.Store.RegionInfo> streetsOfCity = new RegionDao().GetStreetsOfCity(region.ParentRegionId, containDel);
                        if (streetsOfCity != null && streetsOfCity.Count > 0)
                        {
                            IList <Hidistro.Entities.Store.RegionInfo> allRegions2 = RegionHelper.GetAllRegions();
                            allRegions2 = allRegions2.Concat(streetsOfCity).ToList();
                            HiCache.Remove("FileCache-Regions");
                            HiCache.Insert("FileCache-Regions", allRegions2);
                        }
                    }
                }
            }
            return(regionInfo);
        }
Example #17
0
        public static string GetFullRegion(int currentRegionId, string separator, bool isEndOnProvince = true, int endDpeth = 0)
        {
            Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(currentRegionId, true);
            if (region == null)
            {
                return(string.Empty);
            }
            if (isEndOnProvince)
            {
                endDpeth = 1;
            }
            string text = region.RegionName;

            if (region.Depth > endDpeth)
            {
                Hidistro.Entities.Store.RegionInfo region2 = RegionHelper.GetRegion(region.ParentRegionId, true);
                while (region2 != null && region2.Depth >= endDpeth)
                {
                    text    = region2.RegionName + separator + text;
                    region2 = RegionHelper.GetRegion(region2.ParentRegionId, true);
                }
            }
            return(text);
        }
Example #18
0
        private void GetCityByRegionName(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            bool   flag  = false;
            string text  = context.Request["city"];
            string text2 = context.Request["address"];

            if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2) || text2.IndexOf(text) == -1)
            {
                context.Response.Write("{\"Status\":\"0\"}");
            }
            else
            {
                string text3 = "";
                if (text2.IndexOf(text) > -1 && text2.IndexOf(text) + text.Length < text2.Length)
                {
                    text3 = text2.Substring(text2.IndexOf(text) + text.Length);
                    if (text3.IndexOf("区") > -1 || text3.IndexOf("县") > -1 || text3.IndexOf("市") > -1 || text3.IndexOf("街道") > -1 || text3.IndexOf("镇") > -1 || text3.IndexOf("村") > -1)
                    {
                        char[] anyOf = new char[5]
                        {
                            '区',
                            '县',
                            '市',
                            '镇',
                            '村'
                        };
                        int  num   = text3.LastIndexOfAny(anyOf);
                        bool flag2 = false;
                        if (num <= -1)
                        {
                            flag2 = true;
                            num   = text3.LastIndexOf("街道");
                        }
                        if (num > -1)
                        {
                            text3 = text3.Substring(0, num + ((!flag2) ? 1 : 2));
                        }
                    }
                }
                Hidistro.Entities.Store.RegionInfo regionInfo = RegionHelper.GetCityByRegionName(text, text3);
                if (regionInfo == null)
                {
                    int regionIdByRegionName = RegionHelper.GetRegionIdByRegionName(text, 2);
                    regionInfo = RegionHelper.GetRegionByRegionId(regionIdByRegionName);
                }
                else
                {
                    flag = true;
                }
                if (regionInfo != null)
                {
                    string fullRegion = RegionHelper.GetFullRegion(regionInfo.RegionId, " ", true, 0);
                    string text4      = text2.Substring(0, text2.IndexOf(regionInfo.RegionName) + regionInfo.RegionName.Length);
                    string str        = text2.Substring(text2.IndexOf(regionInfo.RegionName) + regionInfo.RegionName.Length);
                    string str2       = "{";
                    str2 += "\"Status\":\"OK\",";
                    str2  = str2 + "\"RegionId\":\"" + regionInfo.RegionId.ToString(CultureInfo.InvariantCulture) + "\",";
                    str2  = str2 + "\"County\":\"" + fullRegion + "\",";
                    str2  = str2 + "\"Address\":\"" + str + "\",";
                    str2  = str2 + "\"IsLocateArea\":\"" + flag.ToString() + "\"";
                    str2 += "}";
                    context.Response.Write(str2);
                }
                else
                {
                    string str3 = "{";
                    str3 += "\"Status\":\"OK\",";
                    str3  = str3 + "\"RegionId\":\"" + 0 + "\",";
                    str3  = str3 + "\"County\":\"" + text + "\",";
                    str3  = str3 + "\"Address\":\"" + text2 + "\",";
                    str3  = str3 + "\"IsLocateArea\":\"" + flag.ToString() + "\"";
                    str3 += "}";
                    context.Response.Write(str3);
                }
            }
        }
Example #19
0
        protected override void CreateChildControls()
        {
            this.Controls.Clear();
            if (!this.dataLoaded)
            {
                if (!string.IsNullOrEmpty(this.Context.Request.Form[RegionSelector.IDPrev + "regionSelectorValue"]))
                {
                    this.currentRegionId = int.Parse(this.Context.Request.Form[RegionSelector.IDPrev + "regionSelectorValue"]);
                }
                this.dataLoaded = true;
            }
            if (this.currentRegionId.HasValue)
            {
                Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(this.currentRegionId.Value, true);
                if (region != null)
                {
                    if (region.Depth == 4)
                    {
                        this.streetId   = this.currentRegionId;
                        this.countyId   = region.ParentRegionId;
                        this.cityId     = RegionHelper.GetCityId(region.ParentRegionId);
                        this.provinceId = RegionHelper.GetTopRegionId(region.ParentRegionId, true);
                    }
                    if (region.Depth == 3)
                    {
                        this.countyId   = this.currentRegionId.Value;
                        this.cityId     = region.ParentRegionId;
                        this.provinceId = RegionHelper.GetTopRegionId(region.ParentRegionId, true);
                    }
                    else if (region.Depth == 2)
                    {
                        this.cityId     = this.currentRegionId.Value;
                        this.provinceId = region.ParentRegionId;
                    }
                    else if (region.Depth == 1)
                    {
                        this.provinceId = this.currentRegionId.Value;
                    }
                }
            }
            this.Controls.Add(RegionSelector.CreateTag("<div class=\"address_wap\"><div class=\"dp_border\"></div><div class=\"dp_address\">"));
            this.ddlProvinces = this.CreateHypLink("province_top", "provincename", this.provinceId, this.ProvinceTitle, this.ProvinceWidth, out this.proviceSpan);
            this.FillHypLink(this.proviceSpan, "province", (Dictionary <int, string>)RegionHelper.GetAllProvinces(false), this.provinceId, (int?)0, out this.proviceDiv);
            this.ddlCitys = this.CreateHypLink("city_top", "cityname", this.cityId, this.CityTitle, this.CityWidth, out this.citySpan);
            Dictionary <int, string> regions = new Dictionary <int, string>();

            if (this.provinceId.HasValue)
            {
                regions = RegionHelper.GetCitys(this.provinceId.Value, false);
            }
            this.FillHypLink(this.citySpan, "city", regions, this.cityId, this.provinceId, out this.cityDiv);
            this.ddlCountys = this.CreateHypLink("area_top", "areaname", this.countyId, this.CountyTitle, this.CountyWidth, out this.areaSpan);
            Dictionary <int, string> regions2 = new Dictionary <int, string>();

            if (this.cityId.HasValue)
            {
                regions2 = RegionHelper.GetCountys(this.cityId.Value, false);
            }
            this.FillHypLink(this.areaSpan, "area", regions2, this.countyId, this.cityId, out this.areaDiv);
            if (this.DisplayStreet)
            {
                this.ddlStreets = this.CreateHypLink("street_top", "streetname", this.streetId, this.StreetTitle, this.StreetWidth, out this.streetSpan);
                Dictionary <int, string> regions3 = new Dictionary <int, string>();
                if (this.countyId.HasValue)
                {
                    regions3 = RegionHelper.GetStreets(this.countyId.Value, false);
                }
                this.FillHypLink(this.streetSpan, "street", regions3, this.streetId, this.countyId, out this.streetDiv);
            }
            this.Controls.Add(this.ddlProvinces);
            this.Controls.Add(this.ddlCitys);
            this.Controls.Add(this.ddlCountys);
            if (this.DisplayStreet)
            {
                this.Controls.Add(this.ddlStreets);
            }
            this.Controls.Add(RegionSelector.CreateTag("</div>"));
            this.Controls.Add(this.proviceDiv);
            this.Controls.Add(this.cityDiv);
            this.Controls.Add(this.areaDiv);
            if (this.DisplayStreet)
            {
                this.Controls.Add(this.streetDiv);
            }
            this.Controls.Add(RegionSelector.CreateTag("</div>"));
            if (!this.CustomerCss)
            {
                Literal       literal       = new Literal();
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("<style type=\"text/css\">");
                stringBuilder.AppendLine(".dropdown_button {" + string.Format("background: url('{0}') no-repeat;", "/Admin/images/combo_arrow.jpg") + "}");
                stringBuilder.AppendLine(".dp_address a:hover .dropdown_button {" + string.Format("background: url('{0}') no-repeat;", "/Admin/images/combo_arrow1.jpg") + "}");
                stringBuilder.AppendLine("</style>");
                literal.Text = stringBuilder.ToString();
                this.Controls.Add(literal);
                WebControl webControl = new WebControl(HtmlTextWriterTag.Link);
                webControl.Attributes.Add("rel", "stylesheet");
                webControl.Attributes.Add("href", "/Admin/css/region.css");
                webControl.Attributes.Add("type", "text/css");
                webControl.Attributes.Add("media", "screen");
                webControl.ID = "regionStyle";
                this.Controls.Add(webControl);
            }
        }