public static List<Notification> GetByJobRoleAndIsRead(string permissionEnum, bool isRead) { List<Notification> notificationList = new List<Notification>(); using (ObjectConnection objectConnection = new ObjectConnection()) { using (GetNotificationByJobRoleAndIsReadCommand objectCommand = new GetNotificationByJobRoleAndIsReadCommand(objectConnection)) { objectCommand.PermissionEnum = permissionEnum; objectCommand.IsRead = isRead; objectConnection.Open(); using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader()) { if (!sqlDataReader.HasRows) { return notificationList; } using (NotificationSqlDataReader objectSqlDataReader = new NotificationSqlDataReader(sqlDataReader)) { while (objectSqlDataReader.Read()) { Notification notification = objectSqlDataReader.Notification; notificationList.Add(notification); } } } } } return notificationList; }
public static List<Notification> GetByNotificationId(Guid notificationId) { List<Notification> notificationList = new List<Notification>(); using (ObjectConnection objectConnection = new ObjectConnection()) { using (GetNotificationByNotificationIdCommand objectCommand = new GetNotificationByNotificationIdCommand(objectConnection)) { objectCommand.NotificationId = notificationId; objectConnection.Open(); using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader()) { if (!sqlDataReader.HasRows) { return notificationList; } using (NotificationSqlDataReader objectSqlDataReader = new NotificationSqlDataReader(sqlDataReader)) { while (objectSqlDataReader.Read()) { Notification notification = objectSqlDataReader.Notification; notificationList.Add(notification); } } } } } return notificationList; }