protected override void AttachChildControls() { if (!this.OnlyShowInDefault) { this.dropRegions = (RegionSelector)this.FindControl("dropRegions"); this.CurrentRegion = (Literal)this.FindControl("litCurrentRegion"); this.labProductFreight = (HtmlGenericControl)this.FindControl("labProductFreight"); int deliveryScopRegionId = HiContext.Current.DeliveryScopRegionId; if (deliveryScopRegionId != 0) { this.dropRegions.SetSelectedRegionId(deliveryScopRegionId); this.CurrentRegion.Text = RegionHelper.GetFullRegion(deliveryScopRegionId, " ", true, 0); } else { this.CurrentRegion.Text = "请选择配送区域"; } if (this.labProductFreight != null) { decimal num = ShoppingProcessor.CalcProductFreight(deliveryScopRegionId, this.ShippingTemplateId, this.Volume, this.Weight, 1, decimal.Zero); if (num > decimal.Zero) { this.labProductFreight.InnerHtml = "运费:<label>" + num.F2ToString("f2") + "</label>"; } else { this.labProductFreight.InnerHtml = "免运费"; } } } }
protected override void Render(HtmlTextWriter writer) { if (this.ShippingTemplateId > 0) { int deliveryScopRegionId = HiContext.Current.DeliveryScopRegionId; base.Text = ShoppingProcessor.CalcProductFreight(deliveryScopRegionId, this.ShippingTemplateId, this.Volume, this.Weight, 1, decimal.Zero).F2ToString("f2"); } else { base.Text = "0"; } base.Render(writer); }