예제 #1
0
 /// <summary>
 /// 砍价活动到期:状态置为 “已结束”
 /// </summary>
 /// <param name="id"></param>
 private async void BargainTimeExpire()
 {
     //异步 改变“砍价活动状态”
     await Task.Run(() => {
         #region 结束 事务:将未支付成功的砍价全部置为“砍价失败”,原“活动已结束,砍价失败”
         List <BargainInfo> dataList = BargainBLL.SearchBargainList(new BargainSearch());
         foreach (var item in dataList)
         {
             //到期,将状态置为“已结束”
             if (DateTime.Now > item.EndDate && item.Status != (int)Bargain_Status.End)
             {
                 BargainBLL.ChangeBargainStatus(item.Id, (int)Bargain_Status.End);
             }
         }
         #endregion
     });
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CheckAdminPower("ReadBargain", PowerCheckType.Single);
         string Action = RequestHelper.GetQueryString <string>("Action");
         if (Action == "Delete")
         {
             Delete();
         }
         if (Action == "ShutDown")
         {
             ShutDown();
         }
         List <BargainInfo> dataList = BargainBLL.SearchBargainList(CurrentPage, PageSize, new BargainSearch(), ref Count);
         foreach (var bargain in dataList)
         {
             int total_bargain = 0;
             //到期,将状态置为“已结束”
             if (DateTime.Now > bargain.EndDate && bargain.Status != (int)Bargain_Status.End)
             {
                 //异步 改变“砍价活动状态”
                 TimeExpire(bargain.Id);
             }
             var bargainDetails = BargainDetailsBLL.ReadByBargainId(bargain.Id);
             foreach (var bdt in bargainDetails)
             {
                 var bargain_orders = BargainOrderBLL.SearchBargainOrderList(new BargainOrderSearch {
                     BargainDetailsId = bdt.Id
                 });
                 foreach (var bo in bargain_orders)
                 {
                     total_bargain += RecordingBLL.SearchRecordingList(new RecordingSearch {
                         BOrderId = bo.Id
                     }).Where(k => k.UserId > 0).Count();
                 }
             }
             //本次砍价总砍次数
             bargain.Bargain_Records_Total = total_bargain;
         }
         BindControl(dataList, RecordList, MyPager);
     }
 }