public static int DeleteVirtualProductConfig(string pid)
 {
     using (var conn = ProcessConnection.OpenConfiguration)
     {
         return(DalGroupBuyingProductGroupConfig.DeleteVirtualProductConfig(conn, pid, ThreadIdentity.Operator.UserName));
     }
 }
 /// <summary>
 /// 根据PID查询单个优惠券详情
 /// </summary>
 /// <param name="pid">pid</param>
 /// <returns></returns>
 public static List <VirtualProductCouponConfigModel> FetchProductCouponConfig(string pid)
 {
     using (var conn = ProcessConnection.OpenConfigurationReadOnly)
     {
         return(DalGroupBuyingProductGroupConfig.FetchProductCouponConfig(conn, pid).ToList());
     }
 }
 public static List <string> SelectProductCouponConfig(IEnumerable <string> pids)
 {
     using (var conn = ProcessConnection.OpenConfigurationReadOnly)
     {
         return(DalGroupBuyingProductGroupConfig.SelectProductCouponConfig(conn, pids).ToList());
     }
 }
 /// <summary>
 /// 查询虚拟商品列表
 /// </summary>
 /// <param name="pageIndex">pageIndex</param>
 /// <param name="pageSize">pageSize</param>
 /// <param name="pid">商品pid</param>
 /// <returns></returns>
 public static List <VirtualProductCouponConfigModel> SelectProductCouponConfig(int pageIndex, int pageSize, string pid)
 {
     using (var conn = ProcessConnection.OpenConfigurationReadOnly)
     {
         return(DalGroupBuyingProductGroupConfig.
                SelectProductCouponConfig(conn, pageIndex, pageSize, pid).ToList());
     }
 }
 public static int SelectProductCouponConfigCount(string pid)
 {
     using (var conn = ProcessConnection.OpenConfigurationReadOnly)
     {
         return(DalGroupBuyingProductGroupConfig.
                SelectProductCouponConfigCount(conn, pid));
     }
 }
        public static List <LotteryUserModel> LotteryInfoList(string productGroupId, int orderId, int lotteryResult, PagerModel pager)
        {
            var totalCount = DalGroupBuyingProductGroupConfig.LotteryInfoCount(productGroupId, orderId, lotteryResult);

            pager.TotalItem = totalCount;
            if (totalCount > 0)
            {
                return(DalGroupBuyingProductGroupConfig.LotteryInfoList(productGroupId, orderId, lotteryResult, pager.CurrentPage, pager.PageSize));
            }
            return(new List <LotteryUserModel>());
        }
        public static bool DeleteLotteryCoupons(string productGroupId, List <Guid> couponIds, string _operator)
        {
            var result = false;

            foreach (var item in couponIds)
            {
                var resultItem = DalGroupBuyingProductGroupConfig.DeleteLotteryCoupon(productGroupId, item);
                var resultStr  = resultItem ? "成功" : "失败";
                LotteryLog(productGroupId, "DeleteCouponOne", _operator, $"{item:D}优惠券删除{resultStr}");
                result |= resultItem;
            }
            return(result);
        }
Esempio n. 8
0
        public List <VW_ProductsModel> GetProductsByPIDAndIsLottery(string pid, bool isLottery)
        {
            List <VW_ProductsModel> result = new List <VW_ProductsModel>();

            try
            {
                result = dbScopeReadManager.Execute(conn => DalGroupBuyingProductGroupConfig.GetProductsByPIDAndIsLottery(conn, pid, isLottery));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
        public static List <LotteryCouponModel> GetLotteryCoupon(string productGroupId)
        {
            var data   = DalGroupBuyingProductGroupConfig.GetLotteryCouponList(productGroupId);
            var result = new List <LotteryCouponModel>();

            if (data.Any())
            {
                foreach (var item in data)
                {
                    var resultItem = GetCouponDetail(item.Item1, productGroupId);
                    if (resultItem != null)
                    {
                        resultItem.Creator = item.Item2;
                        result.Add(resultItem);
                    }
                }
            }
            return(result);
        }
        public static List <GroupBuyingStockModel> GetGroupBuyingStockInfo(List <string> pids)
        {
            var data   = DalGroupBuyingProductGroupConfig.GetGroupBuyingStockInfo(pids);
            var result = data.GroupBy(g => g.PID).Select(g => new GroupBuyingStockModel
            {
                PID = g.Key,
                SHAvailableStockQuantity =
                    g.FirstOrDefault(t => t.WAREHOUSEID == 8598)?.TotalAvailableStockQuantity ?? 0,
                SHStockCost              = g.FirstOrDefault(t => t.WAREHOUSEID == 8598)?.StockCost ?? 0,
                SHZaituStockQuantity     = g.FirstOrDefault(t => t.WAREHOUSEID == 8598)?.CaigouZaitu ?? 0,
                WHAvailableStockQuantity =
                    g.FirstOrDefault(t => t.WAREHOUSEID == 7295)?.TotalAvailableStockQuantity ?? 0,
                WHStockCost                 = g.FirstOrDefault(t => t.WAREHOUSEID == 7295)?.StockCost ?? 0,
                WHZaituStockQuantity        = g.FirstOrDefault(t => t.WAREHOUSEID == 7295)?.CaigouZaitu ?? 0,
                TotalAvailableStockQuantity = g.Sum(t => t.TotalAvailableStockQuantity),
                TotalZaituStockQuantity     = g.Sum(t => t.CaigouZaitu)
            }).ToList();

            return(result);
        }
Esempio n. 11
0
        /// <summary>
        /// 通过GroupId获取团购信息
        /// </summary>
        /// <param name="ProductGroupId"></param>
        /// <returns></returns>
        public GroupBuyingProductGroupConfigEntity SelectGroupBuyingV2ConfigByGroupId(string productGroupId)
        {
            GroupBuyingProductGroupConfigEntity result = null;

            try
            {
                dbScopeReadManager.Execute(conn =>
                {
                    result = DalGroupBuyingProductGroupConfig.GetGroupBuyingV2ConfigByGroupId(conn, productGroupId);
                    result.GroupProductDetails = DalGroupBuyingProductGroupConfig.GetGroupBuyingV2ProductConfigByGroupId(conn, new List <string> {
                        productGroupId
                    });
                });
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
        public static Tuple <int, string> SetLotteryResult(string productGroupId, int level, Guid userId, int orderId, string _operator)
        {
            var result    = -1;
            var info      = "设置失败";
            var setResult = DalGroupBuyingProductGroupConfig.SetUserLotteryResult(productGroupId, level, orderId, userId);

            if (setResult > 0)
            {
                result = 1; info = $"{productGroupId}产品组下,用户{orderId}设置{level}等奖成功;";
            }
            if (setResult > 0 && level == 1)
            {
                setResult = DalGroupBuyingProductGroupConfig.SetOtherLotteryResult(productGroupId, 2);
                info      = $"{productGroupId}产品组下,用户{orderId}设置{level}等奖成功;" + (setResult == 0 ? "" : $"其他未开奖订单设置奖励{setResult}个成功");
                if (setResult < 1)
                {
                    result = 2;
                }
            }

            LotteryLog(productGroupId, $"SetLevel->{level}", _operator, info);
            return(Tuple.Create(result, info));
        }