public void Insert(Guid Guid, short EnumX, string Lookup, string Description, string LongDescription) { var item = new FilesystemTierEnum(); item.Guid = Guid; item.EnumX = EnumX; item.Lookup = Lookup; item.Description = Description; item.LongDescription = LongDescription; item.Save(UserName); }
/// <summary> /// Load filesystem information from the database. /// </summary> private void LoadFilesystems() { bool changed = false; lock (SyncLock) { try { List <FilesystemTierEnum> tiers = FilesystemTierEnum.GetAll(); // sorted by enum values tiers.Sort((tier1, tier2) => tier1.Enum.CompareTo(tier2.Enum)); _tierInfo = new TierInfo(); foreach (FilesystemTierEnum tier in tiers) { _tierInfo.Add(tier, new List <ServerFilesystemInfo>()); } using (IReadContext read = _store.OpenReadContext()) { IFilesystemEntityBroker filesystemSelect = read.GetBroker <IFilesystemEntityBroker>(); FilesystemSelectCriteria criteria = new FilesystemSelectCriteria(); IList <Filesystem> filesystemList = filesystemSelect.Find(criteria); foreach (Filesystem filesystem in filesystemList) { if (_filesystemList.ContainsKey(filesystem.Key)) { if ((filesystem.HighWatermark != _filesystemList[filesystem.Key].Filesystem.HighWatermark) || (filesystem.LowWatermark != _filesystemList[filesystem.Key].Filesystem.LowWatermark)) { Platform.Log(LogLevel.Info, "Watermarks have changed for filesystem {0}, Low: {1}, High: {2}", filesystem.Description, filesystem.LowWatermark, filesystem.HighWatermark); } _filesystemList[filesystem.Key].Filesystem = filesystem; _tierInfo[filesystem.FilesystemTierEnum].Add(_filesystemList[filesystem.Key]); } else { ServerFilesystemInfo info = new ServerFilesystemInfo(filesystem); _filesystemList.Add(filesystem.Key, info); _tierInfo[filesystem.FilesystemTierEnum].Add(info); info.LoadFreeSpace(); changed = true; } } } if (changed && _changedListener != null) { EventsHelper.Fire(_changedListener, this, new FilesystemChangedEventArgs(this)); } } catch (Exception ex) { Platform.Log(LogLevel.Error, ex, "Exception has occurred while updating the filesystem list from the datbase. Retry later"); } } }
public IList <FilesystemTierEnum> GetFileSystemTiers() { return(FilesystemTierEnum.GetAll()); }
public void Update(Guid Guid, short EnumX, string Lookup, string Description, string LongDescription) { var item = new FilesystemTierEnum(); item.MarkOld(); item.IsLoaded = true; item.Guid = Guid; item.EnumX = EnumX; item.Lookup = Lookup; item.Description = Description; item.LongDescription = LongDescription; item.Save(UserName); }