Exemplo n.º 1
0
        public static DataTable GetCountDownSkuTable(int countDownId, int productId, int storeId = 0)
        {
            DataTable skusByProductIdNew = ProductHelper.GetSkusByProductIdNew(productId);
            DataTable countDownSkus      = new CountDownDao().GetCountDownSkus(countDownId, storeId, false);

            if (skusByProductIdNew.Rows.Count > 0)
            {
                skusByProductIdNew.Columns.Add("CountDownId", typeof(int));
                skusByProductIdNew.Columns.Add("CountDownSkuId", typeof(int));
                skusByProductIdNew.Columns.Add("CountDownSalePrice", typeof(decimal));
                skusByProductIdNew.Columns.Add("CountDownTotalCount", typeof(int));
                skusByProductIdNew.Columns.Add("CountDownBoughtCount", typeof(int));
            }
            for (int i = 0; i < skusByProductIdNew.Rows.Count; i++)
            {
                DataRow   dataRow = skusByProductIdNew.Rows[i];
                DataRow[] array   = countDownSkus.Select(string.Format("SkuId='{0}' AND CountDownId={1}", dataRow["SkuId"], countDownId));
                if (array.Length != 0)
                {
                    dataRow["CountDownId"]          = countDownId;
                    dataRow["CountDownSkuId"]       = array[0]["CountDownSkuId"].ToString();
                    dataRow["CountDownSalePrice"]   = array[0]["SalePrice"].ToDecimal(0);
                    dataRow["CountDownTotalCount"]  = array[0]["TotalCount"].ToInt(0);
                    dataRow["CountDownBoughtCount"] = array[0]["BoughtCount"].ToInt(0);
                }
            }
            return(skusByProductIdNew);
        }
Exemplo n.º 2
0
        public static CountDownInfo ActiveCountDownByProductId(int productId, int storeId = 0)
        {
            CountDownInfo countDownInfo = new CountDownDao().ActiveCountDownByProductId(productId);

            if (countDownInfo != null && SettingsManager.GetMasterSettings().OpenMultStore&& !StoreActivityHelper.JoinActivity(countDownInfo.CountDownId, 2, storeId, countDownInfo.StoreType))
            {
                countDownInfo = null;
            }
            return(countDownInfo);
        }
Exemplo n.º 3
0
        public static void AddCountDown(CountDownInfo countDownInfo, IEnumerable <CountDownSkuInfo> countDownSkus)
        {
            bool         flag         = PromoteHelper.ProcessStoreType(countDownInfo);
            CountDownDao countDownDao = new CountDownDao();

            countDownInfo.DisplaySequence = countDownDao.GetMaxDisplaySequence <CountDownInfo>();
            int num = new CountDownDao().AddCountDown(countDownInfo, countDownSkus);

            if (num > 0 & flag)
            {
                StoreActivityHelper.SaveStoreActivity(countDownInfo.StoreIds, num, 2);
            }
        }
Exemplo n.º 4
0
        public static CountDownInfo GetCountDownInfo(int countDownID, int buyAmount, out string msg)
        {
            msg = "";
            CountDownInfo countDownInfo = new CountDownDao().GetCountDownInfo(countDownID);

            if (countDownInfo == null)
            {
                msg = "抢购信息不存在!";
                return(null);
            }
            if (((countDownInfo.MaxCount < buyAmount) || (countDownInfo.StartDate > DateTime.Now)) || (countDownInfo.EndDate < DateTime.Now))
            {
                msg = "抢购还没有开始或者已经结束,或者数量超过了抢购数量";
                return(null);
            }
            return(countDownInfo);
        }
Exemplo n.º 5
0
        public static CountDownInfo GetCountDownInfo(int countDownId, int storeId = 0)
        {
            CountDownInfo countDownInfo = new CountDownDao().Get <CountDownInfo>(countDownId);

            if (countDownInfo != null)
            {
                if (SettingsManager.GetMasterSettings().OpenMultStore)
                {
                    countDownInfo.IsJoin = StoreActivityHelper.JoinActivity(countDownInfo.CountDownId, 2, storeId, countDownInfo.StoreType);
                }
                else
                {
                    countDownInfo.IsJoin = true;
                }
                countDownInfo.CountDownSkuInfo = PromoteHelper.GetCountDownSkus(countDownId, countDownInfo.ProductId, storeId, SettingsManager.GetMasterSettings().OpenMultStore);
            }
            return(countDownInfo);
        }