Esempio n. 1
0
        public void SetFinish(int sysno)
        {
            //必须是Running
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                CountdownInfo oCountdown = Load(sysno);

                if (oCountdown.Status != (int)AppEnum.CountdownStatus.Running)
                {
                    throw new BizException("the current status not allow such opertion");
                }

                oCountdown.Status = (int)AppEnum.CountdownStatus.Finish;

                ProductPriceInfo oPrice = ProductManager.GetInstance().LoadPrice(oCountdown.ProductSysNo);

                oPrice.CurrentPrice = oCountdown.SnapShotCurrentPrice;
                oPrice.CashRebate   = oCountdown.SnapShotCashRebate;
                oPrice.Point        = oCountdown.SnapShotPoint;

                InventoryManager.GetInstance().SetVirtualQty(oCountdown.ProductSysNo, oCountdown.AffectedVirtualQty);
                ProductManager.GetInstance().UpdatePriceInfo(oPrice);
                new CountdownDac().Update(oCountdown);

                scope.Complete();
            }
        }
Esempio n. 2
0
        public virtual GrossMarginMsg GetGrossMargin(CountdownInfo entity)
        {
            GrossMarginMsg msg         = new GrossMarginMsg();
            decimal        GrossMargin = 0;
            decimal        GrossMarginWithOutPointAndGift = 0;
            decimal        GrossMarginRate = 0;
            decimal        GrossMarginRateWithOutPointAndGift = 0;
            var            giftSysNo   = 0;
            var            couponSysNo = 0;

            //获取蛋劵和赠品编号
            if (entity.ProductSysNo.HasValue)
            {
                ObjectFactory <ICountdownQueryDA> .Instance.GetGiftAndCouponSysNo(entity.ProductSysNo.Value, out giftSysNo, out couponSysNo);

                if (giftSysNo != -1)
                {
                    msg.GiftSysNo = giftSysNo;
                }
                if (couponSysNo != -1)
                {
                    msg.CouponSysNo = couponSysNo;
                }
            }
            ObjectFactory <CountdownAppService> .Instance.GetGrossMargin(entity, out GrossMargin, out GrossMarginWithOutPointAndGift, out GrossMarginRate, out GrossMarginRateWithOutPointAndGift);

            msg.GrossMargin = GrossMargin;
            msg.GrossMarginWithOutPointAndGift = GrossMarginWithOutPointAndGift;
            msg.GrossMarginRate = GrossMarginRate;
            msg.GrossMarginRateWithOutPointAndGift = GrossMarginRateWithOutPointAndGift;
            msg.CountDownMargin     = Convert.ToDecimal(AppSettingManager.GetSetting("MKT", "CountDownMargin"));
            msg.CountDownMarginRate = Convert.ToDecimal(AppSettingManager.GetSetting("MKT", "CountDownMarginRate"));
            return(msg);
        }
Esempio n. 3
0
        public void MaintainCountdownEndTime(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("MaintainCountdownEndTime");

            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@EndTime", entity.EndTime);
            command.SetParameterValue("@EditUser", entity.EditUserName);
            command.ExecuteNonQuery();
        }
Esempio n. 4
0
 public CountdownInfo CreateCountdown(CountdownInfo info)
 {
     //检查是否有创建权限
     if (info.PMRole == 0)
     {
         throw new BizException(ResouceManager.GetMessageString("MKT.Promotion.Countdown", "Countdown_SorryYouNotHaveAuthority"));
     }
     return(ObjectFactory <CountdownAppService> .Instance.CreateCountdown(info));
 }
Esempio n. 5
0
        public CountdownInfo Load(int?sysNo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("LoadCountdownInfo");

            command.SetParameterValue("@SysNo", sysNo);
            CountdownInfo result = command.ExecuteEntity <CountdownInfo>();

            return(result);
        }
Esempio n. 6
0
        /// <summary>
        /// 检查限时抢购价格不能低于捆绑销售折扣价格,请先处理对应Valid状态的捆绑销售折扣价格!
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool CheckSaleRuleDiscount(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CheckSaleRuleDiscount");

            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@CountDownCurrentPrice", entity.CountDownCurrentPrice);
            int n = command.ExecuteScalar <Int32>();

            return(n > 0);
        }
Esempio n. 7
0
        public void MaintainCountdownStatus(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("MaintainCountdownStatus");

            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@Status", entity.Status);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            command.SetParameterValueAsCurrentUserAcct("@EditUser");
            command.ExecuteNonQuery();
        }
Esempio n. 8
0
        public bool CheckRunningLimitedItem(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CheckRunningLimitedItem");

            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            int n = command.ExecuteScalar <int>();

            return(n > 0 ? true : false);
        }
Esempio n. 9
0
        public void VerifyCountdown(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("VerifyCountdown");

            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@Status", entity.Status);
            command.SetParameterValue("@VerifyMemo", entity.VerifyMemo);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            command.SetParameterValueAsCurrentUserAcct("@AuditUser");
            command.ExecuteNonQuery();
        }
Esempio n. 10
0
        public List <CountdownInfo> CountItemHasReserveQtyNotRunning(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CountItemHasReserveQtyNotRunning");

            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            List <CountdownInfo> result = command.ExecuteEntityList <CountdownInfo>();

            return(result);
        }
Esempio n. 11
0
        public bool HasDuplicateProduct(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CheckDuplicate");

            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@StartTime", entity.StartTime);
            command.SetParameterValue("@EndTime", entity.EndTime);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            List <CountdownInfo> duplicateProducts = command.ExecuteEntityList <CountdownInfo>();

            return((duplicateProducts != null && duplicateProducts.Count > 0) ? true : false);
        }
Esempio n. 12
0
        public void CreateCountdown(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CreateCountdown");


            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@StartTime", entity.StartTime);
            command.SetParameterValue("@EndTime", entity.EndTime);
            command.SetParameterValue("@CountDownCurrentPrice", entity.CountDownCurrentPrice ?? 0);
            command.SetParameterValue("@CountDownCashRebate", entity.CountDownCashRebate ?? 0);
            command.SetParameterValue("@CountDownPoint", entity.CountDownPoint ?? 0);
            command.SetParameterValue("@CountDownQty", entity.CountDownQty ?? 0);
            command.SetParameterValue("@SnapShotCurrentPrice", entity.SnapShotCurrentPrice ?? 0);
            command.SetParameterValue("@SnapShotCashRebate", entity.SnapShotCashRebate ?? 0);
            command.SetParameterValue("@SnapShotPoint", entity.SnapShotPoint ?? 0);
            command.SetParameterValue("@AffectedVirtualQty", entity.AffectedVirtualQty ?? 0);
            command.SetParameterValue("@Status", entity.Status);
            command.SetParameterValue("@AffectedStock", entity.AffectedStock);
            command.SetParameterValue("@Reasons", entity.Reasons);
            command.SetParameterValue("@IsCountDownAreaShow", entity.IsCountDownAreaShow);
            command.SetParameterValue("@PromotionType", entity.IsSecondKill.HasValue && entity.IsSecondKill.Value ? "DC" : string.Empty);
            command.SetParameterValue("@IsLimitedQty", entity.IsLimitedQty);
            command.SetParameterValue("@IsReservedQty", entity.IsReservedQty);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            command.SetParameterValue("@IsPromotionSchedule", entity.IsPromotionSchedule);
            command.SetParameterValue("@PromotionTitle", entity.PromotionTitle);
            command.SetParameterValue("@BaseLine", entity.BaseLine);
            command.SetParameterValue("@MaxPerOrder", entity.MaxPerOrder);
            command.SetParameterValue("@IsHomePageShow", entity.IsHomePageShow);

            command.SetParameterValue("@IsC1Show", entity.IsC1Show.HasValue && entity.IsC1Show.Value ? "Y" : "N");
            command.SetParameterValue("@IsC2Show", entity.IsC2Show.HasValue && entity.IsC2Show.Value ? "Y" : "N");
            command.SetParameterValue("@IsTodaySpecials", entity.IsTodaySpecials.HasValue && entity.IsTodaySpecials.Value ? "Y" : "N");
            command.SetParameterValue("@Is24hNotice", entity.Is24hNotice.HasValue && entity.Is24hNotice.Value ? "Y" : "N");
            command.SetParameterValue("@IsShowPriceInNotice", entity.IsShowPriceInNotice.HasValue && entity.IsShowPriceInNotice.Value ? "Y" : "N");
            command.SetParameterValue("@IsEndIfNoQty", entity.IsEndIfNoQty.HasValue && entity.IsEndIfNoQty.Value ? "Y" : "N");
            command.SetParameterValue("@IsGroupOn", entity.IsGroupOn.HasValue ? entity.IsGroupOn.Value ? "Y" : "N" : null);

            command.SetParameterValue("@AreaShowPriority", entity.AreaShowPriority);
            command.SetParameterValue("@HomePagePriority", entity.HomePagePriority);
            command.SetParameterValueAsCurrentUserSysNo("@CreateUserSysNo");
            command.SetParameterValueAsCurrentUserAcct("@CreateUserName");
            command.SetParameterValue("@CreateTime", DateTime.Now);
            command.SetParameterValue("@VendorSysNo", entity.VendorSysNo);
            command.ExecuteNonQuery();

            entity.SysNo = Convert.ToInt32(command.GetParameterValue("@SysNo"));

            //return entity;
        }
Esempio n. 13
0
        public CountdownInfo Load(int sysno)
        {
            string  sql = "select * from sale_countdown where sysno = " + sysno;
            DataSet ds  = SqlHelper.ExecuteDataSet(sql);

            if (!Util.HasMoreRow(ds))
            {
                throw new BizException("no records use this sysno");
            }
            CountdownInfo oInfo = new CountdownInfo();

            map(oInfo, ds.Tables[0].Rows[0]);
            return(oInfo);
        }
Esempio n. 14
0
        public void CreateCountdown(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CreateCountdown");


            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@StartTime", entity.StartTime);
            command.SetParameterValue("@EndTime", entity.EndTime);
            command.SetParameterValue("@CountDownCurrentPrice", entity.CountDownCurrentPrice);
            command.SetParameterValue("@CountDownCashRebate", 0);
            command.SetParameterValue("@CountDownPoint", 0);
            command.SetParameterValue("@CountDownQty", entity.CountDownQty);
            command.SetParameterValue("@SnapShotCurrentPrice", 0);
            command.SetParameterValue("@SnapShotCashRebate", 0);
            command.SetParameterValue("@SnapShotPoint", 0);
            command.SetParameterValue("@AffectedVirtualQty", 0);
            command.SetParameterValue("@Status", entity.Status);
            command.SetParameterValue("@AffectedStock", null);
            command.SetParameterValue("@Reasons", null);
            command.SetParameterValue("@IsCountDownAreaShow", 0);
            command.SetParameterValue("@PromotionType", string.Empty);
            command.SetParameterValue("@IsLimitedQty", 1);
            command.SetParameterValue("@IsReservedQty", 0);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            command.SetParameterValue("@IsPromotionSchedule", false);
            command.SetParameterValue("@PromotionTitle", entity.PromotionTitle);
            command.SetParameterValue("@BaseLine", 0);
            command.SetParameterValue("@MaxPerOrder", 1);
            command.SetParameterValue("@IsHomePageShow", 0);

            command.SetParameterValue("@IsC1Show", "N");
            command.SetParameterValue("@IsC2Show", "N");
            command.SetParameterValue("@IsTodaySpecials", "N");
            command.SetParameterValue("@Is24hNotice", "N");
            command.SetParameterValue("@IsShowPriceInNotice", "N");
            command.SetParameterValue("@IsEndIfNoQty", entity.IsEndIfNoQty);
            command.SetParameterValue("@IsGroupOn", "N");

            command.SetParameterValue("@AreaShowPriority", null);
            command.SetParameterValue("@HomePagePriority", null);
            command.SetParameterValue("@CreateUserSysNo", entity.InUserSysNo);
            command.SetParameterValue("@CreateTime", DateTime.Now);
            command.SetParameterValue("@VendorSysNo", entity.SellerSysNo);
            command.SetParameterValue("@CreateUserName", entity.InUserName);
            command.ExecuteNonQuery();

            entity.SysNo = Convert.ToInt32(command.GetParameterValue("@SysNo"));
        }
Esempio n. 15
0
        public bool SetRunning(int sysno)
        {
            //必须是Ready状态,切换价格和库存
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                CountdownInfo oCountdown = Load(sysno);

                if (oCountdown.Status != (int)AppEnum.CountdownStatus.Ready)
                {
                    throw new BizException("the current status not allow such opertion");
                }

                oCountdown.Status = (int)AppEnum.CountdownStatus.Running;

                ProductPriceInfo oPrice = ProductManager.GetInstance().LoadPrice(oCountdown.ProductSysNo);

                oCountdown.SnapShotCurrentPrice = oPrice.CurrentPrice;
                oCountdown.SnapShotCashRebate   = oPrice.CashRebate;
                oCountdown.SnapShotPoint        = oPrice.Point;

                oPrice.CurrentPrice = oCountdown.CountDownCurrentPrice;
                oPrice.CashRebate   = oCountdown.CountDownCashRebate;
                oPrice.Point        = oCountdown.CountDownPoint;

                InventoryInfo oInventory = InventoryManager.GetInstance().LoadInventory(oCountdown.ProductSysNo);

                //oCountdown.AffectedVirtualQty = oInventory.AvailableQty + oInventory.VirtualQty + oInventory.ConsignQty - oCountdown.CountDownQty;
                oCountdown.AffectedVirtualQty = oInventory.AvailableQty + oInventory.VirtualQty + -oCountdown.CountDownQty;
                if (oCountdown.AffectedVirtualQty < 0)
                {
                    scope.Complete();
                    return(false);
                }

                InventoryManager.GetInstance().SetVirtualQty(oCountdown.ProductSysNo, -1 * oCountdown.AffectedVirtualQty);
                ProductManager.GetInstance().UpdatePriceInfo(oPrice);
                new CountdownDac().Update(oCountdown);

                scope.Complete();
                return(true);
            }
        }
Esempio n. 16
0
 public void Calculate(ref OrderInfo order)
 {
     foreach (OrderItemGroup orderItemGroup in order.OrderItemGroupList)
     {
         foreach (OrderProductItem orderItem in orderItemGroup.ProductItemList)
         {
             //团购
             int groupBuySysNo = PromotionDA.ProductIsGroupBuying(orderItem.ProductSysNo);
             if (groupBuySysNo > 0)
             {
                 if (PromotionDA.ProductIsVirualGroupBuying(orderItem.ProductSysNo) > 0)
                 {
                     orderItem.SpecialActivityType  = 3;
                     orderItem.SpecialActivitySysNo = groupBuySysNo;
                 }
                 else
                 {
                     orderItem.SpecialActivityType  = 1;
                     orderItem.SpecialActivitySysNo = groupBuySysNo;
                 }
                 break;
             }
             //限时和秒杀
             CountdownInfo countdown = PromotionDA.GetProductCountdownByProductSysNo(orderItem.ProductSysNo);
             if (countdown != null)
             {
                 orderItem.SpecialActivityType  = 2;
                 orderItem.SpecialActivitySysNo = countdown.SysNo.Value;
                 break;
             }
         }
     }
     if (order.SubOrderList != null)
     {
         foreach (var subOrder in order.SubOrderList)
         {
             if (subOrder.Value.SOType == (int)SOType.VirualGroupBuy)
             {
                 subOrder.Value.ShipTypeID = "101";
             }
         }
     }
 }
Esempio n. 17
0
 private void map(CountdownInfo oParam, DataRow tempdr)
 {
     oParam.SysNo                 = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.CreateUserSysNo       = Util.TrimIntNull(tempdr["CreateUserSysNo"]);
     oParam.CreateTime            = Util.TrimDateNull(tempdr["CreateTime"]);
     oParam.ProductSysNo          = Util.TrimIntNull(tempdr["ProductSysNo"]);
     oParam.StartTime             = Util.TrimDateNull(tempdr["StartTime"]);
     oParam.EndTime               = Util.TrimDateNull(tempdr["EndTime"]);
     oParam.CountDownCurrentPrice = Util.TrimDecimalNull(tempdr["CountDownCurrentPrice"]);
     oParam.CountDownCashRebate   = Util.TrimDecimalNull(tempdr["CountDownCashRebate"]);
     oParam.CountDownPoint        = Util.TrimIntNull(tempdr["CountDownPoint"]);
     oParam.CountDownQty          = Util.TrimIntNull(tempdr["CountDownQty"]);
     oParam.SnapShotCurrentPrice  = Util.TrimDecimalNull(tempdr["SnapShotCurrentPrice"]);
     oParam.SnapShotCashRebate    = Util.TrimDecimalNull(tempdr["SnapShotCashRebate"]);
     oParam.SnapShotPoint         = Util.TrimIntNull(tempdr["SnapShotPoint"]);
     oParam.AffectedVirtualQty    = Util.TrimIntNull(tempdr["AffectedVirtualQty"]);
     oParam.Status                = Util.TrimIntNull(tempdr["Status"]);
     oParam.Type = Util.TrimIntNull(tempdr["Type"]);
 }
Esempio n. 18
0
 public void CountdownJob()
 {
     try
     {
         string  sql = "select * from sale_countdown where status in ( " + (int)AppEnum.CountdownStatus.Ready + "," + (int)AppEnum.CountdownStatus.Running + ")";
         DataSet ds  = SqlHelper.ExecuteDataSet(sql);
         if (!Util.HasMoreRow(ds))
         {
             return;
         }
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             CountdownInfo oCountdown = new CountdownInfo();
             map(oCountdown, dr);
             if (oCountdown.Status == (int)AppEnum.CountdownStatus.Ready && (oCountdown.StartTime < DateTime.Now && oCountdown.EndTime >= DateTime.Now))
             {
                 if (!this.SetRunning(oCountdown.SysNo))
                 {
                     this.SetAbandon(oCountdown.SysNo);
                 }
             }
             if (oCountdown.Status == (int)AppEnum.CountdownStatus.Running && (oCountdown.EndTime < DateTime.Now))
             {
                 if (oCountdown.Type == (int)AppEnum.CountdownType.OneTime)
                 {
                     this.SetFinish(oCountdown.SysNo);
                 }
                 else if (oCountdown.Type == (int)AppEnum.CountdownType.EveryDay)
                 {
                     this.SetFinish(oCountdown.SysNo);
                     oCountdown.StartTime = oCountdown.StartTime.AddDays(1);
                     oCountdown.EndTime   = oCountdown.EndTime.AddDays(1);
                     oCountdown.Status    = (int)AppEnum.CountdownStatus.Ready;
                     this.Update(oCountdown);
                 }
             }
         }
     }
     catch
     {
     }
 }
Esempio n. 19
0
        /// <summary>
        /// 获取指定商品的所有促销信息
        /// </summary>
        /// <param name="productSysNo"></param>
        /// <returns></returns>
        public static ProductPromotionInfo GetProductPromotionInfo(int productSysNo)
        {
            if (productSysNo <= 0)
            {
                return(null);
            }
            string cacheKey = "GetProductPromotionInfo_" + productSysNo;

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((ProductPromotionInfo)HttpRuntime.Cache[cacheKey]);
            }

            ProductPromotionInfo promotion = new ProductPromotionInfo();

            promotion.ProductSysNo = productSysNo;
            //套餐
            promotion.ComboList = PromotionDA.GetComboListByMasterProductSysNo(productSysNo);
            //团购
            promotion.GroupBuySysNo = PromotionDA.ProductIsGroupBuying(productSysNo);
            //限时和秒杀
            CountdownInfo countdown = PromotionDA.GetProductCountdownByProductSysNo(productSysNo);

            if (countdown != null)
            {
                promotion.Countdown      = countdown;
                promotion.CountdownSysNo = countdown.SysNo.Value;
                promotion.IsSecKill      = countdown.IsSecondKill.HasValue ? countdown.IsSecondKill.Value : false;
            }
            else
            {
                promotion.CountdownSysNo = 0;
                promotion.IsSecKill      = false;
            }
            //赠品
            promotion.SaleGiftList = PromotionDA.GetSaleGiftListByProductSysNo(productSysNo);



            HttpRuntime.Cache.Insert(cacheKey, promotion, null, DateTime.Now.AddSeconds(CacheTime.Short), Cache.NoSlidingExpiration);
            return(promotion);
        }
Esempio n. 20
0
        public CountdownInfo GetCountdownReadyByProductSysNo(int productSysNo)
        {
            string  sql = "select * from sale_countdown where productsysno = " + productSysNo + " and status=" + (int)AppEnum.CountdownStatus.Ready;
            DataSet ds  = SqlHelper.ExecuteDataSet(sql);

            if (!Util.HasMoreRow(ds))
            {
                return(null);
            }

            if (ds.Tables[0].Rows.Count != 1)
            {
                throw new BizException("限时抢购策略重复!");
            }

            CountdownInfo oCountdown = new CountdownInfo();

            map(oCountdown, ds.Tables[0].Rows[0]);
            return(oCountdown);
        }
Esempio n. 21
0
        public ActionResult CountdownSubmit(CountdownInfo info)
        {
            var loginUser = UserAuthHelper.GetCurrentUser();

            info.Status        = CountdownStatus.WaitForPrimaryVerify;
            info.SellerSysNo   = loginUser.SellerSysNo;
            info.InUserSysNo   = loginUser.UserSysNo;
            info.InUserName    = loginUser.UserDisplayName;
            info.EditUserSysNo = loginUser.UserSysNo;
            info.EditUserName  = loginUser.UserDisplayName;
            if (info.SysNo > 0)
            {
                _countdownService.Update(info);
            }
            else
            {
                _countdownService.Create(info);
            }
            return(JsonSuccess(info.SysNo, LanguageHelper.GetText("提交审核成功。")));
        }
Esempio n. 22
0
        public ActionResult CountdownMaintain(CountdownInfo info)
        {
            var loginUser = UserAuthHelper.GetCurrentUser();

            info.SellerSysNo   = loginUser.SellerSysNo;
            info.InUserSysNo   = loginUser.UserSysNo;
            info.InUserName    = loginUser.UserDisplayName;
            info.EditUserSysNo = loginUser.UserSysNo;
            info.EditUserName  = loginUser.UserDisplayName;
            if (info.SysNo > 0)
            {
                _countdownService.Update(info);
                return(JsonSuccess(info.SysNo, LanguageHelper.GetText("更新成功。")));
            }
            else
            {
                _countdownService.Create(info);
                return(JsonSuccess(info.SysNo, LanguageHelper.GetText("创建成功。")));
            }
        }
Esempio n. 23
0
        public void VerifyPromotionSchedule(CountdownInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("VerifyPromotionSchedule");

            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@StartTime", entity.StartTime);
            command.SetParameterValue("@EndTime", entity.EndTime);
            command.SetParameterValue("@CountDownCurrentPrice", entity.CountDownCurrentPrice);
            command.SetParameterValue("@CountDownCashRebate", entity.CountDownCashRebate);
            command.SetParameterValue("@CountDownPoint", entity.CountDownPoint);
            command.SetParameterValue("@CountDownQty", entity.CountDownQty);
            command.SetParameterValue("@SnapShotCurrentPrice", entity.SnapShotCurrentPrice);
            command.SetParameterValue("@SnapShotCashRebate", entity.SnapShotCashRebate);
            command.SetParameterValue("@SnapShotPoint", entity.SnapShotPoint);
            command.SetParameterValue("@AffectedVirtualQty", entity.AffectedVirtualQty);
            command.SetParameterValue("@Status", entity.Status);
            command.SetParameterValue("@AffectedStock", entity.AffectedStock);
            command.SetParameterValue("@Reasons", entity.Reasons);
            command.SetParameterValue("@IsCountDownAreaShow", entity.IsCountDownAreaShow);
            command.SetParameterValue("@PromotionType", entity.IsSecondKill.HasValue && entity.IsSecondKill.Value ? "DC" : string.Empty);
            command.SetParameterValue("@IsLimitedQty", entity.IsLimitedQty);
            command.SetParameterValue("@IsReservedQty", entity.IsReservedQty);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);

            command.SetParameterValue("@IsPromotionSchedule", entity.IsPromotionSchedule);
            command.SetParameterValue("@PromotionTitle", entity.PromotionTitle);
            command.SetParameterValue("@BaseLine", entity.BaseLine);
            command.SetParameterValue("@MaxPerOrder", entity.MaxPerOrder);
            command.SetParameterValue("@IsHomePageShow", entity.IsHomePageShow);

            command.SetParameterValue("@IsTodaySpecials", entity.IsTodaySpecials.HasValue && entity.IsTodaySpecials.Value ? "Y" : "N");
            command.SetParameterValue("@Is24hNotice", entity.Is24hNotice.HasValue && entity.Is24hNotice.Value ? "Y" : "N");
            command.SetParameterValue("@IsShowPriceInNotice", entity.IsShowPriceInNotice.HasValue && entity.IsShowPriceInNotice.Value ? "Y" : "N");
            command.SetParameterValue("@IsEndIfNoQty", entity.IsEndIfNoQty.HasValue && entity.IsEndIfNoQty.Value ? "Y" : "N");
            command.SetParameterValue("@IsGroupOn", entity.IsGroupOn.HasValue && entity.IsGroupOn.Value ? "Y" : "N");
            command.SetParameterValue("@VerifyMemo", entity.VerifyMemo);
            command.SetParameterValueAsCurrentUserAcct("@AuditUser");
            command.ExecuteNonQuery();
        }
Esempio n. 24
0
        public void Insert(CountdownInfo oParam)
        {
            //有效的记录,相同商品,时段不能重复
            //对于一维集合A(x,y), B(a,b), 已知x>y, a>b。判断AB是否重合。
            // AB不重合可以这样判断 (y<a || x>b), 这个否关系的表达式 ( y>=a && x<=b).
            // x=sale_countdown.StartTime
            // y=sale_countdown.EndTime
            // a=oParam.StartTime
            // b=oParam.EndTime
            string sql = "select top 1 sysno from sale_countdown where "
                         + " status in (" + (int)AppEnum.CountdownStatus.Ready + "," + (int)AppEnum.CountdownStatus.Running + ")"
                         + " and productsysno = " + oParam.ProductSysNo
                         + " and (EndTime>=" + Util.ToSqlString(oParam.StartTime.ToString(AppConst.DateFormatLong))
                         + " and StartTime<=" + Util.ToSqlString(oParam.EndTime.ToString(AppConst.DateFormatLong)) + ")";

            DataSet ds = SqlHelper.ExecuteDataSet(sql);

            if (Util.HasMoreRow(ds))
            {
                throw new BizException("有效的记录,相同商品,时段不能重复");
            }

            new CountdownDac().Insert(oParam);
        }
Esempio n. 25
0
        public int Insert(CountdownInfo oParam)
        {
            string sql = @"INSERT INTO Sale_Countdown
                            (
                            CreateUserSysNo, CreateTime, ProductSysNo, 
                            StartTime, EndTime, CountDownCurrentPrice, CountDownCashRebate, 
                            CountDownPoint, CountDownQty, SnapShotCurrentPrice, SnapShotCashRebate, 
                            SnapShotPoint, AffectedVirtualQty, Status, Type
                            )
                            VALUES (
                            @CreateUserSysNo, @CreateTime, @ProductSysNo, 
                            @StartTime, @EndTime, @CountDownCurrentPrice, @CountDownCashRebate, 
                            @CountDownPoint, @CountDownQty, @SnapShotCurrentPrice, @SnapShotCashRebate, 
                            @SnapShotPoint, @AffectedVirtualQty, @Status, @Type
                            );set @SysNo = SCOPE_IDENTITY();";

            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo                 = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateUserSysNo       = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateTime            = new SqlParameter("@CreateTime", SqlDbType.DateTime);
            SqlParameter paramProductSysNo          = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4);
            SqlParameter paramStartTime             = new SqlParameter("@StartTime", SqlDbType.DateTime);
            SqlParameter paramEndTime               = new SqlParameter("@EndTime", SqlDbType.DateTime);
            SqlParameter paramCountDownCurrentPrice = new SqlParameter("@CountDownCurrentPrice", SqlDbType.Decimal, 9);
            SqlParameter paramCountDownCashRebate   = new SqlParameter("@CountDownCashRebate", SqlDbType.Decimal, 9);
            SqlParameter paramCountDownPoint        = new SqlParameter("@CountDownPoint", SqlDbType.Int, 4);
            SqlParameter paramCountDownQty          = new SqlParameter("@CountDownQty", SqlDbType.Int, 4);
            SqlParameter paramSnapShotCurrentPrice  = new SqlParameter("@SnapShotCurrentPrice", SqlDbType.Decimal, 9);
            SqlParameter paramSnapShotCashRebate    = new SqlParameter("@SnapShotCashRebate", SqlDbType.Decimal, 9);
            SqlParameter paramSnapShotPoint         = new SqlParameter("@SnapShotPoint", SqlDbType.Int, 4);
            SqlParameter paramAffectedVirtualQty    = new SqlParameter("@AffectedVirtualQty", SqlDbType.Int, 4);
            SqlParameter paramStatus                = new SqlParameter("@Status", SqlDbType.Int, 4);
            SqlParameter paramType = new SqlParameter("@Type", SqlDbType.Int, 4);

            paramSysNo.Direction = ParameterDirection.Output;

            if (oParam.CreateUserSysNo != AppConst.IntNull)
            {
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            }
            else
            {
                paramCreateUserSysNo.Value = System.DBNull.Value;
            }
            if (oParam.CreateTime != AppConst.DateTimeNull)
            {
                paramCreateTime.Value = oParam.CreateTime;
            }
            else
            {
                paramCreateTime.Value = System.DBNull.Value;
            }
            if (oParam.ProductSysNo != AppConst.IntNull)
            {
                paramProductSysNo.Value = oParam.ProductSysNo;
            }
            else
            {
                paramProductSysNo.Value = System.DBNull.Value;
            }
            if (oParam.StartTime != AppConst.DateTimeNull)
            {
                paramStartTime.Value = oParam.StartTime;
            }
            else
            {
                paramStartTime.Value = System.DBNull.Value;
            }
            if (oParam.EndTime != AppConst.DateTimeNull)
            {
                paramEndTime.Value = oParam.EndTime;
            }
            else
            {
                paramEndTime.Value = System.DBNull.Value;
            }
            if (oParam.CountDownCurrentPrice != AppConst.DecimalNull)
            {
                paramCountDownCurrentPrice.Value = oParam.CountDownCurrentPrice;
            }
            else
            {
                paramCountDownCurrentPrice.Value = System.DBNull.Value;
            }
            if (oParam.CountDownCashRebate != AppConst.DecimalNull)
            {
                paramCountDownCashRebate.Value = oParam.CountDownCashRebate;
            }
            else
            {
                paramCountDownCashRebate.Value = System.DBNull.Value;
            }
            if (oParam.CountDownPoint != AppConst.IntNull)
            {
                paramCountDownPoint.Value = oParam.CountDownPoint;
            }
            else
            {
                paramCountDownPoint.Value = System.DBNull.Value;
            }
            if (oParam.CountDownQty != AppConst.IntNull)
            {
                paramCountDownQty.Value = oParam.CountDownQty;
            }
            else
            {
                paramCountDownQty.Value = System.DBNull.Value;
            }
            if (oParam.SnapShotCurrentPrice != AppConst.DecimalNull)
            {
                paramSnapShotCurrentPrice.Value = oParam.SnapShotCurrentPrice;
            }
            else
            {
                paramSnapShotCurrentPrice.Value = System.DBNull.Value;
            }
            if (oParam.SnapShotCashRebate != AppConst.DecimalNull)
            {
                paramSnapShotCashRebate.Value = oParam.SnapShotCashRebate;
            }
            else
            {
                paramSnapShotCashRebate.Value = System.DBNull.Value;
            }
            if (oParam.SnapShotPoint != AppConst.IntNull)
            {
                paramSnapShotPoint.Value = oParam.SnapShotPoint;
            }
            else
            {
                paramSnapShotPoint.Value = System.DBNull.Value;
            }
            if (oParam.AffectedVirtualQty != AppConst.IntNull)
            {
                paramAffectedVirtualQty.Value = oParam.AffectedVirtualQty;
            }
            else
            {
                paramAffectedVirtualQty.Value = System.DBNull.Value;
            }
            if (oParam.Status != AppConst.IntNull)
            {
                paramStatus.Value = oParam.Status;
            }
            else
            {
                paramStatus.Value = System.DBNull.Value;
            }
            if (oParam.Type != AppConst.IntNull)
            {
                paramType.Value = oParam.Type;
            }
            else
            {
                paramType.Value = System.DBNull.Value;
            }

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateTime);
            cmd.Parameters.Add(paramProductSysNo);
            cmd.Parameters.Add(paramStartTime);
            cmd.Parameters.Add(paramEndTime);
            cmd.Parameters.Add(paramCountDownCurrentPrice);
            cmd.Parameters.Add(paramCountDownCashRebate);
            cmd.Parameters.Add(paramCountDownPoint);
            cmd.Parameters.Add(paramCountDownQty);
            cmd.Parameters.Add(paramSnapShotCurrentPrice);
            cmd.Parameters.Add(paramSnapShotCashRebate);
            cmd.Parameters.Add(paramSnapShotPoint);
            cmd.Parameters.Add(paramAffectedVirtualQty);
            cmd.Parameters.Add(paramStatus);
            cmd.Parameters.Add(paramType);

            return(SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo));
        }
Esempio n. 26
0
        public int Update(CountdownInfo oParam)
        {
            string     sql = @"UPDATE Sale_CountDown SET 
                            CreateUserSysNo=@CreateUserSysNo, 
                            CreateTime=@CreateTime, ProductSysNo=@ProductSysNo, 
                            StartTime=@StartTime, EndTime=@EndTime, 
                            CountDownCurrentPrice=@CountDownCurrentPrice, CountDownCashRebate=@CountDownCashRebate, 
                            CountDownPoint=@CountDownPoint, CountDownQty=@CountDownQty, 
                            SnapShotCurrentPrice=@SnapShotCurrentPrice, SnapShotCashRebate=@SnapShotCashRebate, 
                            SnapShotPoint=@SnapShotPoint, AffectedVirtualQty=@AffectedVirtualQty, 
                            Status=@Status, Type=@Type
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo                 = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateUserSysNo       = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateTime            = new SqlParameter("@CreateTime", SqlDbType.DateTime);
            SqlParameter paramProductSysNo          = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4);
            SqlParameter paramStartTime             = new SqlParameter("@StartTime", SqlDbType.DateTime);
            SqlParameter paramEndTime               = new SqlParameter("@EndTime", SqlDbType.DateTime);
            SqlParameter paramCountDownCurrentPrice = new SqlParameter("@CountDownCurrentPrice", SqlDbType.Decimal, 9);
            SqlParameter paramCountDownCashRebate   = new SqlParameter("@CountDownCashRebate", SqlDbType.Decimal, 9);
            SqlParameter paramCountDownPoint        = new SqlParameter("@CountDownPoint", SqlDbType.Int, 4);
            SqlParameter paramCountDownQty          = new SqlParameter("@CountDownQty", SqlDbType.Int, 4);
            SqlParameter paramSnapShotCurrentPrice  = new SqlParameter("@SnapShotCurrentPrice", SqlDbType.Decimal, 9);
            SqlParameter paramSnapShotCashRebate    = new SqlParameter("@SnapShotCashRebate", SqlDbType.Decimal, 9);
            SqlParameter paramSnapShotPoint         = new SqlParameter("@SnapShotPoint", SqlDbType.Int, 4);
            SqlParameter paramAffectedVirtualQty    = new SqlParameter("@AffectedVirtualQty", SqlDbType.Int, 4);
            SqlParameter paramStatus                = new SqlParameter("@Status", SqlDbType.Int, 4);
            SqlParameter paramType = new SqlParameter("@Type", SqlDbType.Int, 4);

            if (oParam.SysNo != AppConst.IntNull)
            {
                paramSysNo.Value = oParam.SysNo;
            }
            else
            {
                paramSysNo.Value = System.DBNull.Value;
            }
            if (oParam.CreateUserSysNo != AppConst.IntNull)
            {
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            }
            else
            {
                paramCreateUserSysNo.Value = System.DBNull.Value;
            }
            if (oParam.CreateTime != AppConst.DateTimeNull)
            {
                paramCreateTime.Value = oParam.CreateTime;
            }
            else
            {
                paramCreateTime.Value = System.DBNull.Value;
            }
            if (oParam.ProductSysNo != AppConst.IntNull)
            {
                paramProductSysNo.Value = oParam.ProductSysNo;
            }
            else
            {
                paramProductSysNo.Value = System.DBNull.Value;
            }
            if (oParam.StartTime != AppConst.DateTimeNull)
            {
                paramStartTime.Value = oParam.StartTime;
            }
            else
            {
                paramStartTime.Value = System.DBNull.Value;
            }
            if (oParam.EndTime != AppConst.DateTimeNull)
            {
                paramEndTime.Value = oParam.EndTime;
            }
            else
            {
                paramEndTime.Value = System.DBNull.Value;
            }
            if (oParam.CountDownCurrentPrice != AppConst.DecimalNull)
            {
                paramCountDownCurrentPrice.Value = oParam.CountDownCurrentPrice;
            }
            else
            {
                paramCountDownCurrentPrice.Value = System.DBNull.Value;
            }
            if (oParam.CountDownCashRebate != AppConst.DecimalNull)
            {
                paramCountDownCashRebate.Value = oParam.CountDownCashRebate;
            }
            else
            {
                paramCountDownCashRebate.Value = System.DBNull.Value;
            }
            if (oParam.CountDownPoint != AppConst.IntNull)
            {
                paramCountDownPoint.Value = oParam.CountDownPoint;
            }
            else
            {
                paramCountDownPoint.Value = System.DBNull.Value;
            }
            if (oParam.CountDownQty != AppConst.IntNull)
            {
                paramCountDownQty.Value = oParam.CountDownQty;
            }
            else
            {
                paramCountDownQty.Value = System.DBNull.Value;
            }
            if (oParam.SnapShotCurrentPrice != AppConst.DecimalNull)
            {
                paramSnapShotCurrentPrice.Value = oParam.SnapShotCurrentPrice;
            }
            else
            {
                paramSnapShotCurrentPrice.Value = System.DBNull.Value;
            }
            if (oParam.SnapShotCashRebate != AppConst.DecimalNull)
            {
                paramSnapShotCashRebate.Value = oParam.SnapShotCashRebate;
            }
            else
            {
                paramSnapShotCashRebate.Value = System.DBNull.Value;
            }
            if (oParam.SnapShotPoint != AppConst.IntNull)
            {
                paramSnapShotPoint.Value = oParam.SnapShotPoint;
            }
            else
            {
                paramSnapShotPoint.Value = System.DBNull.Value;
            }
            if (oParam.AffectedVirtualQty != AppConst.IntNull)
            {
                paramAffectedVirtualQty.Value = oParam.AffectedVirtualQty;
            }
            else
            {
                paramAffectedVirtualQty.Value = System.DBNull.Value;
            }
            if (oParam.Status != AppConst.IntNull)
            {
                paramStatus.Value = oParam.Status;
            }
            else
            {
                paramStatus.Value = System.DBNull.Value;
            }
            if (oParam.Type != AppConst.IntNull)
            {
                paramType.Value = oParam.Type;
            }
            else
            {
                paramType.Value = System.DBNull.Value;
            }

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateTime);
            cmd.Parameters.Add(paramProductSysNo);
            cmd.Parameters.Add(paramStartTime);
            cmd.Parameters.Add(paramEndTime);
            cmd.Parameters.Add(paramCountDownCurrentPrice);
            cmd.Parameters.Add(paramCountDownCashRebate);
            cmd.Parameters.Add(paramCountDownPoint);
            cmd.Parameters.Add(paramCountDownQty);
            cmd.Parameters.Add(paramSnapShotCurrentPrice);
            cmd.Parameters.Add(paramSnapShotCashRebate);
            cmd.Parameters.Add(paramSnapShotPoint);
            cmd.Parameters.Add(paramAffectedVirtualQty);
            cmd.Parameters.Add(paramStatus);
            cmd.Parameters.Add(paramType);

            return(SqlHelper.ExecuteNonQuery(cmd));
        }
Esempio n. 27
0
 public string CheckOptionalAccessoriesInfoMsg(CountdownInfo info)
 {
     return(ObjectFactory <CountdownProcessor> .Instance.CheckOptionalAccessoriesInfoMsg(info));
 }
Esempio n. 28
0
 public void GetGrossMargin(CountdownInfo entity, out decimal GrossMargin, out decimal GrossMarginWithOutPointAndGift, out decimal GrossMarginRate, out decimal GrossMarginRateWithOutPointAndGift)
 {
     ObjectFactory <CountdownProcessor> .Instance.GetGrossMargin(entity, out GrossMargin, out GrossMarginWithOutPointAndGift, out GrossMarginRate, out GrossMarginRateWithOutPointAndGift);
 }
Esempio n. 29
0
 public CountdownInfo InterruptCountdown(CountdownInfo info)
 {
     return(ObjectFactory <CountdownProcessor> .Instance.InterruptCountdown(info));
 }
Esempio n. 30
0
 public CountdownInfo AbandonCountdown(CountdownInfo info)
 {
     return(ObjectFactory <CountdownProcessor> .Instance.AbandonCountdown(info));
 }