public static List <Notification> GetByJobRole(string permissionEnum) { List <Notification> notificationList = new List <Notification>(); using (ObjectConnection objectConnection = new ObjectConnection()) { using (GetNotificationByJobRoleCommand objectCommand = new GetNotificationByJobRoleCommand(objectConnection)) { objectCommand.PermissionEnum = permissionEnum; 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); }