Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["countDownId"], out this.countDownId))
     {
         base.GotoResourceNotFound();
     }
     else if (SettingsManager.GetMasterSettings().OpenMultStore)
     {
         CountDownInfo    countDownInfo  = PromoteHelper.GetCountDownInfo(this.countDownId, 0);
         List <StoreBase> activityStores = StoreActivityHelper.GetActivityStores(countDownInfo.CountDownId, 2, countDownInfo.StoreType);
         this.ddlStores.DataSource = activityStores;
         this.ddlStores.DataBind();
         this.ddlStores.Items.Insert(0, new ListItem
         {
             Text  = "请选择",
             Value = "-1"
         });
         this.pnlStoreDetail.Visible = true;
         this.ltStoreNames.Text      = string.Format("已参加活动门店({0}家):{1}", activityStores.Count, (from t in activityStores
                                                                                                 select t.StoreName).Aggregate((string t, string n) => t + "、" + n));
         this.hidOpenMultStore.Value = "1";
     }
     else
     {
         this.hidOpenMultStore.Value = "0";
         this.pnlStoreDetail.Visible = false;
     }
 }
Esempio n. 2
0
 public static void EditCountDown(CountDownInfo countDownInfo, IEnumerable <CountDownSkuInfo> countDownSkus)
 {
     if (PromoteHelper.ProcessStoreType(countDownInfo))
     {
         StoreActivityHelper.SaveStoreActivity(countDownInfo.StoreIds, countDownInfo.CountDownId, 2);
     }
     new CountDownDao().EditCountDown(countDownInfo, countDownSkus);
 }
Esempio 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);
            }
        }
Esempio n. 4
0
        private void BindCountDown()
        {
            CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(this.countDownId, 0);

            if (countDownInfo.StartDate <= DateTime.Now && countDownInfo.EndDate > DateTime.Now)
            {
                this.aChoiceProduct.Visible = false;
                this.CPStartTime.Enabled    = false;
            }
            DataTable countDownSkus = PromoteHelper.GetCountDownSkus(this.countDownId, 0, false);

            if (SettingsManager.GetMasterSettings().OpenMultStore)
            {
                List <StoreBase> activityStores = StoreActivityHelper.GetActivityStores(this.countDownId, 2, countDownInfo.StoreType);
                this.hidStoreIds.Value = (from t in activityStores
                                          select t.StoreId.ToString()).Aggregate((string t, string n) => t + "," + n);
            }
            else
            {
                this.hidStoreIds.Value = "";
            }
            int num = 0;

            if (countDownSkus.Rows.Count == 1)
            {
                DataRow dataRow = countDownSkus.Rows[0];
                this.txtPrice.Text      = dataRow["SalePrice"].ToDecimal(0).F2ToString("f2");
                this.txtTotalCount.Text = dataRow["TotalCount"].ToNullString();
                num = dataRow["BoughtCount"].ToInt(0);
            }
            else
            {
                for (int i = 0; i < countDownSkus.Rows.Count; i++)
                {
                    num += countDownSkus.Rows[i]["BoughtCount"].ToInt(0);
                }
            }
            this.txtContent.Text          = Globals.HtmlDecode(countDownInfo.Content);
            this.txtMaxCount.Text         = Convert.ToString(countDownInfo.MaxCount);
            this.ltBoughtCount.Text       = num.ToString();
            this.CPEndDate.SelectedDate   = countDownInfo.EndDate;
            this.CPStartTime.SelectedDate = countDownInfo.StartDate;
            this.txtShareDetails.Text     = countDownInfo.ShareDetails;
            this.txtShareTitle.Text       = countDownInfo.ShareTitle;
            this.hidUploadLogo.Value      = countDownInfo.ShareIcon;
        }
Esempio n. 5
0
        public static List <StoreBaseEntity> GetRecomStoreByCountdownProductId(StoreEntityQuery query)
        {
            List <StoreBaseEntity> result = new List <StoreBaseEntity>();

            if (query.Position.Latitude == 0.0 || query.Position.Longitude == 0.0)
            {
                return(result);
            }
            List <StoreBase>     activityStores = StoreActivityHelper.GetActivityStores(query.ActivityId, 2, query.TagId);
            IEnumerable <string> source         = from t in activityStores
                                                  select t.StoreId.ToString();

            Func <string, string, string> func = (string t, string n) => t + "," + n;
            string          text2           = query.Key = source.Aggregate(func);
            StoreProductDao storeProductDao = new StoreProductDao();

            return(storeProductDao.GetRecomStoreByCountdownProductId(query));
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["activityId"], out this.activityId))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         this.btnSave.Click += this.btnSave_Click;
         if (!this.Page.IsPostBack)
         {
             PromotionInfo promotion = PromoteHelper.GetPromotion(this.activityId);
             this.promotionView.Promotion = promotion;
             if (SettingsManager.GetMasterSettings().OpenMultStore)
             {
                 List <StoreBase> activityStores = StoreActivityHelper.GetActivityStores(this.activityId, 1, promotion.StoreType);
                 if (activityStores.Count > 0)
                 {
                     this.hidStoreIds.Value = (from t in activityStores
                                               select t.StoreId.ToString()).Aggregate((string t, string n) => t + "," + n);
                 }
             }
             else
             {
                 this.hidStoreIds.Value = "";
             }
             this.txtPromoteType.Text = ((int)promotion.PromoteType).ToString();
             if (promotion.PromoteType == PromoteType.FullQuantityDiscount || promotion.PromoteType == PromoteType.FullQuantityReduced)
             {
                 this.radPromoteType.IsWholesale = true;
                 this.txtCondition.Text          = promotion.Condition.ToString("F0");
             }
             else
             {
                 this.txtCondition.Text = promotion.Condition.F2ToString("f2");
             }
             this.txtDiscountValue.Text = promotion.DiscountValue.F2ToString("f2");
             if (!string.IsNullOrEmpty(promotion.GiftIds))
             {
                 this.BindPromotionGifts(promotion);
             }
         }
     }
 }
Esempio n. 8
0
        public static int AddPromotion(PromotionInfo promotion, bool IsMobileExclusive = false)
        {
            bool     flag     = PromoteHelper.ProcessStoreType4PromotionInfo(promotion);
            Database database = DatabaseFactory.CreateDatabase();

            using (DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    PromotionDao promotionDao = new PromotionDao();
                    int          num          = (int)promotionDao.Add(promotion, null);
                    if (num <= 0)
                    {
                        dbTransaction.Rollback();
                        return(-1);
                    }
                    if (flag)
                    {
                        StoreActivityHelper.SaveStoreActivity(promotion.StoreIds, num, 1);
                    }
                    if (!IsMobileExclusive && !promotionDao.AddPromotionMemberGrades(num, promotion.MemberGradeIds, dbTransaction))
                    {
                        dbTransaction.Rollback();
                        return(-2);
                    }
                    dbTransaction.Commit();
                    return(num);
                }
                catch (Exception)
                {
                    dbTransaction.Rollback();
                    return(0);
                }
                finally
                {
                    dbConnection.Close();
                }
            }
        }
Esempio n. 9
0
        protected override void OnInit(EventArgs e)
        {
            if (this.SkinName == null)
            {
                this.SkinName = "Skin-ServiceProductSubmitOrder.html";
            }
            base.OnInit(e);
            string urlToEncode = "";

            this.from          = this.Page.Request.QueryString["from"].ToNullString().ToLower();
            this.productSku    = Globals.UrlDecode(this.Page.Request.QueryString["productSku"].ToNullString());
            this.buyAmount     = this.Page.Request.QueryString["buyAmount"].ToInt(0);
            this.storeId       = this.Page.Request.QueryString["StoreId"].ToInt(0);
            this.chooseStoreId = this.Page.Request.QueryString["ChooseStoreId"].ToInt(0);
            if (this.from == "groupbuy")
            {
                this.isGroupBuy = true;
            }
            else if (this.from == "countdown")
            {
                this.isCountDown = true;
            }
            else if (this.from == "fightgroup")
            {
                this.isFightGroup = true;
            }
            else
            {
                if (this.from == "presale")
                {
                    this.PresaleId  = this.Page.Request.QueryString["PresaleId"].ToInt(0);
                    this.productSku = DataHelper.CleanSearchString(this.productSku);
                    if (this.CheckPresaleInfo())
                    {
                        this.isPreSale = true;
                        goto IL_01cd;
                    }
                    return;
                }
                this.from = "serviceproduct";
            }
            goto IL_01cd;
IL_01cd:
            if (this.storeId == 0 && !HiContext.Current.SiteSettings.OpenMultStore)
            {
                this.cart = ShoppingCartProcessor.GetShoppingCart(this.from, this.productSku, this.buyAmount, 0, true, -1, this.Page.Request["fightGroupActivityId"].ToInt(0));
            }
            else
            {
                this.cart = ShoppingCartProcessor.GetShoppingCart(this.from, this.productSku, this.buyAmount, 0, true, this.storeId, this.Page.Request["fightGroupActivityId"].ToInt(0));
            }
            if (this.cart == null)
            {
                string msg = "购物车无任何商品!";
                this.hasError = true;
                this.ShowWapMessage(msg, "default.aspx");
            }
            else
            {
                if (this.isGroupBuy)
                {
                    this.groupbuyInfo = TradeHelper.GetProductGroupBuyInfo(this.cart.LineItems[0].ProductId, this.buyAmount, out urlToEncode);
                    if (this.groupbuyInfo == null)
                    {
                        this.hasError = true;
                        this.ShowWapMessage(Globals.UrlEncode(urlToEncode), "default.aspx");
                        return;
                    }
                }
                if (this.isCountDown)
                {
                    this.countdownInfo = TradeHelper.ProductExistsCountDown(this.cart.LineItems[0].ProductId, "", this.storeId);
                    if (this.countdownInfo == null)
                    {
                        this.hasError = true;
                        this.ShowWapMessage("该商品未进行抢购活动,或者活动已结束", "Default.aspx");
                        return;
                    }
                    if (!StoreActivityHelper.JoinActivity(this.countdownInfo.CountDownId, 2, this.storeId, this.countdownInfo.StoreType))
                    {
                        this.hasError = true;
                        this.ShowWapMessage("该门店未参与此抢购活动", "Default.aspx");
                        return;
                    }
                    this.countdownInfo = TradeHelper.CheckUserCountDown(this.cart.LineItems[0].ProductId, this.countdownInfo.CountDownId, this.cart.LineItems[0].SkuId, HiContext.Current.UserId, this.buyAmount, "", out urlToEncode, this.storeId);
                    if (this.countdownInfo == null)
                    {
                        this.ShowWapMessage(Globals.UrlEncode(urlToEncode), "Default.aspx");
                        return;
                    }
                }
                if (this.isFightGroup)
                {
                    this.fightGroupActivitiyInfo = TradeHelper.GetFightGroupActivitieInfo(this.Page.Request["fightGroupActivityId"].ToInt(0));
                    if (this.fightGroupActivitiyInfo == null)
                    {
                        this.hasError = true;
                        this.ShowWapMessage("拼团活动不存在", "Default.aspx");
                    }
                    else
                    {
                        int num = this.Page.Request["fightGroupId"].ToInt(0);
                        this.fightGroupInfo = VShopHelper.GetFightGroup(num);
                        if (this.fightGroupInfo == null && num != 0)
                        {
                            this.hasError = true;
                            this.ShowWapMessage("拼团活动不存在", "Default.aspx");
                        }
                    }
                }
            }
        }
Esempio n. 10
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);
        }