public static void InsertTxnDataLog_DB(string connectionName, int dbIndex, EnumMsgCategory Category, string Action, string KeyValue1, string KeyValue2, string TxnId, string ErrorCode, string ErrorDescr, EnumMsgState State, string Comment) { string strSQL = @"if not Exists (select * from TxnDataLog where [Action]=@Action and [KeyValue1]=@KeyValue1 and [TxnId]=@TxnId and [Category]=@Category) BEGIN INSERT INTO TxnDataLog ([Category],[Action],[KeyValue1],[KeyValue2],[TxnId], [ErrorCode],[ErrorDescr],[State],[Comment],[Cdt]) VALUES (@Category,@Action,@KeyValue1,@KeyValue2,@TxnId, @ErrorCode,@ErrorDescr,@State,@Comment,GETDATE()) END"; SQLHelper.ExecuteNonQuery(SQLHelper.GetDBConnectionString(connectionName, dbIndex), System.Data.CommandType.Text, strSQL, SQLHelper.CreateSqlParameter("@Category", 16, Category.ToString().Trim()), SQLHelper.CreateSqlParameter("@Action", 32, Action), SQLHelper.CreateSqlParameter("@KeyValue1", 32, KeyValue1), SQLHelper.CreateSqlParameter("@KeyValue2", 32, KeyValue2), SQLHelper.CreateSqlParameter("@TxnId", 40, TxnId), SQLHelper.CreateSqlParameter("@ErrorCode", 32, ErrorCode), SQLHelper.CreateSqlParameter("@ErrorDescr", 255, ErrorDescr), SQLHelper.CreateSqlParameter("@State", 16, State.ToString().Trim()), SQLHelper.CreateSqlParameter("@Comment", 255, Comment)); }
public static void InsertCancelBindDNLog(string connectionDB, int dbIndex, string SerialNumber, string Plant, string DN, string Remark1, string Remark2, EnumMsgCategory Category, EnumMsgState State, string ErrorDescr, string Editor) { Remark1 = (Remark1 == null ? "" : Remark1); Remark2 = (Remark2 == null ? "" : Remark2); string strSQL = @"insert into CancelBindDNLog(Action, SerialNumber, Plant, DN, Remark1, Remark2, State, ErrorDescr, Editor, Cdt) values (@Category, @SerialNumber, @Plant, @DN, @Remark1, @Remark2, @State, @ErrorDescr, @Editor, @Now) "; //SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString_HISTORY(1), SQLHelper.ExecuteNonQuery(SQLHelper.GetDBConnectionString(connectionDB, dbIndex), System.Data.CommandType.Text, strSQL, SQLHelper.CreateSqlParameter("@Category", 10, Category.ToString().Trim()), SQLHelper.CreateSqlParameter("@SerialNumber", 25, SerialNumber), SQLHelper.CreateSqlParameter("@Plant", 4, Plant), SQLHelper.CreateSqlParameter("@DN", 10, DN), SQLHelper.CreateSqlParameter("@Remark1", 25, Remark1), SQLHelper.CreateSqlParameter("@Remark2", 25, Remark2), SQLHelper.CreateSqlParameter("@State", 16, State.ToString().Trim()), SQLHelper.CreateSqlParameter("@ErrorDescr", 255, ErrorDescr), SQLHelper.CreateSqlParameter("@Editor", 20, Editor), SQLHelper.CreateSqlParameter("@Now", DateTime.Now)); }
public static void InsertTxnDataLog( EnumMsgCategory Category, string Action, string KeyValue1, string KeyValue2, string TxnId, string ErrorCode, string ErrorDescr, EnumMsgState State, string Comment) { string strSQL = @"INSERT INTO TxnDataLog ([Category],[Action],[KeyValue1],[KeyValue2],[TxnId], [ErrorCode],[ErrorDescr],[State],[Comment],[Cdt]) VALUES (@Category,@Action,@KeyValue1,@KeyValue2,@TxnId, @ErrorCode,@ErrorDescr,@State,@Comment,GETDATE()) "; SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString_CFG(), System.Data.CommandType.Text, strSQL, SQLHelper.CreateSqlParameter("@Category", 16, Category.ToString().Trim()), SQLHelper.CreateSqlParameter("@Action", 32, Action), SQLHelper.CreateSqlParameter("@KeyValue1", 32, KeyValue1), SQLHelper.CreateSqlParameter("@KeyValue2", 32, KeyValue2), SQLHelper.CreateSqlParameter("@TxnId", 32, TxnId), SQLHelper.CreateSqlParameter("@ErrorCode", 32, ErrorCode), SQLHelper.CreateSqlParameter("@ErrorDescr", 255, ErrorDescr), SQLHelper.CreateSqlParameter("@State", 16, State.ToString().Trim()), SQLHelper.CreateSqlParameter("@Comment", 255, Comment)); }
public static void UpdateSendDataAndInsertLog(EnumMsgCategory Category, string action, string key1, string key2, string txnId, string errorCode, string errorDescr, EnumMsgState state, DateTime udt) { string strSQL = @"UPDATE SendData SET State =@State, Udt =@now, ErrorCode =@ErrorCode, ErrorDescr=@ErrorDescr WHERE Action =@Action AND TxnId =@TxnId INSERT INTO TxnDataLog(Category, Action, KeyValue1, KeyValue2, TxnId, ErrorCode, ErrorDescr, State, Comment, Cdt) VALUES(@Category, @Action, @KeyValue1, @KeyValue2, @TxnId, @ErrorCode,@ErrorDescr, @State, '', @now)"; SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString_CFG(), System.Data.CommandType.Text, strSQL, SQLHelper.CreateSqlParameter("@Action", 32, action), SQLHelper.CreateSqlParameter("@KeyValue1", 32, key1), SQLHelper.CreateSqlParameter("@KeyValue2", 32, key2), SQLHelper.CreateSqlParameter("@TxnId", 32, txnId), SQLHelper.CreateSqlParameter("@State", 32, state.ToString().Trim()), SQLHelper.CreateSqlParameter("@now", udt), SQLHelper.CreateSqlParameter("@Category", 32, Category.ToString().Trim()), SQLHelper.CreateSqlParameter("@ErrorCode", 32, errorCode), SQLHelper.CreateSqlParameter("@ErrorDescr", 255, errorDescr)); }
public static void InsertSendDataAndLog(EnumMsgCategory Category, string action, string key1, string key2, string txnId, EnumMsgState state, DateTime udt) { string strSQL = @"INSERT INTO SendData(Action, KeyValue1, KeyValue2, TxnId, ErrorCode, ErrorDescr, State, ResendCount, Comment, Cdt,Udt) VALUES(@Action, @KeyValue1, @KeyValue2, @TxnId, '', '', @State, 0, '', @now,@now) INSERT INTO TxnDataLog(Category, Action, KeyValue1, KeyValue2, TxnId, ErrorCode, ErrorDescr, State, Comment, Cdt) VALUES(@Category, @Action, @KeyValue1, @KeyValue2, @TxnId, '','', @State, '', @now)"; SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString_CFG(), System.Data.CommandType.Text, strSQL, SQLHelper.CreateSqlParameter("@Action", 32, action), SQLHelper.CreateSqlParameter("@KeyValue1", 32, key1), SQLHelper.CreateSqlParameter("@KeyValue2", 32, key2), SQLHelper.CreateSqlParameter("@TxnId", 32, txnId), SQLHelper.CreateSqlParameter("@State", 32, state.ToString().Trim()), SQLHelper.CreateSqlParameter("@now", udt), SQLHelper.CreateSqlParameter("@Category", 32, Category.ToString().Trim())); }