protected bool WriteLog(String oldVal, String newVal, DTUUser user, String action, String table, SqlTransaction transaction) { SqlCommand cmd = new SqlCommand(); cmd.Transaction = transaction; cmd.Connection = transaction.Connection; SequencesDAO seqDAO = DAOFactory.GetInstance().CreateSequencesDAO(); int logID = seqDAO.GetNextSequenceByName(Sequence.SEQUENCE_LOGID, transaction); if (user == null) cmd.CommandText = "insert into EFilingLog(LogID, LogTime, OldValue, newValue, [Action], [Table]) values( @LogID , getDate(), @OldValue, @NewValue,@Action, @Table)"; else { cmd.CommandText = "insert into EFilingLog(LogID, LogTime, OldValue, newValue, [Action], [Table], [User]) values( @LogID , getDate(), @OldValue, @NewValue,@Action, @Table, @User)"; cmd.Parameters.Add(GenParameter("@User", SqlDbType.Int, 10, user.FileID)); } cmd.Parameters.Add(GenParameter("@LogID", SqlDbType.Int, 10, logID)); cmd.Parameters.Add(GenParameter("@OldValue", SqlDbType.NVarChar, 4000, oldVal)); cmd.Parameters.Add(GenParameter("@NewValue", SqlDbType.NVarChar, 4000, newVal)); cmd.Parameters.Add(GenParameter("@Action", SqlDbType.NVarChar, 50, action)); cmd.Parameters.Add(GenParameter("@Table", SqlDbType.NVarChar, 255, table)); try { cmd.ExecuteNonQuery(); cmd.Dispose(); } catch (Exception e) { cmd.Dispose(); return false; } return true; }
public override bool Audit(Object oldVal, Object newVal, DTUUser user, String action, SqlTransaction transaction) { return false; }
public abstract bool Audit(Object oldValue, Object newValue, DTUUser user, String action, SqlTransaction transaction);