private void FillHypLink(WebControl spanContrel, string type, Dictionary <int, string> regions, int?selectedId, int?parentId, out WebControl divContrel) { divContrel = new WebControl(HtmlTextWriterTag.Div); divContrel.Attributes.Add("class", "ap_content ap_" + type + " dp_address"); divContrel.Attributes.Add("id", RegionSelector.IDPrev + type + "_floor"); divContrel.Controls.Add(RegionSelector.CreateTag("<div class=\"dp_address_list " + type + " clearfix\" id=\"" + RegionSelector.IDPrev + type + "_info\"> <ul id=\"" + RegionSelector.IDPrev + type + "_select\">")); foreach (int key in regions.Keys) { if (selectedId.HasValue && key == selectedId.Value) { spanContrel.Controls.RemoveAt(0); spanContrel.Controls.AddAt(0, RegionSelector.CreateTag(regions[key])); } divContrel.Controls.Add(RegionSelector.CreateTag("<li><a href=\"javascript:;\" id=\"select_new_" + RegionSelector.IDPrev + type + "_" + key + "\">" + regions[key] + "</a></li>")); } if (this.IsShowClear) { if (parentId.HasValue) { divContrel.Controls.Add(RegionSelector.CreateTag("<li><a href=\"javascript:;\" t=\"clear\" id=\"select_new_" + RegionSelector.IDPrev + type + "_" + parentId + "\">[清空]</a></li>")); } else { divContrel.Controls.Add(RegionSelector.CreateTag("<li><a href=\"javascript:;\" t=\"clear\" id=\"select_new_" + RegionSelector.IDPrev + type + "_clear\" >[清空]</a></li>")); } } divContrel.Controls.Add(RegionSelector.CreateTag("</ul></div>")); }
protected override void AttachChildControls() { this.txtShipTo = (TextBox) this.FindControl("txtShipTo"); this.txtAddress = (TextBox) this.FindControl("txtAddress"); this.txtZipcode = (TextBox) this.FindControl("txtZipcode"); this.txtTelPhone = (TextBox) this.FindControl("txtTelPhone"); this.txtCellPhone = (TextBox) this.FindControl("txtCellPhone"); this.dropRegionsSelect = (RegionSelector) this.FindControl("dropRegions"); this.btnAddAddress = ButtonManager.Create(this.FindControl("btnAddAddress")); this.btnCancel = ButtonManager.Create(this.FindControl("btnCancel")); this.btnEditAddress = ButtonManager.Create(this.FindControl("btnEditAddress")); this.dtlstRegionsSelect = (Common_Address_AddressList) this.FindControl("list_Common_Consignee_ConsigneeList"); this.lblAddressCount = (Literal) this.FindControl("lblAddressCount"); this.btnAddAddress.Click += new EventHandler(this.btnAddAddress_Click); this.btnEditAddress.Click += new EventHandler(this.btnEditAddress_Click); this.btnCancel.Click += new EventHandler(this.btnCancel_Click); this.dtlstRegionsSelect.ItemCommand += new Common_Address_AddressList.CommandEventHandler(this.dtlstRegionsSelect_ItemCommand); PageTitle.AddSiteNameTitle("我的收货地址", HiContext.Current.Context); if (!this.Page.IsPostBack) { this.lblAddressCount.Text = HiContext.Current.Config.ShippingAddressQuantity.ToString(); this.dropRegionsSelect.DataBind(); this.Reset(); this.btnEditAddress.Visible = false; this.BindList(); } }
protected override void AttachChildControls() { this.txtRealName = (TextBox) this.FindControl("txtRealName"); this.txtEmail = (TextBox) this.FindControl("txtEmail"); this.dropRegionsSelect = (RegionSelector) this.FindControl("dropRegions"); this.gender = (GenderRadioButtonList) this.FindControl("gender"); this.calendDate = (WebCalendar) this.FindControl("calendDate"); this.txtAddress = (TextBox) this.FindControl("txtAddress"); this.txtQQ = (TextBox) this.FindControl("txtQQ"); this.txtMSN = (TextBox) this.FindControl("txtMSN"); this.txtTel = (TextBox) this.FindControl("txtTel"); this.txtHandSet = (TextBox) this.FindControl("txtHandSet"); this.btnOK1 = ButtonManager.Create(this.FindControl("btnOK1")); this.Statuses = (SmallStatusMessage) this.FindControl("Statuses"); this.btnOK1.Click += new EventHandler(this.btnOK1_Click); PageTitle.AddSiteNameTitle("个人信息", HiContext.Current.Context); if (!this.Page.IsPostBack) { Member user = HiContext.Current.User as Member; if (user != null) { this.BindData(user); } } }
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", "-请选择省-"); 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.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>")); this.ddlCountys = this.CreateDropDownList("ddlRegions3", "-请选择区-"); if (this.cityId.HasValue) { RegionSelector.FillDropDownList(this.ddlCountys, RegionHelper.GetCountys(this.cityId.Value), this.countyId); } this.Controls.Add(RegionSelector.CreateTag("<span>")); this.Controls.Add(this.ddlCountys); this.Controls.Add(RegionSelector.CreateTag("</span>")); }
private static void FillDropDownList(WebControl ddlRegions, Dictionary <int, string> regions, int?selectedId) { foreach (int current in regions.Keys) { WebControl webControl = RegionSelector.CreateOption(current.ToString(CultureInfo.InvariantCulture), regions[current]); if (selectedId.HasValue && current == selectedId.Value) { webControl.Attributes.Add("selected", "true"); } ddlRegions.Controls.Add(webControl); } }
private WebControl CreateHypLink(string controlId, string spanId, int?selectedId, string showname, int width, out WebControl webSpan) { WebControl webControl = new WebControl(HtmlTextWriterTag.A); webControl.Attributes.Add("id", RegionSelector.IDPrev + controlId); webControl.Attributes.Add("href", "javascript:"); webControl.Attributes.Add("class", "dropdown_box"); if (width > 0) { webControl.Attributes.Add("style", "width:" + width + "px"); } webSpan = new WebControl(HtmlTextWriterTag.Span); webSpan.Attributes.Add("id", RegionSelector.IDPrev + spanId); webSpan.Attributes.Add("class", "dropdown_selected"); webSpan.Controls.Add(RegionSelector.CreateTag(showname)); if (selectedId.HasValue) { webSpan.Attributes.Add("value", selectedId.Value.ToString()); } webControl.Controls.Add(webSpan); webControl.Controls.Add(RegionSelector.CreateTag("<span class=\"dropdown_button\"></span>")); return(webControl); }
protected override void AttachChildControls() { txtUserName = (TextBox)FindControl("txtUserName"); txtEmail = (TextBox)FindControl("txtEmail"); txtPassword = (TextBox)FindControl("txtPassword"); txtPasswordCompare = (TextBox)FindControl("txtPasswordCompare"); txtTransactionPassword = (TextBox)FindControl("txtTransactionPassword"); txtTransactionPasswordCompare = (TextBox)FindControl("txtTransactionPasswordCompare"); txtRealName = (TextBox)FindControl("txtRealName"); txtCompanyName = (TextBox)FindControl("txtCompanyName"); dropRegion = (RegionSelector)FindControl("dropRegion"); txtAddress = (TextBox)FindControl("txtAddress"); txtZipcode = (TextBox)FindControl("txtZipcode"); txtQQ = (TextBox)FindControl("txtQQ"); txtWangwang = (TextBox)FindControl("txtWangwang"); txtMSN = (TextBox)FindControl("txtMSN"); txtTelPhone = (TextBox)FindControl("txtTelPhone"); txtCellPhone = (TextBox)FindControl("txtCellPhone"); txtPasswordQuestion = (TextBox)FindControl("txtPasswordQuestion"); txtPasswordAnswer = (TextBox)FindControl("txtPasswordAnswer"); btnOK = (Button)FindControl("btnOK"); btnOK.Click += new EventHandler(btnOK_Click); }
protected override void AttachChildControls() { if (string.IsNullOrEmpty(this.Page.Request["UserId"]) || !int.TryParse(this.Page.Request.QueryString["UserId"], out this.userId)) { base.GotoResourceNotFound(); } this.txtTradeKey = (TextBox) this.FindControl("txtTradeKey"); this.txtTradeKey2 = (TextBox) this.FindControl("txtTradeKey2"); this.txtQuestion = (TextBox) this.FindControl("txtQuestion"); this.txtAnswer = (TextBox) this.FindControl("txtAnswer"); this.txtRealName = (TextBox) this.FindControl("txtRealName"); this.dropRegions = (RegionSelector) this.FindControl("dropRegions"); this.txtAddress = (TextBox) this.FindControl("txtAddress"); this.txtQQ = (TextBox) this.FindControl("txtQQ"); this.txtMSN = (TextBox) this.FindControl("txtMSN"); this.txtTel = (TextBox) this.FindControl("txtTel"); this.txtHandSet = (TextBox) this.FindControl("txtHandSet"); this.btnSaveUser = ButtonManager.Create(this.FindControl("btnSaveUser")); this.btnSaveUser.Click += new EventHandler(this.btnSaveUser_Click); if (!this.Page.IsPostBack) { this.dropRegions.DataBind(); } }
protected override void AttachChildControls() { radlAddress = (Common_ShippingAddressRadioButtonList)FindControl("Common_ShippingAddressesRadioButtonList"); dropRegions = (RegionSelector)FindControl("dropRegions"); txtShipTo = (TextBox)FindControl("txtShipTo"); txtAddress = (TextBox)FindControl("txtAddress"); txtZipcode = (TextBox)FindControl("txtZipcode"); txtCellPhone = (TextBox)FindControl("txtCellPhone"); txtTelPhone = (TextBox)FindControl("txtTelPhone"); orderOptionList = (Common_OrderOptionList)FindControl("Common_OrderOptions"); shippingModeList = (Common_ShippingModeList)FindControl("Common_ShippingModeList"); paymentModeList = (Common_PaymentModeList)FindControl("grd_Common_PaymentModeList"); inputPaymentModeId = (HtmlInputHidden)FindControl("inputPaymentModeId"); inputShippingModeId = (HtmlInputHidden)FindControl("inputShippingModeId"); hdbuytype = (HtmlInputHidden)FindControl("hdbuytype"); lblPaymentPrice = (PaymentPriceLabel)FindControl("lblPaymentPrice"); lblShippModePrice = (ShippingModePriceLabel)FindControl("lblShippModePrice"); cartProductList = (Common_SubmmintOrder_ProductList)FindControl("Common_SubmmintOrder_ProductList"); cartGiftList = (Common_SubmmintOrder_GiftList)FindControl("Common_SubmmintOrder_GiftList"); lblOrderOptionPrice = (OrderOptionPriceLabel)FindControl("lblOrderOptionPrice"); litProductAmount = (Literal)FindControl("litProductAmount"); litAllWeight = (WeightLabel)FindControl("litAllWeight"); litPoint = (PointTotalLabel)FindControl("litPoint"); lblOrderTotal = (OrderTotalPriceLabel)FindControl("lblOrderTotal"); lblCartTotalPrice = (CartTotalPriceLabel)FindControl("lblCartTotalPrice"); txtMessage = (TextBox)FindControl("txtMessage"); hlkFeeFreeName = (HyperLink)FindControl("hlkFeeFreeName"); lblServiceChargeFree = (ServiceChargeFreeNameLabel)FindControl("lblServiceChargeFree"); lblShipChargeFee = (ShipChargeFeeNameLabel)FindControl("lblShipChargeFee"); lblPackingChargeFree = (PackingChargeFreeNameLabel)FindControl("lblPackingChargeFree"); hlkDiscountName = (HyperLink)FindControl("hlkDiscountName"); litDiscountPrice = (Literal)FindControl("litDiscountPrice"); htmlCouponCode = (HtmlInputText)FindControl("htmlCouponCode"); CmbCoupCode = (HtmlSelect)FindControl("CmbCoupCode"); litCouponAmout = (CouponPriceLabel)FindControl("litCouponAmout"); btnCreateOrder = ButtonManager.Create(FindControl("btnCreateOrder")); btnCreateOrder.Click += new EventHandler(btnCreateOrder_Click); if (!Page.IsPostBack) { //绑定地址 BindUserAddress(); //绑定订单 orderOptionList.DataSource = ShoppingProcessor.GetUsableOrderLookupLists(); orderOptionList.DataBind(); //绑定配送方式 shippingModeList.DataSource = ShoppingProcessor.GetShippingModes(); shippingModeList.DataBind(); //绑定支付方式 ReBindPayment(); if (shoppingCart != null) { BindPromote(shoppingCart); BindShoppingCartInfo(shoppingCart); CmbCoupCode.DataTextField = "DisplayText"; CmbCoupCode.DataValueField = "ClaimCode"; CmbCoupCode.DataSource = ShoppingProcessor.GetCoupon(shoppingCart.GetTotal()); CmbCoupCode.DataBind(); ListItem item = new ListItem("", "0"); CmbCoupCode.Items.Insert(0, item); hdbuytype.Value = buytype; } } }
protected override void AttachChildControls() { this.dropRegions = (RegionSelector) this.FindControl("dropRegions"); PageTitle.AddSiteNameTitle("添加收货地址"); }
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); } }