/// <summary> /// Retrieves a tolling letter by tolling letter ID. /// </summary> /// <param name="letterID">The ID of the tolling letter to retrieve.</param> /// <returns>The tolling letter designated by the specified ID if found; otherwise, null.</returns> public TollingLetter GetTollingLetter(int letterID) { using (Data.CPEntities context = new Data.CPEntities()) { return CreateTollingLetter(context.TollingLetters.FirstOrDefault(l => l.LetterId == letterID)); } }
/// <summary> /// Retrieves a collection of all known tolling letters. /// </summary> /// <returns>A collection of all known tolling letter.</returns> public List<TollingLetter> GetTollingLetters() { using (Data.CPEntities context = new Data.CPEntities()) { return context.TollingLetters.AsEnumerable().Select(l => CreateTollingLetter(l)).ToList(); } }
/// <summary> /// Retrieves a tolling letter by tolling codes. /// </summary> /// <param name="sourceCode">The tolling source code to match.</param> /// <param name="eventCode">The tolling event code to match.</param> /// <param name="typeCode">The tolling type code to match.</param> /// <returns>The tolling letter designated by the specified tolling codes if found; otherwise, null.</returns> public TollingLetter GetTollingLetter(string sourceCode, string eventCode, string typeCode) { using (Data.CPEntities context = new Data.CPEntities()) { return CreateTollingLetter(context.TollingLetters.FirstOrDefault(l => l.TollingSource.Code == sourceCode && l.TollingEvent.Code == eventCode && l.TollingType.Code == typeCode)); } }