⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shoppingcartui.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace PowerEasy.WebSite.Controls
{
    using PowerEasy.Common;
    using PowerEasy.Components;
    using PowerEasy.Enumerations;
    using PowerEasy.Model.Shop;
    using PowerEasy.Model.UserManage;
    using PowerEasy.Shop;
    using PowerEasy.UserManage;
    using PowerEasy.Web.UI;
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class ShoppingCartUI : BaseUserControl
    {
        protected int changePresentId;
        protected Label LblPrice;
        private string m_CartId;
        private decimal m_CouponMoney;
        private int m_DeliverType;
        private int m_IsPreview;
        private bool m_NeedInvoice;
        private int m_PaymentType;
        private bool m_UseCoupon;
        private UserInfo m_UserInfo;
        private string m_ZipCode;
        protected HtmlGenericControl Note;
        protected string presentExpInfomation;
        protected StringBuilder presentList;
        protected StringBuilder presentList2;
        protected string presentTableName;
        protected StringBuilder priceInfomation;
        protected Product product;
        protected Repeater RptPresentList;
        protected Repeater RptShoppingCart;
        protected decimal total;
        protected int totalExp;
        protected decimal totalMoney;
        protected int totalPoint;
        protected double weight;

        protected void Page_Load(object sender, EventArgs e)
        {
            this.product = new Product();
        }

        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!this.UseCoupon)
            {
                this.PresentId = base.Request.Form["RdbPresentId"];
            }
            string userName = string.Empty;
            IList<ShoppingCartInfo> list = ShoppingCart.GetList(0, 0x7fffffff, 4, this.m_CartId);
            if (this.m_IsPreview == 3)
            {
                foreach (ShoppingCartInfo info in list)
                {
                    userName = info.UserName;
                    break;
                }
            }
            else
            {
                userName = PEContext.Current.User.UserName;
            }
            if (!string.IsNullOrEmpty(userName))
            {
                this.m_UserInfo = Users.GetUsersByUserName(userName);
                UserPurviewInfo userPurview = this.m_UserInfo.UserPurview;
                this.ViewState["HaveWholesalePurview"] = userPurview.Enablepm;
            }
            else
            {
                this.ViewState["HaveWholesalePurview"] = false;
            }
            this.RptShoppingCart.DataSource = list;
            this.RptShoppingCart.DataBind();
            if (this.m_IsPreview == 0)
            {
                PresentProjectInfo presentProjectByTotalMoney = PresentProject.GetPresentProjectByTotalMoney(this.total);
                if (!presentProjectByTotalMoney.IsNull && presentProjectByTotalMoney.PresentContent.Contains("1"))
                {
                    this.RptPresentList.Visible = true;
                    this.Note.Visible = true;
                    this.LblPrice.Visible = true;
                    this.LblPrice.Text = presentProjectByTotalMoney.Price.ToString("0.00");
                    string[] strArray = presentProjectByTotalMoney.PresentId.Split(new char[] { ',' });
                    IList<PresentInfo> list2 = new List<PresentInfo>();
                    foreach (string str2 in strArray)
                    {
                        list2.Add(Present.GetPresentById(DataConverter.CLng(str2)));
                    }
                    this.RptPresentList.DataSource = list2;
                    this.RptPresentList.DataBind();
                }
            }
            else if (this.m_IsPreview == 1)
            {
                this.RptPresentList.Visible = false;
                this.Note.Visible = false;
                this.LblPrice.Visible = false;
            }
        }

        protected bool PresentExist(string cartId, int presentId)
        {
            foreach (ShoppingCartInfo info in ShoppingCart.GetInfoByCart(cartId, true))
            {
                if (info.ProductId == presentId)
                {
                    return true;
                }
            }
            return false;
        }

        protected void RptPresentList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.Item))
            {
                PresentInfo dataItem = (PresentInfo) e.Item.DataItem;
                ((Literal) e.Item.FindControl("LitChangePresentPriceMarket")).Text = dataItem.PriceMarket.ToString("0.00");
                ((Literal) e.Item.FindControl("LitChangePresentTruePrice")).Text = this.LblPrice.Text;
                ((Literal) e.Item.FindControl("LitChangePresentSubTotal")).Text = this.LblPrice.Text;
            }
        }

        protected void RptShoppingCart_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType != ListItemType.Item) && (e.Item.ItemType != ListItemType.AlternatingItem))
            {
                if (e.Item.ItemType == ListItemType.Footer)
                {
                    PresentProjectInfo presentProInfo = new PresentProjectInfo(true);
                    if (this.m_IsPreview != 3)
                    {
                        presentProInfo = PresentProject.GetPresentProjectByTotalMoney(this.total);
                        this.presentExpInfomation = this.ShowPresentExp(presentProInfo).ToString();
                    }
                    if (this.m_IsPreview == 1)
                    {
                        int presentId = DataConverter.CLng(this.PresentId);
                        PlaceHolder holder = (PlaceHolder) e.Item.FindControl("PlhPresentInfo");
                        holder.Visible = false;
                        if (((presentId > 0) && !presentProInfo.IsNull) && (presentProInfo.PresentContent.Contains("1") && (presentId > 0)))
                        {
                            holder.Visible = true;
                            AbstractItemInfo info5 = new ConcretePresentProject(presentId, presentProInfo);
                            info5.GetItemInfo();
                            Label label = (Label) e.Item.FindControl("LblProductName");
                            Label label2 = (Label) e.Item.FindControl("LblUnit");
                            Label label3 = (Label) e.Item.FindControl("LblPresentPriceMarket");
                            Label label4 = (Label) e.Item.FindControl("LblPresentPrice");
                            Label label5 = (Label) e.Item.FindControl("LblPresentPrice1");
                            label.Text = info5.ProductName;
                            label2.Text = info5.Unit;
                            label3.Text = info5.PriceMarket.ToString("0.00");
                            label4.Text = info5.Price.ToString("0.00");
                            label5.Text = info5.Price.ToString("0.00");
                            this.weight += info5.TotalWeight;
                            this.total += info5.Price;
                        }
                        ((PlaceHolder) e.Item.FindControl("PlhMoneyInfo")).Visible = true;
                        Label label6 = (Label) e.Item.FindControl("LblDeliverCharge");
                        Label label7 = (Label) e.Item.FindControl("LblTaxRate");
                        Label label8 = (Label) e.Item.FindControl("LblIncludeTax");
                        Label label9 = (Label) e.Item.FindControl("LblCoupon");
                        Label label10 = (Label) e.Item.FindControl("LblTotalMoney");
                        Label label11 = (Label) e.Item.FindControl("LblTrueTotalMoney");
                        PackageInfo packageByGoodsWeight = Package.GetPackageByGoodsWeight(this.weight);
                        if (!packageByGoodsWeight.IsNull)
                        {
                            this.weight += packageByGoodsWeight.PackageWeight;
                        }
                        decimal num4 = DeliverCharge.GetDeliverCharge(this.m_DeliverType, this.weight, this.m_ZipCode, this.total, this.m_NeedInvoice);
                        DeliverTypeInfo deliverTypeById = PowerEasy.Shop.DeliverType.GetDeliverTypeById(this.m_DeliverType);
                        label6.Text = num4.ToString("0.00");
                        label7.Text = deliverTypeById.TaxRate.ToString();
                        if ((deliverTypeById.IncludeTax == TaxRateType.IncludeTaxNoInvoiceFavourable) || (deliverTypeById.IncludeTax == TaxRateType.IncludeTaxNoInvoiceNoFavourable))
                        {
                            label8.Text = "是";
                        }
                        else
                        {
                            label8.Text = "否";
                        }
                        decimal num5 = this.total + num4;
                        if (this.m_CouponMoney > 0M)
                        {
                            label9.Visible = true;
                            decimal num6 = this.total - this.m_CouponMoney;
                            if (num6 < 0M)
                            {
                                num6 = 0M;
                            }
                            num5 = num6 + num4;
                            label9.Text = label9.Text + this.m_CouponMoney.ToString("0.00") + "元,商品实际价格为:" + num6.ToString("0.00") + "元 <br>";
                            label10.Text = num6.ToString("0.00") + "+" + num4.ToString("0.00") + "=" + num5.ToString("0.00") + "元";
                            label11.Text = num5.ToString("0.00");
                        }
                        else
                        {
                            label9.Visible = false;
                            label10.Text = this.total.ToString("0.00") + "+" + num4.ToString("0.00") + "=" + num5.ToString("0.00") + "元";
                            label11.Text = num5.ToString("0.00");
                        }
                        this.ViewState["TrueTotalMoney"] = num5;
                        return;
                    }
                    ((PlaceHolder) e.Item.FindControl("PlhMoneyInfo")).Visible = false;
                }
                return;
            }
            int productNum = 0;
            string str = "";
            string str2 = "";
            decimal subTotal = 0M;
            ShoppingCartInfo dataItem = (ShoppingCartInfo) e.Item.DataItem;
            if (dataItem == null)
            {
                return;
            }
            productNum = dataItem.Quantity;
            bool haveWholesalePurview = Convert.ToBoolean(this.ViewState["HaveWholesalePurview"]);
            str2 = ShoppingCart.GetSaleType(dataItem.ProductInfomation, productNum, haveWholesalePurview);
            str = ShoppingCart.GetProductType(dataItem.ProductInfomation, productNum, haveWholesalePurview);
            AbstractItemInfo info2 = new ConcreteProductInfo(productNum, dataItem.Property, dataItem.ProductInfomation, this.m_UserInfo, false, false, haveWholesalePurview);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -