Exemplo n.º 1
0
        //更新购物车中的AllMoney(实际购买总价),便于后期查看详情
        private double UpdateCartAllMoney(DataTable dt)
        {
            M_UserInfo mu       = buser.GetLogin();
            double     allmoney = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow   dr      = dt.Rows[i];
                M_Cart    cartMod = cartBll.GetCartByid(Convert.ToInt32(dr["ID"]));
                M_Product proMod  = proBll.GetproductByid(Convert.ToInt32(dr["Proid"]));
                //--附加币值计价
                //if (orderCom.HasPrice(proMod.LinPrice_Json))
                //{
                //    M_LinPrice priceMod = JsonConvert.DeserializeObject<M_LinPrice>(proMod.LinPrice_Json);
                //    priceMod.Purse = priceMod.Purse * cartMod.Pronum;
                //    priceMod.Sicon = priceMod.Sicon * cartMod.Pronum;
                //    priceMod.Point = priceMod.Point * cartMod.Pronum;
                //    dr["AllMoney_Json"] = JsonConvert.SerializeObject(priceMod);
                //    cartMod.AllMoney_Json = DataConvert.CStr(dr["AllMoney_Json"]);
                //}
                //根据商品价格类型,看使用  零售|批发|会员|会员组价格
                //多区域价格
                if (string.IsNullOrEmpty(Region))
                {
                    Region = buser.GetRegion(mu.UserID);
                }
                double price = regionBll.GetRegionPrice(proMod.ID, proMod.LinPrice, Region, mu.GroupID);
                //如果多区域价格未匹配,则匹配会员价
                if (price == proMod.LinPrice)
                {
                    price = proBll.P_GetByUserType(proMod, mu);
                }
                //--多价格编号,则使用多价格编号的价钱,ProName(已在购物车页面更新)
                //double price =proBll.GetPriceByCode(dr["code"], proMod.Wholesalesinfo, ref price);
                cartMod.AllMoney    = price * cartMod.Pronum;
                cartMod.AllIntegral = cartMod.AllMoney;
                //----计算折扣
                dr["AllMoney"]    = cartMod.AllMoney;
                dr["AllIntegral"] = cartMod.AllIntegral;
                if (proMod.Recommend > 0)
                {
                    dr["AllMoney"]   = (cartMod.AllIntegral - (cartMod.AllIntegral * ((double)proMod.Recommend / 100)));
                    cartMod.AllMoney = Convert.ToDouble(dr["AllMoney"]);
                }
                cartBll.UpdateByID(cartMod);
                allmoney += cartMod.AllMoney;
            }
            return(allmoney);
        }
Exemplo n.º 2
0
        //更新购物车中的AllMoney(实际购买总价),便于后期查看详情
        private double UpdateCartAllMoney(DataTable dt)
        {
            M_UserInfo mu       = buser.GetLogin();
            double     allmoney = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow   dr      = dt.Rows[i];
                M_Cart    cartMod = new M_Cart().GetModelFromReader(dr);
                M_Product proMod  = proBll.GetproductByid(Convert.ToInt32(dr["Proid"]));
                //根据商品价格类型,看使用  零售|批发|会员|会员组价格
                //多区域价格
                //if (string.IsNullOrEmpty(Region))
                //{
                //    Region = buser.GetRegion(mu.UserID);
                //}
                //double price = regionBll.GetRegionPrice(proMod.ID, proMod.LinPrice, Region, mu.GroupID);
                ////如果多区域价格未匹配,则匹配会员价
                //if (price == proMod.LinPrice) { price = proBll.P_GetByUserType(proMod, mu); }
                double price = proBll.P_GetByUserType(proMod, mu);
                //--多价格编号,则使用多价格编号的价钱,ProName(已在购物车页面更新)
                //double price =proBll.GetPriceByCode(dr["code"], proMod.Wholesalesinfo, ref price);
                cartMod.AllMoney_Init = cartMod.AllMoney = price * cartMod.Pronum;
                cartMod.FarePrice     = price.ToString("F2");
                cartMod.Shijia        = price;
                //----检查有无价格方面的促销活动,如果有,检免多少金额
                {
                    W_Filter filter = new W_Filter();
                    filter.cartMod    = cartMod;
                    filter.TypeFilter = "money";
                    ptBll.WhereLogical(filter);
                    cartMod.AllMoney_Arrive += filter.DiscountMoney;
                    cartMod.ArriveRemark    += "促销:" + filter.DiscountMoney.ToString("F2");
                }
                //----计算折扣
                cartMod.AllMoney = cartMod.AllMoney_Init - cartMod.AllMoney_Arrive;
                if (cartMod.AllMoney < 0)
                {
                    cartMod.AllMoney = 0;
                }
                //------------------------------
                dr["AllMoney"] = cartMod.AllMoney;
                cartBll.UpdateByID(cartMod);
                allmoney += cartMod.AllMoney;
            }
            //缓存数据,提交时验证
            VerifyDT = CartDT.DefaultView.ToTable(false, verifyFields);
            return(allmoney);
        }
Exemplo n.º 3
0
    /*----------------------------------------------------------------------------------------------------*/
    #region 重算商品金额
    //更新购物车中的AllMoney(实际购买总价),便于后期查看详情
    private double UpdateCartAllMoney(DataTable dt)
    {
        M_UserInfo mu       = buser.GetLogin();
        double     allmoney = 0;

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow   dr      = dt.Rows[i];
            M_Cart    cartMod = new M_Cart().GetModelFromReader(dr);
            M_Product proMod  = proBll.GetproductByid(Convert.ToInt32(dr["Proid"]));

            //if (price == proMod.LinPrice) { price = proBll.P_GetByUserType(proMod, mu); }
            //double price = proBll.P_GetByUserType(proMod, mu);
            double price = proMod.LinPrice;
            //--多价格编号,则使用多价格编号的价钱,ProName(已在购物车页面更新)
            //double price =proBll.GetPriceByCode(dr["code"], proMod.Wholesalesinfo, ref price);
            cartMod.AllMoney    = price * cartMod.Pronum;
            cartMod.AllIntegral = cartMod.AllMoney;
            cartMod.FarePrice   = price.ToString("F2");
            //----检查有无价格方面的促销活动,如果有,检免多少金额
            {
                W_Filter filter = new W_Filter();
                filter.cartMod    = cartMod;
                filter.TypeFilter = "money";
                ptBll.WhereLogical(filter);
                cartMod.AllMoney = cartMod.AllMoney - filter.DiscountMoney;
            }
            //----计算折扣
            dr["AllMoney"]    = cartMod.AllMoney;
            dr["AllIntegral"] = cartMod.AllIntegral;
            //if (proMod.Recommend > 0)
            //{
            //    dr["AllMoney"] = (cartMod.AllIntegral - (cartMod.AllIntegral * ((double)proMod.Recommend / 100)));
            //    cartMod.AllMoney = Convert.ToDouble(dr["AllMoney"]);
            //}
            cartBll.UpdateByID(cartMod);
            allmoney += cartMod.AllMoney;
        }
        return(allmoney);
    }