/// <summary> /// Add a LogEntry to the database /// </summary> /// <param name="entry">The LogEntry to add</param> public static bool AddLogEntry(LogEntry entry) { using (var context = new OOADEntities()) { logEntry dbEntry = new logEntry(); dbEntry.jobId = entry.JobId; dbEntry.state = entry.State.ToString(); dbEntry.timeStamp = entry.TimeStamp; //If the user doesn't exist in the db, we'll get a NPE try { dbEntry.userId = entry.JobOwner.Id; } catch (NullReferenceException) { return false; } context.logEntries.AddObject(dbEntry); context.SaveChanges(); return true; } }
/// <summary> /// Create a new logEntry object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="jobId">Initial value of the jobId property.</param> /// <param name="userId">Initial value of the userId property.</param> /// <param name="timeStamp">Initial value of the timeStamp property.</param> /// <param name="state">Initial value of the state property.</param> public static logEntry CreatelogEntry(global::System.Int32 id, global::System.Int32 jobId, global::System.Int32 userId, global::System.DateTime timeStamp, global::System.String state) { logEntry logEntry = new logEntry(); logEntry.id = id; logEntry.jobId = jobId; logEntry.userId = userId; logEntry.timeStamp = timeStamp; logEntry.state = state; return logEntry; }
/// <summary> /// Deprecated Method for adding a new object to the logEntries EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTologEntries(logEntry logEntry) { base.AddObject("logEntries", logEntry); }