| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using GreenTree.Nachtragsmanagement.Core.Data;
- using GreenTree.Nachtragsmanagement.Core.Domain.Misc;
- namespace GreenTree.Nachtragsmanagement.Services.Misc
- {
- public class MiscService : IMiscService
- {
- #region Fields
- private readonly IRepository<MailNotification> _mailNotificationRepository;
- private readonly IRepository<NotificationEvent> _notificationEventRepository;
- private readonly IRepository<NotificationEventType> _notificationEventTypeRepository;
- #endregion
- #region Ctor
- /// <summary>
- /// Initializes a new instance of the MiscService class
- /// </summary>
- public MiscService(
- IRepository<MailNotification> mailNotificationRepository,
- IRepository<NotificationEvent> notificationEventRepository,
- IRepository<NotificationEventType> notificationEventTypeRepository)
- {
- _mailNotificationRepository = mailNotificationRepository;
- _notificationEventRepository = notificationEventRepository;
- _notificationEventTypeRepository = notificationEventTypeRepository;
- }
- #endregion
- #region MailNotification
- /// <summary>
- /// Gets all mailNotifications
- /// </summary>
- public IList<MailNotification> GetAllMailNotifications()
- {
- return _mailNotificationRepository.Table.ToList();
- }
- /// <summary>
- /// Gets a mailNotification by specified Id
- /// </summary>
- /// <param name="id">MailNotification identifier.</param>
- public MailNotification GetMailNotificationById(int id)
- {
- return _mailNotificationRepository.GetById(id);
- }
- /// <summary>
- /// Gets all mailNotifications to the specified ids
- /// </summary>
- public IList<MailNotification> GetMailNotificationsByIds(int[] ids)
- {
- return _mailNotificationRepository.Table
- .Where(u => ids.Contains(u.Id))
- .ToList();
- }
- /// <summary>
- /// Insert a mailNotification
- /// </summary>
- /// <param name="mailNotification">MailNotification.</param>
- public void InsertMailNotification(MailNotification mailNotification)
- {
- _mailNotificationRepository.Insert(mailNotification);
- }
- /// <summary>
- /// Update a mailNotification
- /// </summary>
- /// <param name="mailNotification">MailNotification.</param>
- public void UpdateMailNotification(MailNotification mailNotification)
- {
- _mailNotificationRepository.Update(mailNotification);
- }
- /// <summary>
- /// Delete a mailNotification
- /// </summary>
- /// <param name="mailNotification">MailNotification.</param>
- public void DeleteMailNotification(MailNotification mailNotification)
- {
- _mailNotificationRepository.Delete(mailNotification);
- }
- #endregion
- #region NotificationEvent
- /// <summary>
- /// Gets all notificationEvents
- /// </summary>
- public IList<NotificationEvent> GetAllNotificationEvents()
- {
- return _notificationEventRepository.Table.ToList();
- }
- /// <summary>
- /// Gets a notificationEvent by specified Id
- /// </summary>
- /// <param name="id">NotificationEvent identifier.</param>
- public NotificationEvent GetNotificationEventById(int id)
- {
- return _notificationEventRepository.GetById(id);
- }
- /// <summary>
- /// Gets all notificationEvents to the specified ids
- /// </summary>
- public IList<NotificationEvent> GetNotificationEventsByIds(int[] ids)
- {
- return _notificationEventRepository.Table
- .Where(r => ids.Contains(r.Id))
- .ToList();
- }
- /// <summary>
- /// Insert a mailNotification
- /// </summary>
- /// <param name="notificationEvent">NotificationEvent.</param>
- public void InsertNotificationEvent(NotificationEvent notificationEvent)
- {
- _notificationEventRepository.Insert(notificationEvent);
- }
- /// <summary>
- /// Update a notificationEvent
- /// </summary>
- /// <param name="notificationEvent">NotificationEvent.</param>
- public void UpdateNotificationEvent(NotificationEvent notificationEvent)
- {
- _notificationEventRepository.Update(notificationEvent);
- }
- /// <summary>
- /// Delete a notificationEvent
- /// </summary>
- /// <param name="notificationEvent">NotificationEvent.</param>
- public void DeleteNotificationEvent(NotificationEvent notificationEvent)
- {
- _notificationEventRepository.Delete(notificationEvent);
- }
- #endregion
- #region NotificationEventType
- /// <summary>
- /// Gets all notificationEventTypes
- /// </summary>
- public IList<NotificationEventType> GetAllNotificationEventTypes()
- {
- return _notificationEventTypeRepository.Table.ToList();
- }
- /// <summary>
- /// Gets a notificationEventType by specified Id
- /// </summary>
- /// <param name="id">NotificationEventType identifier.</param>
- public NotificationEventType GetNotificationEventTypeById(int id)
- {
- return _notificationEventTypeRepository.GetById(id);
- }
- /// <summary>
- /// Gets all notificationEventTypes to the specified ids
- /// </summary>
- public IList<NotificationEventType> GetNotificationEventTypesByIds(int[] ids)
- {
- return _notificationEventTypeRepository.Table
- .Where(r => ids.Contains(r.Id))
- .ToList();
- }
- /// <summary>
- /// Insert a appendix
- /// </summary>
- /// <param name="notificationEventType">NotificationEventType.</param>
- public void InsertNotificationEventType(NotificationEventType notificationEventType)
- {
- _notificationEventTypeRepository.Insert(notificationEventType);
- }
- /// <summary>
- /// Update a notificationEventType
- /// </summary>
- /// <param name="notificationEventType">NotificationEventType.</param>
- public void UpdateNotificationEventType(NotificationEventType notificationEventType)
- {
- _notificationEventTypeRepository.Update(notificationEventType);
- }
- /// <summary>
- /// Delete a notificationEventType
- /// </summary>
- /// <param name="notificationEventType">NotificationEventType.</param>
- public void DeleteNotificationEventType(NotificationEventType notificationEventType)
- {
- _notificationEventTypeRepository.Delete(notificationEventType);
- }
- #endregion
- }
- }
|