예제 #1
0
        private void dataSupplier_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }
            Repeater repeater = e.Item.FindControl("dataListShoppingCrat") as Repeater;
            Label    label    = e.Item.FindControl("lblSupplierAmount") as Label;
            Label    label2   = e.Item.FindControl("lblFreight") as Label;

            if (repeater != null)
            {
                repeater.ItemDataBound += this.dataListShoppingCart_ItemDataBound;
                object       dataItem = e.Item.DataItem;
                Type         type     = dataItem.GetType();
                PropertyInfo property = type.GetProperty("SupplierId", typeof(int));
                int          sid      = int.Parse(property.GetValue(dataItem, null).ToString());
                List <ShoppingCartItemInfo> dataSource = (from i in this.ShoppingCart.LineItems
                                                          where i.SupplierId == sid
                                                          select i).ToList();
                decimal num = (from i in this.ShoppingCart.LineItems
                               where i.SupplierId == sid
                               select i.AdjustedPrice.F2ToString("f2").ToDecimal(0) * (decimal)i.Quantity).Sum();
                repeater.DataSource = dataSource;
                repeater.DataBind();
                label.Text = "¥" + num.F2ToString("f2");
                decimal num2 = ShoppingProcessor.CalcSupplierFreight(sid, 0, this.ShoppingCart);
                label2.Text     = "¥" + num2.F2ToString("f2") + ((sid == 0 && this.ShoppingCart.LineGifts.Count() > 0) ? "(含礼品)" : "");
                label2.CssClass = "spanFreight" + sid;
            }
        }
        private void dataSupplier_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }
            Repeater repeater = e.Item.FindControl("rptOrderProducts") as Repeater;

            repeater.ItemDataBound += this.rptOrderProducts_ItemDataBound;
            Label label  = e.Item.FindControl("lblSupplierAmount") as Label;
            Label label2 = e.Item.FindControl("lblFreight") as Label;
            Label label3 = e.Item.FindControl("lblSupplierName") as Label;
            HtmlGenericControl htmlGenericControl  = (HtmlGenericControl)e.Item.FindControl("divSupplier");
            HtmlGenericControl htmlGenericControl2 = (HtmlGenericControl)e.Item.FindControl("divFreightAndAmount");

            if (repeater != null)
            {
                int supplierId = 0;
                int.TryParse(DataBinder.Eval(e.Item.DataItem, "SupplierId").ToString(), out supplierId);
                label3.Text = DataBinder.Eval(e.Item.DataItem, "SupplierName").ToString();
                List <ShoppingCartItemInfo> list = (from i in this.ShoppingCart.LineItems
                                                    where i.SupplierId == supplierId
                                                    select i).ToList();
                decimal num = (from i in this.ShoppingCart.LineItems
                               where i.SupplierId == supplierId
                               select i.AdjustedPrice.F2ToString("f2").ToDecimal(0) * (decimal)i.Quantity).Sum();
                repeater.DataSource = list;
                repeater.DataBind();
                label.Text = "¥" + num.F2ToString("f2");
                decimal num2 = ShoppingProcessor.CalcSupplierFreight(supplierId, this.RegionId, this.ShoppingCart);
                label2.Text = "¥" + num2.F2ToString("f2") + ((supplierId == 0 && this.ShoppingCart.LineGifts.Count() > 0) ? "(含礼品)" : "");
                if (!HiContext.Current.SiteSettings.OpenSupplier)
                {
                    htmlGenericControl2.Visible = false;
                }
                if (HiContext.Current.SiteSettings.OpenMultStore && this.StoreId > 0)
                {
                    StoresInfo storeById = DepotHelper.GetStoreById(this.StoreId);
                    if (storeById != null)
                    {
                        label3.Text = storeById.StoreName;
                        htmlGenericControl.Attributes["class"] = "mtitle";
                    }
                }
                else if (HiContext.Current.SiteSettings.OpenSupplier && supplierId > 0 && list.Count > 0)
                {
                    label3.Text = list[0].SupplierName;
                    htmlGenericControl.Attributes["class"] = "stitle";
                }
                else
                {
                    label3.Text = "平台";
                    htmlGenericControl.Attributes["class"] = "ztitle";
                }
            }
            if (HiContext.Current.SiteSettings.OpenMultStore && this.StoreId > 0)
            {
                htmlGenericControl2.Visible = false;
            }
        }