1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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<DataAccessCommand> list = new List<DataAccessCommand>();
- 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<List<Object>> parametersStateR = new List<List<Object>>();
- parametersStateR.Add(new List<Object>() { "CancelTime", DateTime.Now });
- parametersStateR.Add(new List<Object>() { "CancelPerson", SalemanAccountId });
- parametersStateR.Add(new List<Object>() { "IsCancel", IsCancel });
- parametersStateR.Add(new List<Object>() { "RecordId", RecordId });
- List<SqlParameter> 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<List<Object>> parametersStateF = new List<List<Object>>();
- parametersStateF.Add(new List<Object>() { "CancelTime", DateTime.Now });
- parametersStateF.Add(new List<Object>() { "CancelPerson", SalemanAccountId });
- parametersStateF.Add(new List<Object>() { "IsCancel", IsCancel });
- parametersStateF.Add(new List<Object>() { "RecordId", RecordId });
- List<SqlParameter> 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;
- }
- }
- }
|