public void Create(SecurityLogEntry logEntry) { _sqlObjectFactory.GetConnection().Using(c => c.Command("INSERT INTO pf_SecurityLog (SecurityLogType, UserID, TargetUserID, IP, Message, ActivityDate) VALUES (@SecurityLogType, @UserID, @TargetUserID, @IP, @Message, @ActivityDate)") .AddParameter("@SecurityLogType", logEntry.SecurityLogType) .AddParameter("@UserID", logEntry.UserID.GetObjectOrDbNull()) .AddParameter("@TargetUserID", logEntry.TargetUserID.GetObjectOrDbNull()) .AddParameter("@IP", logEntry.IP) .AddParameter("@Message", logEntry.Message) .AddParameter("@ActivityDate", logEntry.ActivityDate) .ExecuteNonQuery()); }
public void CreateLogEntry(int? userID, int? targetUserID, string ip, string message, SecurityLogType securityLogType, DateTime timeStamp) { if (ip == null) throw new ArgumentNullException("ip"); if (message == null) throw new ArgumentNullException("message"); var entry = new SecurityLogEntry { UserID = userID, TargetUserID = targetUserID, ActivityDate = timeStamp, IP = ip, Message = message, SecurityLogType = securityLogType }; _securityLogRepository.Create(entry); }