/// <summary> /// 到期:状态置为 “已结束” /// </summary> /// <param name="id"></param> private async void TimeExpire(int id) { await Task.Run(() => { #region 结束 事务:将未支付成功的砍价全部置为“砍价失败”,原“活动已结束,砍价失败” BargainBLL.ChangeBargainStatus(id, (int)Bargain_Status.End); #endregion }); }
/// <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 }); }
/// <summary> /// 关闭 /// </summary> private void ShutDown() { int id = RequestHelper.GetQueryString <int>("ID"); if (id > 0) { var bargain = BargainBLL.ReadBargain(id); if (bargain.Id > 0 && bargain.Status != 0) { #region 关闭 事务:将未支付成功的砍价全部置为“砍价失败”,原“活动已取消,砍价失败” BargainBLL.ChangeBargainStatus(id, (int)Bargain_Status.ShutDown); #endregion //Dictionary<string, object> dict = new Dictionary<string, object>(); //dict.Add("[Status]", 0); //BargainBLL.UpdatePart("[Bargain]", dict, id); } else { ScriptHelper.Alert("操作不合法"); } } }
/// <summary> /// 关闭“砍价活动” /// </summary> /// <param name="id"></param> private async void ShutDownBargain(int id) { await Task.Run(() => { BargainBLL.ChangeBargainStatus(id, (int)Bargain_Status.ShutDown); }); }