using System; using System.Collections.Generic; using System.Linq; using System.Text; using Forks.EnterpriseServices.BusinessInterfaces; using TSingSoft.WebPluginFramework.Install; namespace BWP.B3_YunKen.DataPatchs { [DataPatch] public class UpdateCustomerStartedTime : IDataPatch { public void Execute(TransactionContext context) { var sql = @"update a set a.StartedTime = (case when (select Max(LoadTime) from B3Sale_CustomerAccept b where b.CustomerDealer_ID = a.ID and BillState = 20) is null then a.CreateTime else (select Max(LoadTime) from B3Sale_CustomerAccept b where b.CustomerDealer_ID = a.ID and BillState = 20) end) from B3Sale_Customer a where IsDealers = 1"; context.Session.ExecuteSqlNonQuery(sql); } } }