public static ICollection <NotificationItemTypeDAL> GetTypes() { List <NotificationItemTypeDAL> cachedTypes = NotificationItemTypeDAL._cachedTypes; if (cachedTypes != null) { return((ICollection <NotificationItemTypeDAL>)cachedTypes); } NotificationItemTypeDAL._cachedTypes = NotificationItemTypeDAL.LoadAllTypes(); return((ICollection <NotificationItemTypeDAL>)NotificationItemTypeDAL._cachedTypes); }
public static NotificationItemTypeDAL GetTypeById(Guid typeId) { try { return(NotificationItemTypeDAL.GetTypes().FirstOrDefault <NotificationItemTypeDAL>((Func <NotificationItemTypeDAL, bool>)(x => x.Id == typeId))); } catch (ResultCountException ex) { NotificationItemTypeDAL.log.DebugFormat("Can't find notification item type in database: ID={0}", (object)typeId); return((NotificationItemTypeDAL)null); } }
private static List <NotificationItemTypeDAL> LoadAllTypes() { List <NotificationItemTypeDAL> notificationItemTypeDalList = NotificationItemTypeDAL.LoadCollectionFromDB(); Dictionary <Guid, List <NotificationItemType.Roles> > dictionary = NotificationItemTypeDAL.LoadRolesFromDB(); foreach (NotificationItemTypeDAL notificationItemTypeDal in notificationItemTypeDalList) { if (dictionary.ContainsKey(notificationItemTypeDal.Id)) { notificationItemTypeDal.RequiredRoles = dictionary[notificationItemTypeDal.Id]; } } return(notificationItemTypeDalList); }
// Token: 0x060008AC RID: 2220 RVA: 0x0003EB24 File Offset: 0x0003CD24 public static NotificationItemTypeDAL GetTypeById(Guid typeId) { NotificationItemTypeDAL result; try { result = NotificationItemTypeDAL.GetTypes().FirstOrDefault((NotificationItemTypeDAL x) => x.Id == typeId); } catch (ResultCountException) { NotificationItemTypeDAL.log.DebugFormat("Can't find notification item type in database: ID={0}", typeId); result = null; } return(result); }
private static List <NotificationItemTypeDAL> LoadCollectionFromDB() { using (SqlCommand textCommand = SqlHelper.GetTextCommand("SELECT * FROM NotificationItemTypes")) { using (IDataReader reader = SqlHelper.ExecuteReader(textCommand)) { List <NotificationItemTypeDAL> notificationItemTypeDalList = new List <NotificationItemTypeDAL>(); while (reader.Read()) { NotificationItemTypeDAL notificationItemTypeDal = new NotificationItemTypeDAL(); notificationItemTypeDal.LoadFromReader(reader); notificationItemTypeDalList.Add(notificationItemTypeDal); } return(notificationItemTypeDalList); } } }
// Token: 0x060008AF RID: 2223 RVA: 0x0003EC24 File Offset: 0x0003CE24 private static List <NotificationItemTypeDAL> LoadCollectionFromDB() { List <NotificationItemTypeDAL> result; using (SqlCommand textCommand = SqlHelper.GetTextCommand("SELECT * FROM NotificationItemTypes")) { using (IDataReader dataReader = SqlHelper.ExecuteReader(textCommand)) { List <NotificationItemTypeDAL> list = new List <NotificationItemTypeDAL>(); while (dataReader.Read()) { NotificationItemTypeDAL notificationItemTypeDAL = new NotificationItemTypeDAL(); notificationItemTypeDAL.LoadFromReader(dataReader); list.Add(notificationItemTypeDAL); } result = list; } } return(result); }