using Common.Wechat; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Text; using ZcPeng.PublicLibrary; namespace CoreEntity.TimeJob { public class CancelTask { public static int CancelRecord(string RecordId,out string result) { List list = new List(); string IsCancel = "1"; string SalemanAccountId = "1"; #region 更新记录状态 string commandTextStateR = "UPDATE " + Config.TablePrefix + "PushRecord " + " SET CancelTime = @CancelTime, " + " CancelPerson = @CancelPerson, " + " IsCancel = @IsCancel" + " WHERE Id = @RecordId " + " and (state IS NULL or state = 0) or state in(2) " + " and IsCancel = " + (IsCancel == "1" ? "0" : "1") ; //string resultStateR; //准备参数 List> parametersStateR = new List>(); parametersStateR.Add(new List() { "CancelTime", DateTime.Now }); parametersStateR.Add(new List() { "CancelPerson", SalemanAccountId }); parametersStateR.Add(new List() { "IsCancel", IsCancel }); parametersStateR.Add(new List() { "RecordId", RecordId }); List parametersStateR1 = DataAccess.ToParameters(parametersStateR); list.Add(new DataAccessCommand(commandTextStateR, parametersStateR1, CommandType.Text, true)); #endregion #region 更新明细状态 string commandTextStateF = "UPDATE " + Config.TablePrefix + "PushFeedback " + " SET CancelTime = @CancelTime, " + " CancelPerson = @CancelPerson, " + " IsCancel = @IsCancel" + " WHERE PushRecordId = @RecordId " + " and (state IS NULL or state = 0 or state in(5,6))" + " and IsCancel = " + (IsCancel == "1" ? "0" : "1") ; //string resultStateF; //准备参数 List> parametersStateF = new List>(); parametersStateF.Add(new List() { "CancelTime", DateTime.Now }); parametersStateF.Add(new List() { "CancelPerson", SalemanAccountId }); parametersStateF.Add(new List() { "IsCancel", IsCancel }); parametersStateF.Add(new List() { "RecordId", RecordId }); List parametersStateF1 = DataAccess.ToParameters(parametersStateF); list.Add(new DataAccessCommand(commandTextStateF, parametersStateF1, CommandType.Text, true)); #endregion bool success = DataAccess.ExecuteBatchCommands(list, out result); if (success) return 1; else return 0; } } }