示例#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;
                    }
                }
            }
        }
    }
示例#2
0
    /// <summary>
    /// 珠宝库显示
    /// </summary>
    /// <param name="TopNum"></param>
    /// <returns></returns>
    public string GetJewelrysLibrary(int TopNum)
    {
        QueryInfo Query = new QueryInfo();

        Query.PageSize    = TopNum;
        Query.CurrentPage = 1;
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductInfo.Product_IsInsale", "=", "1"));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductInfo.Product_IsAudit", "=", "1"));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductInfo.Product_IsCoinBuy", "=", "0"));
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "ProductInfo.Product_Site", "=", "CN"));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "LEN(ProductInfo.Product_LibraryImg)", ">", "0"));
        Query.OrderInfos.Add(new OrderInfo("ProductInfo.Product_Sort", "ASC"));
        Query.OrderInfos.Add(new OrderInfo("ProductInfo.Product_ID", "DESC"));
        IList <ProductInfo> Products = MyPro.GetProductList(Query, pub.CreateUserPrivilege("ae7f5215-a21a-4af2-8d47-3cda2e1e2de8"));

        if (Products == null)
        {
            return(string.Empty);
        }

        StringBuilder strJSON = new StringBuilder();

        StringBuilder strHTML = new StringBuilder();

        strHTML.Append("<ul>\r\n");
        int icount = 0;

        foreach (ProductInfo entity in Products)
        {
            icount++;

            if (icount > 1 && icount % 8 == 0)
            {
                strHTML.Append("</ul><ul>");
            }

            strJSON.Append(",{\"name\":\"<a style='color:#ce1329;' href='" + pageurl.FormatURL(pageurl.product_detail, entity.Product_ID.ToString()) + "' target='_blank'>" + entity.Product_Name + "</a>\",\"note\":\"" + entity.Product_Note + "\",\"price\":\"" + pub.Get_Member_Price(entity.Product_ID, entity.Product_Price).ToString("0.00") + "\",\"id\":\"" + entity.Product_ID + "\",\"libraryimg\":\"" + pub.FormatImgURL(entity.Product_LibraryImg, "fullpath") + "\"}");

            strHTML.Append("	<li><img data=\""+ (icount - 1) + "\" src=\"" + pub.FormatImgURL(entity.Product_LibraryImg, "thumbnail") + "\" /></li>\r\n");
        }
        strHTML.Append("\r\n</ul>\r\n<script type=\"text/javascript\"> Librarys = {\"count\":\"" + Products.Count + "\", \"data\":[" + strJSON.Remove(0, 1).ToString() + "]};</script>");

        return(strHTML.ToString());
    }