예제 #1
0
파일: Member.cs 프로젝트: Abnertd/public
    //更新购物车信息
    public void Cart_Price_Update()
    {
        double Product_Price;
        int    normal_amount, Product_Coin;


        ProductInfo productinfo = null;
        PackageInfo packageinfo = null;
        QueryInfo   Query       = new QueryInfo();

        Query.PageSize    = 0;
        Query.CurrentPage = 1;
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "OrdersGoodsTmpInfo.Orders_Goods_SessionID", "=", Session.SessionID.ToString()));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "OrdersGoodsTmpInfo.Orders_Goods_ParentID", "=", "0"));
        IList <OrdersGoodsTmpInfo> goodstmps = MyCart.GetOrdersGoodsTmps(Query);

        if (goodstmps != null)
        {
            foreach (OrdersGoodsTmpInfo entity in goodstmps)
            {
                //正常购买商品
                if (entity.Orders_Goods_Type == 0)
                {
                    productinfo = MyProduct.GetProductByID(entity.Orders_Goods_Product_ID, pub.CreateUserPrivilege("ae7f5215-a21a-4af2-8d47-3cda2e1e2de8"));
                    if (productinfo != null)
                    {
                        Product_Price = pub.Get_Member_Price(productinfo.Product_ID, productinfo.Product_Price);
                        normal_amount = MyCart.Get_Orders_Goods_TypeAmount(Session.SessionID, productinfo.Product_ID, 0);

                        //检查是否团购
                        if (productinfo.Product_IsGroupBuy == 1)
                        {
                            if (normal_amount >= productinfo.Product_GroupNum)
                            {
                                Product_Price = productinfo.Product_GroupPrice;
                            }
                        }

                        Product_Coin = pub.Get_Member_Coin(Product_Price);
                        //检查是否赠送指定积分
                        if (productinfo.Product_IsGiftCoin == 1)
                        {
                            Product_Coin = (int)(Product_Price * productinfo.Product_Gift_Coin);
                        }

                        entity.Orders_Goods_BuyerID       = tools.CheckInt(Session["member_id"].ToString());
                        entity.Orders_Goods_Product_Coin  = Product_Coin;
                        entity.Orders_Goods_Product_Price = Product_Price;
                        MyCart.EditOrdersGoodsTmp(entity);
                        productinfo = null;
                    }
                }
                if (entity.Orders_Goods_Type == 2 && entity.Orders_Goods_ParentID == 0)
                {
                    packageinfo = MyPackage.GetPackageByID(entity.Orders_Goods_Product_ID, pub.CreateUserPrivilege("0dd17a70-862d-4e57-9b45-897b98e8a858"));
                    if (packageinfo != null)
                    {
                        Product_Price = pub.Get_Member_Price(0, packageinfo.Package_Price);
                        Product_Coin  = pub.Get_Member_Coin(Product_Price);

                        entity.Orders_Goods_BuyerID       = tools.CheckInt(Session["member_id"].ToString());
                        entity.Orders_Goods_Product_Coin  = Product_Coin;
                        entity.Orders_Goods_Product_Price = Product_Price;
                        MyCart.EditOrdersGoodsTmp(entity);
                        productinfo = null;
                    }
                }
            }
        }
    }