You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

47 lines
1.4 KiB

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("EndDate < getdate()"));
dom.EExecute();
}
}
}