protected override void OnInit(EventArgs e) { base.OnInit(e); var theController = new FileSystemsConfigurationController(); var criteria = new FilesystemSelectCriteria(); criteria.FilesystemTierEnum.SortAsc(0); criteria.Description.SortAsc(1); FileSystems = theController.GetFileSystems(criteria); TheGrid = FSGridView; GridPagerTop.InitializeGridPager(SR.GridPagerFileSystemSingleItem, SR.GridPagerFileSystemMultipleItems, TheGrid, () => FileSystems.Count, ImageServerConstants.GridViewPagerPosition.Top); Pager = GridPagerTop; GridPagerTop.Reset(); // Set up the grid if (Height != Unit.Empty) { ContainerTable.Height = _height; } DataBind(); }
/// <summary> /// Load the FileSystems for the partition based on the filters specified in the filter panel. /// </summary> /// <remarks> /// This method only reloads and binds the list bind to the internal grid. <seealso cref="UpdateUI()"/> should be called /// to explicit update the list in the grid. /// <para> /// This is intentionally so that the list can be reloaded so that it is available to other controls during postback. In /// some cases we may not want to refresh the list if there's no change. Calling <seealso cref="UpdateUI()"/> will /// give performance hit as the data will be transfered back to the browser. /// /// </para> /// </remarks> public void LoadFileSystems() { FilesystemSelectCriteria criteria = new FilesystemSelectCriteria(); if (String.IsNullOrEmpty(DescriptionFilter.TrimText) == false) { QueryHelper.SetGuiStringCondition(criteria.Description, SearchHelper.TrailingWildCard(DescriptionFilter.TrimText)); } if (TiersDropDownList.SelectedIndex >= 1) /* 0 = "All" */ { criteria.FilesystemTierEnum.EqualTo(Tiers[TiersDropDownList.SelectedIndex - 1]); } FileSystemsGridView1.FileSystems = _theController.GetFileSystems(criteria); FileSystemsGridView1.RefreshCurrentPage(); }
/// <summary> /// Load the devices for the partition based on the filters specified in the filter panel. /// </summary> /// <remarks> /// This method only reloads and binds the list bind to the internal grid. /// </remarks> public void LoadServiceLocks() { var criteria = new ServiceLockSelectCriteria(); var controller = new ServiceLockConfigurationController(); if (TypeDropDownList.SelectedValue != SR.All) { criteria.ServiceLockTypeEnum.EqualTo(ServiceLockTypeEnum.GetEnum(TypeDropDownList.SelectedValue)); } if (StatusFilter.SelectedIndex != 0) { if (StatusFilter.SelectedIndex == 1) { criteria.Enabled.EqualTo(true); } else { criteria.Enabled.EqualTo(false); } } if (FileSystemFilter.SelectedIndex != -1) { var fsController = new FileSystemsConfigurationController(); var fileSystemKeys = new List <ServerEntityKey>(); foreach (ListItem fileSystem in FileSystemFilter.Items) { if (fileSystem.Selected) { fileSystemKeys.Add(new ServerEntityKey("FileSystem", fileSystem.Value)); } } IList <Filesystem> fs = fsController.GetFileSystems(fileSystemKeys); if (fs != null) { var entityKeys = new List <ServerEntityKey>(); foreach (Filesystem f in fs) { entityKeys.Add(f.Key); } criteria.FilesystemKey.In(entityKeys); } } if (PartitionFilter.SelectedIndex != -1) { var partitionKeys = new List <ServerEntityKey>(); foreach (ListItem partition in PartitionFilter.Items) { if (partition.Selected) { partitionKeys.Add(new ServerEntityKey("ServerPartition", partition.Value)); } } criteria.ServerPartitionKey.In(partitionKeys); } IList <ServiceLock> services = controller.GetServiceLocks(criteria); List <ServiceLock> sortedServices = CollectionUtils.Sort(services, delegate(ServiceLock a, ServiceLock b) { if (a == null) { if (b == null) { // If both null, they're equal. return(0); } // If x is null and y is not null, y // is greater. return(-1); } // If a is not null... if (b == null) { // ...and b is null, x is greater. return(1); } // just compare if (a.Filesystem == null || b.Filesystem == null) { return(String.Compare(a.ServiceLockTypeEnum.Description, b.ServiceLockTypeEnum.Description, StringComparison.Ordinal)); } int retVal = String.Compare(a.Filesystem.Description, b.Filesystem.Description, StringComparison.Ordinal); if (retVal == 0) { return(String.Compare(a.ServiceLockTypeEnum.Description, b.ServiceLockTypeEnum.Description, StringComparison.Ordinal)); } return(retVal); }); var items = new ServiceLockCollection { sortedServices }; ServiceLockGridViewControl.ServiceLocks = items; ServiceLockGridViewControl.RefreshCurrentPage(); }