Browse Source

add task

master
wugang 8 years ago
parent
commit
d6b713200b
1 changed files with 47 additions and 0 deletions
  1. +47
    -0
      BWP.B3_YunKen/TimerTask/StoppedCarrier.cs

+ 47
- 0
BWP.B3_YunKen/TimerTask/StoppedCarrier.cs View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Threading;
using BWP.B3Frameworks;
using BWP.B3Frameworks.BL;
using BWP.B3Frameworks.BO;
using BWP.B3Frameworks.Utils;
using BWP.B3Sale.BL;
using BWP.B3Sale.BO;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using TSingSoft.WebPluginFramework;
using TSingSoft.WebPluginFramework.TimerTasks;
namespace BWP.B3_YunKen.TimerTask {
public class StoppedCarrierTask : ITimerTask {
public string Name { get { return "耘垦停用【承运方】,当前时间超过合同结束时间自动停用"; } }
volatile static object _lockObj = new object();
public void Execute() {
if (!Monitor.TryEnter(_lockObj)) {
throw new SameTaskNotFinishException(this);
}
try {
DoExecute();
} finally {
Monitor.Exit(_lockObj);
}
}
private void DoExecute() {
var mDmoTypeID = DmoTypeIDAttribute.GetID(typeof(Customer));
var dom = new DQUpdateDom(typeof(Carrier));
dom.Columns.Add(new DQUpdateColumn("Stopped", true));
dom.Columns.Add(new DQUpdateColumn("RowVersion",DQExpression.Add(DQExpression.Field("RowVersion"),DQExpression.Value(1))));
dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false));
dom.Where.Conditions.Add(DQExpression.Snippet("cast(EndDateStr as datetime) < getdate()"));
dom.EExecute();
}
}
}

Loading…
Cancel
Save