Ejemplo n.º 1
0
        protected override void CreateChildControls()
        {
            this.Controls.Clear();
            if (!this.dataLoaded)
            {
                if (!string.IsNullOrEmpty(this.Context.Request.Form["regionSelectorValue"]))
                {
                    this.currentRegionId = new int?(int.Parse(this.Context.Request.Form["regionSelectorValue"]));
                }
                this.dataLoaded = true;
            }
            if (this.currentRegionId.HasValue)
            {
                XmlNode region = RegionHelper.GetRegion(this.currentRegionId.Value);
                if (region != null)
                {
                    if (region.Name == "county")
                    {
                        this.countyId   = new int?(this.currentRegionId.Value);
                        this.cityId     = new int?(int.Parse(region.ParentNode.Attributes["id"].Value));
                        this.provinceId = new int?(int.Parse(region.ParentNode.ParentNode.Attributes["id"].Value));
                    }
                    else if (region.Name == "city")
                    {
                        this.cityId     = new int?(this.currentRegionId.Value);
                        this.provinceId = new int?(int.Parse(region.ParentNode.Attributes["id"].Value));
                    }
                    else if (region.Name == "province")
                    {
                        this.provinceId = new int?(this.currentRegionId.Value);
                    }
                }
            }
            this.ddlProvinces = this.CreateDropDownList("ddlRegions1", "-请选择省-");
            FillDropDownList(this.ddlProvinces, RegionHelper.GetAllProvinces(), this.provinceId);
            this.Controls.Add(CreateTag("<span>"));
            this.Controls.Add(this.ddlProvinces);
            this.Controls.Add(CreateTag("</span>"));
            this.ddlCitys = this.CreateDropDownList("ddlRegions2", "-请选择市-");
            if (this.provinceId.HasValue)
            {
                FillDropDownList(this.ddlCitys, RegionHelper.GetCitys(this.provinceId.Value), this.cityId);
            }


            this.Controls.Add(CreateTag("<span>"));
            this.Controls.Add(this.ddlCitys);
            this.Controls.Add(CreateTag("</span>"));
            if (this.CountyTitle != "0")
            {
                this.ddlCountys = this.CreateDropDownList("ddlRegions3", "-请选择区-");
                if (this.cityId.HasValue)
                {
                    FillDropDownList(this.ddlCountys, RegionHelper.GetCountys(this.cityId.Value), this.countyId);
                }
                this.Controls.Add(CreateTag("<span>"));
                this.Controls.Add(this.ddlCountys);
                this.Controls.Add(CreateTag("</span>"));
            }
        }
Ejemplo n.º 2
0
 protected override void CreateChildControls()
 {
     Controls.Clear();
     if (!dataLoaded)
     {
         if (!string.IsNullOrEmpty(Context.Request.Form["regionSelectorValue"]))
         {
             currentRegionId = new int?(int.Parse(Context.Request.Form["regionSelectorValue"]));
         }
         dataLoaded = true;
     }
     if (currentRegionId.HasValue)
     {
         XmlNode region = RegionHelper.GetRegion(currentRegionId.Value);
         if (region != null)
         {
             if (region.Name == "county")
             {
                 countyId   = new int?(currentRegionId.Value);
                 cityId     = new int?(int.Parse(region.ParentNode.Attributes["id"].Value));
                 provinceId = new int?(int.Parse(region.ParentNode.ParentNode.Attributes["id"].Value));
             }
             else if (region.Name == "city")
             {
                 cityId     = new int?(currentRegionId.Value);
                 provinceId = new int?(int.Parse(region.ParentNode.Attributes["id"].Value));
             }
             else if (region.Name == "province")
             {
                 provinceId = new int?(currentRegionId.Value);
             }
         }
     }
     Controls.Add(CreateTitleControl(ProvinceTitle));
     ddlProvinces = CreateDropDownList("ddlRegions1");
     FillDropDownList(ddlProvinces, RegionHelper.GetAllProvinces(), provinceId);
     Controls.Add(CreateTag("<span>"));
     Controls.Add(ddlProvinces);
     Controls.Add(CreateTag("</span>"));
     Controls.Add(CreateTitleControl(CityTitle));
     ddlCitys = CreateDropDownList("ddlRegions2");
     if (provinceId.HasValue)
     {
         FillDropDownList(ddlCitys, RegionHelper.GetCitys(provinceId.Value), cityId);
     }
     Controls.Add(CreateTag("<span>"));
     Controls.Add(ddlCitys);
     Controls.Add(CreateTag("</span>"));
     Controls.Add(CreateTitleControl(CountyTitle));
     ddlCountys = CreateDropDownList("ddlRegions3");
     if (cityId.HasValue)
     {
         FillDropDownList(ddlCountys, RegionHelper.GetCountys(cityId.Value), countyId);
     }
     Controls.Add(CreateTag("<span>"));
     Controls.Add(ddlCountys);
     Controls.Add(CreateTag("</span>"));
 }
Ejemplo n.º 3
0
        private List <RegionListItem> GetRegionDictionary()
        {
            List <RegionListItem> pItems = new List <RegionListItem>();

            Dictionary <int, string> provinces = RegionHelper.GetAllProvinces();

            RegionListItem province = null;

            foreach (var p in provinces)
            {
                province = new RegionListItem("PROVINCE", 1);

                province.Id       = p.Key;
                province.Name     = p.Value;
                province.ParentId = 0;

                Dictionary <int, string> cities = RegionHelper.GetCitys(province.Id);

                List <RegionListItem> cItems = new List <RegionListItem>();
                RegionListItem        city   = null;
                foreach (var c in cities)
                {
                    city = new RegionListItem("CITY", 2);

                    city.Id       = c.Key;
                    city.Name     = c.Value;
                    city.ParentId = province.Id;

                    Dictionary <int, string> districts = RegionHelper.GetCountys(city.Id);
                    List <RegionListItem>    dItems    = new List <RegionListItem>();
                    RegionListItem           district  = null;
                    foreach (var d in districts)
                    {
                        district = new RegionListItem("DISTRICT", 3);

                        district.Id       = d.Key;
                        district.Name     = d.Value;
                        district.ParentId = city.Id;

                        dItems.Add(district);
                    }

                    city.Children = dItems;

                    cItems.Add(city);
                }

                province.Children = cItems;

                pItems.Add(province);
            }

            return(pItems);
        }
Ejemplo n.º 4
0
        private static void GetRegions(HttpContext context)
        {
            Dictionary <int, string> citys;

            context.Response.ContentType = "application/json";
            int result = 0;

            int.TryParse(context.Request["parentId"], out result);
            if (result > 0)
            {
                XmlNode region = RegionHelper.GetRegion(result);
                if (region == null)
                {
                    context.Response.Write("{\"Status\":\"0\"}");
                    return;
                }
                if (region.Name.Equals("province"))
                {
                    citys = RegionHelper.GetCitys(result);
                }
                else
                {
                    citys = RegionHelper.GetCountys(result);
                }
            }
            else
            {
                citys = RegionHelper.GetAllProvinces();
            }
            if (citys.Count == 0)
            {
                context.Response.Write("{\"Status\":\"0\"}");
            }
            else
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("{");
                builder.Append("\"Status\":\"OK\",");
                builder.Append("\"Regions\":[");
                foreach (int num2 in citys.Keys)
                {
                    builder.Append("{");
                    builder.AppendFormat("\"RegionId\":\"{0}\",", num2.ToString(CultureInfo.InvariantCulture));
                    builder.AppendFormat("\"RegionName\":\"{0}\"", citys[num2]);
                    builder.Append("},");
                }
                builder.Remove(builder.Length - 1, 1);
                builder.Append("]}");
                citys.Clear();
                context.Response.Write(builder.ToString());
            }
        }
Ejemplo n.º 5
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);
     }
 }
Ejemplo n.º 6
0
        private static void GetRegions(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int num = 0;

            int.TryParse(context.Request["parentId"], out num);
            Dictionary <int, string> dictionary;

            if (num > 0)
            {
                XmlNode region = RegionHelper.GetRegion(num);
                if (region == null)
                {
                    context.Response.Write("{\"Status\":\"0\"}");
                    return;
                }
                if (region.Name.Equals("province"))
                {
                    dictionary = RegionHelper.GetCitys(num);
                }
                else
                {
                    dictionary = RegionHelper.GetCountys(num);
                }
            }
            else
            {
                dictionary = RegionHelper.GetAllProvinces();
            }
            if (dictionary.Count == 0)
            {
                context.Response.Write("{\"Status\":\"0\"}");
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("{");
            stringBuilder.Append("\"Status\":\"OK\",");
            stringBuilder.Append("\"Regions\":[");
            foreach (int current in dictionary.Keys)
            {
                stringBuilder.Append("{");
                stringBuilder.AppendFormat("\"RegionId\":\"{0}\",", current.ToString(CultureInfo.InvariantCulture));
                stringBuilder.AppendFormat("\"RegionName\":\"{0}\"", dictionary[current]);
                stringBuilder.Append("},");
            }
            stringBuilder.Remove(stringBuilder.Length - 1, 1);
            stringBuilder.Append("]}");
            dictionary.Clear();
            context.Response.Write(stringBuilder.ToString());
        }
Ejemplo n.º 7
0
        private static void GetRegions(HttpContext context)
        {
            Dictionary <int, string> citys;
            string fieldCode = "ProvinceId";

            context.Response.ContentType = "application/json";
            int result = 0;

            int.TryParse(context.Request["parentId"], out result);
            if (result > 0)//如果传回来的省份有值,则根据省份筛选
            {
                XmlNode region = RegionHelper.GetRegion(result);
                if (region == null)
                {
                    context.Response.Write("{\"Status\":\"0\"}");
                    return;
                }
                if (region.Name.Equals("province"))
                {
                    citys     = RegionHelper.GetCitys(result);
                    fieldCode = "CityId";
                }
                else
                {
                    citys     = RegionHelper.GetCountys(result);
                    fieldCode = "CountyId";
                }
            }
            else//如果没有传递值来,是初始化载入所有的省
            {
                citys = RegionHelper.GetAllProvinces();

                //如果开启了门店配送功能,则是根据支持的街道信息来过滤绑定省份信息
            }

            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.AutoShipping && System.Web.HttpContext.Current.Request.Path.IndexOf("/" + "admin" + "/") < 0)
            {
                //如果是后台,则不进行过滤,前端过滤.

                DataTable dtAll  = Hidistro.ControlPanel.Sales.SalesHelper.GetAllStreetRegionId();
                var       vcitys = citys.Where(x => dtAll.AsEnumerable().Select(a => a.Field <int>(fieldCode)).Any(a => x.Key.Equals(a)));

                if (vcitys.Count() == 0)
                {
                    context.Response.Write("{\"Status\":\"0\"}");
                }
                else
                {
                    StringBuilder builder = new StringBuilder();
                    builder.Append("{");
                    builder.Append("\"Status\":\"OK\",");
                    builder.Append("\"Regions\":[");

                    foreach (var q in vcitys)
                    {
                        builder.Append("{");
                        builder.AppendFormat("\"RegionId\":\"{0}\",", q.Key);
                        builder.AppendFormat("\"RegionName\":\"{0}\"", q.Value);
                        builder.Append("},");
                    }
                    builder.Remove(builder.Length - 1, 1);
                    builder.Append("]}");
                    citys.Clear();
                    context.Response.Write(builder.ToString());
                }
            }
            else
            {
                #region
                if (citys.Count == 0)
                {
                    context.Response.Write("{\"Status\":\"0\"}");
                }
                else
                {
                    StringBuilder builder = new StringBuilder();
                    builder.Append("{");
                    builder.Append("\"Status\":\"OK\",");
                    builder.Append("\"Regions\":[");

                    foreach (int num2 in citys.Keys)
                    {
                        builder.Append("{");
                        builder.AppendFormat("\"RegionId\":\"{0}\",", num2.ToString(CultureInfo.InvariantCulture));
                        builder.AppendFormat("\"RegionName\":\"{0}\"", citys[num2]);
                        builder.Append("},");
                    }
                    builder.Remove(builder.Length - 1, 1);
                    builder.Append("]}");
                    citys.Clear();
                    context.Response.Write(builder.ToString());
                }
                #endregion
            }
        }
Ejemplo n.º 8
0
        protected override void CreateChildControls()
        {
            this.Controls.Clear();
            if (!this.dataLoaded)
            {
                if (!string.IsNullOrEmpty(this.Context.Request.Form[IDPrev + "regionSelectorValue"]))
                {
                    this.currentRegionId = new int?(int.Parse(this.Context.Request.Form[IDPrev + "regionSelectorValue"]));
                }
                this.dataLoaded = true;
            }
            if (this.currentRegionId.HasValue)
            {
                XmlNode region = RegionHelper.GetRegion(this.currentRegionId.Value);
                if (region != null)
                {
                    if (region.Name == "county")
                    {
                        this.countyId   = new int?(this.currentRegionId.Value);
                        this.cityId     = new int?(int.Parse(region.ParentNode.Attributes["id"].Value));
                        this.provinceId = new int?(int.Parse(region.ParentNode.ParentNode.Attributes["id"].Value));
                    }
                    else if (region.Name == "city")
                    {
                        this.cityId     = new int?(this.currentRegionId.Value);
                        this.provinceId = new int?(int.Parse(region.ParentNode.Attributes["id"].Value));
                    }
                    else if (region.Name == "province")
                    {
                        this.provinceId = new int?(this.currentRegionId.Value);
                    }
                }
            }
            this.Controls.Add(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", RegionHelper.GetAllProvinces(), this.provinceId, 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);
            }
            this.FillHypLink(this.citySpan, "city", regions, this.cityId, out this.cityDiv);
            this.ddlCountys = this.CreateHypLink("area_top", "areaname", this.cityId, this.CountyTitle, this.CountyWidth, out this.areaSpan);
            Dictionary <int, string> countys = new Dictionary <int, string>();

            if (this.cityId.HasValue)
            {
                countys = RegionHelper.GetCountys(this.cityId.Value);
            }
            this.FillHypLink(this.areaSpan, "area", countys, this.countyId, out this.areaDiv);
            this.Controls.Add(this.ddlProvinces);
            this.Controls.Add(this.ddlCitys);
            this.Controls.Add(this.ddlCountys);
            this.Controls.Add(CreateTag("</div>"));
            this.Controls.Add(this.proviceDiv);
            this.Controls.Add(this.cityDiv);
            this.Controls.Add(this.areaDiv);
            this.Controls.Add(CreateTag("</div>"));
            if (!this.CustomerCss)
            {
                Literal       child   = new Literal();
                StringBuilder builder = new StringBuilder();
                builder.Append("<style type=\"text/css\">");
                builder.AppendLine(".dropdown_button {" + string.Format("background: url('{0}') no-repeat;", this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "Hidistro.UI.Common.Controls.images.combo_arrow.jpg")) + "}");
                builder.AppendLine(".dp_address a:hover .dropdown_button {" + string.Format("background: url('{0}') no-repeat;", this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "Hidistro.UI.Common.Controls.images.combo_arrow1.jpg")) + "}");
                builder.AppendLine("</style>");
                child.Text = builder.ToString();
                this.Controls.Add(child);
                WebControl control = new WebControl(HtmlTextWriterTag.Link);
                control.Attributes.Add("rel", "stylesheet");
                control.Attributes.Add("href", this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "Hidistro.UI.Common.Controls.css.region.css"));
                control.Attributes.Add("type", "text/css");
                control.Attributes.Add("media", "screen");
                control.ID = "regionStyle";
                //this.Controls.Add(control);
            }
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
        protected override void CreateChildControls()
        {
            this.Controls.Clear();
            if (!this.dataLoaded)
            {
                if (!string.IsNullOrEmpty(this.Context.Request.Form["regionSelectorValue"]))
                {
                    this.currentRegionId = new int?(int.Parse(this.Context.Request.Form["regionSelectorValue"]));
                }
                this.dataLoaded = true;
            }
            if (this.currentRegionId.HasValue)
            {
                XmlNode region = RegionHelper.GetRegion(this.currentRegionId.Value);
                if (region != null)
                {
                    if (region.Name == "county")
                    {
                        this.countyId   = new int?(this.currentRegionId.Value);
                        this.cityId     = new int?(int.Parse(region.ParentNode.Attributes["id"].Value));
                        this.provinceId = new int?(int.Parse(region.ParentNode.ParentNode.Attributes["id"].Value));
                    }
                    else
                    {
                        if (region.Name == "city")
                        {
                            this.cityId     = new int?(this.currentRegionId.Value);
                            this.provinceId = new int?(int.Parse(region.ParentNode.Attributes["id"].Value));
                        }
                        else
                        {
                            if (region.Name == "province")
                            {
                                this.provinceId = new int?(this.currentRegionId.Value);
                            }
                        }
                    }
                }
            }
            this.Controls.Add(RegionSelector.CreateTitleControl(this.ProvinceTitle));
            this.ddlProvinces = this.CreateDropDownList("ddlRegions1");
            RegionSelector.FillDropDownList(this.ddlProvinces, RegionHelper.GetAllProvinces(), this.provinceId);
            this.Controls.Add(RegionSelector.CreateTag("<span>"));
            this.Controls.Add(this.ddlProvinces);
            this.Controls.Add(RegionSelector.CreateTag("</span>"));
            this.Controls.Add(RegionSelector.CreateTitleControl(this.CityTitle));
            this.ddlCitys = this.CreateDropDownList("ddlRegions2");
            if (this.provinceId.HasValue)
            {
                RegionSelector.FillDropDownList(this.ddlCitys, RegionHelper.GetCitys(this.provinceId.Value), this.cityId);
            }
            this.Controls.Add(RegionSelector.CreateTag("<span>"));
            this.Controls.Add(this.ddlCitys);
            this.Controls.Add(RegionSelector.CreateTag("</span>"));

            Dictionary <int, string> dtCountys = new Dictionary <int, string>();

            if (this.cityId.HasValue)
            {
                dtCountys = RegionHelper.GetCountys(this.cityId.Value);
            }

            Label countyTitle = RegionSelector.CreateTitleControl(this.CountyTitle);

            if (dtCountys.Count <= 0)
            {
                countyTitle.Style.Add("display", "none");
            }
            else
            {
                countyTitle.Style.Add("display", "block");
            }
            this.Controls.Add(countyTitle);
            this.ddlCountys = this.CreateDropDownList("ddlRegions3");
            if (this.cityId.HasValue)
            {
                RegionSelector.FillDropDownList(this.ddlCountys, dtCountys, this.countyId);
            }

            if (dtCountys.Count <= 0)
            {
                this.ddlCountys.Style.Add("display", "none");
            }
            else
            {
                this.ddlCountys.Style.Add("display", "block");
            }
            this.Controls.Add(RegionSelector.CreateTag("<span>"));
            this.Controls.Add(this.ddlCountys);
            this.Controls.Add(RegionSelector.CreateTag("</span>"));
        }