/// <summary> /// 从购物车 消减 指定数量的商品 /// </summary> /// <param name="args"></param> /// <returns></returns> public NormalResult <PointCommodityShoppingCartOperateResult> RemoveFormCart(PointCommodityAddToCartArgs args) { NormalResult <PointCommodityShoppingCartOperateResult> result = new NormalResult <PointCommodityShoppingCartOperateResult>(false); List <CommandParameter> parameterList = new List <CommandParameter>(); parameterList.Add(new CommandParameter("@domainId", args.Domain)); parameterList.Add(new CommandParameter("@appId", args.AppId)); parameterList.Add(new CommandParameter("@memberId", args.Member)); parameterList.Add(new CommandParameter("@pointCommodity", args.PointCommodity)); parameterList.Add(new CommandParameter("@quantity", args.Quantity)); DataSet dsResult = _dataBase.ExecuteDataSet(CommandType.StoredProcedure, "RemovePointCommodityFromCart", parameterList, new string[] { "result", "quantity" }); result.Reason = int.Parse(dsResult.Tables[0].Rows[0]["Result"].ToString()); if (result.Reason == 0) { result.Data = new PointCommodityShoppingCartOperateResult(); result.Data.Quantity = int.Parse(dsResult.Tables[1].Rows[0]["Quantity"].ToString()); result.Success = true; } return(result); }
public ActionResult RemoveFormCart() { PointCommodityAddToCartArgs args = RequestArgs <PointCommodityAddToCartArgs>(); if (args == null) { return(RespondResult(false, "参数无效。")); } args.Domain = DomainContext.Domain.Id; args.AppId = DomainContext.AppId; args.Member = MemberContext.Member.Id; NormalResult result = _pointCommodityManager.RemoveFormCart(args); return(RespondDataResult(result)); }
/// <summary> /// 设置购物车中指定商品的数量 /// </summary> /// <returns></returns> public NormalResult SetCartItemQuantity(PointCommodityAddToCartArgs args) { NormalResult result = new NormalResult(); List <CommandParameter> parameterList = new List <CommandParameter>(); parameterList.Add(new CommandParameter("@domainId", args.Domain)); parameterList.Add(new CommandParameter("@appId", args.AppId)); parameterList.Add(new CommandParameter("@memberId", args.Member)); parameterList.Add(new CommandParameter("@pointCommodity", args.PointCommodity)); parameterList.Add(new CommandParameter("@quantity", args.Quantity)); DataSet dsResult = _dataBase.ExecuteDataSet(CommandType.StoredProcedure, "SetPointCommodityCartItemQuantity", parameterList, new string[] { "result" }); result.Reason = int.Parse(dsResult.Tables[0].Rows[0]["Result"].ToString()); if (result.Reason == 0) { result.Success = true; } return(result); }