示例#1
0
        protected override void OnInit(EventArgs e)
        {
            FileSystemsPanel1.EnclosingPage = this;

            base.OnInit(e);

            _controller = new FileSystemsConfigurationController();

            SetupControls();
            SetupEventHandlers();
        }
示例#2
0
 public void OnEditFileSystem(FileSystemsConfigurationController controller, Filesystem fs)
 {
     AddEditFileSystemDialog1.EditMode = true;
     AddEditFileSystemDialog1.FileSystem = fs;
     AddEditFileSystemDialog1.Show(true);
 }
示例#3
0
        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();
        }
示例#4
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // initialize the controller
            _theController = new FileSystemsConfigurationController();

            // setup child controls
            GridPagerTop.InitializeGridPager(SR.GridPagerFileSystemSingleItem, SR.GridPagerFileSystemMultipleItems, FileSystemsGridView1.TheGrid, delegate { return FileSystemsGridView1.FileSystems.Count; }, ImageServerConstants.GridViewPagerPosition.Top);
            FileSystemsGridView1.Pager = GridPagerTop;
            GridPagerTop.Reset();
                
            Tiers = _theController.GetFileSystemTiers();

            int prevSelectIndex = TiersDropDownList.SelectedIndex;
            if (TiersDropDownList.Items.Count == 0)
            {
                TiersDropDownList.Items.Add(new ListItem(SR.All));
                foreach (FilesystemTierEnum tier in Tiers)
                {
                    TiersDropDownList.Items.Add(new ListItem(ServerEnumDescription.GetLocalizedDescription(tier), tier.Lookup));
                }
            }
            TiersDropDownList.SelectedIndex = prevSelectIndex;
        }
示例#5
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            IList<ServiceLockTypeEnum> types = ServiceLockTypeEnum.GetAll();
            TypeDropDownList.Items.Add(new ListItem(SR.All)); 
            foreach (ServiceLockTypeEnum t in types)
            {
                TypeDropDownList.Items.Add(new ListItem(ServerEnumDescription.GetLocalizedDescription(t), t.Lookup));
            }

            EditServiceLockDialog.ServiceLockUpdated += AddEditServiceLockDialog_ServiceLockUpdated; 
            
            // setup child controls
            GridPagerTop.InitializeGridPager(SR.GridPagerServiceSingleItem, SR.GridPagerServiceMultipleItems, ServiceLockGridViewControl.TheGrid, delegate { return ServiceLockGridViewControl.ServiceLocks != null ? ServiceLockGridViewControl.ServiceLocks.Count : 0; }, ImageServerConstants.GridViewPagerPosition.Top);
            ServiceLockGridViewControl.Pager = GridPagerTop;
           
            StatusFilter.Items.Add(new ListItem(SR.All));
            StatusFilter.Items.Add(new ListItem(SR.Enabled));
            StatusFilter.Items.Add(new ListItem(SR.Disabled));

            FileSystemsConfigurationController fileSystemController = new FileSystemsConfigurationController();
            IList<Model.Filesystem> fileSystems = fileSystemController.GetAllFileSystems();

            foreach(Model.Filesystem fs in fileSystems)
            {
                FileSystemFilter.Items.Add(new ListItem(fs.Description, fs.Key.ToString()));
            }
            
            ConfirmEditDialog.Confirmed += ConfirmEditDialog_Confirmed;

        }
示例#6
0
        /// <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()
        {
            ServiceLockSelectCriteria criteria = new ServiceLockSelectCriteria();

            ServiceLockConfigurationController 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)
            {
                FileSystemsConfigurationController fsController = new FileSystemsConfigurationController();
                List<ServerEntityKey> fileSystemKeys = new List<ServerEntityKey>();
                foreach (ListItem fileSystem in FileSystemFilter.Items)
                {
                    if (fileSystem.Selected)
                    {
                        fileSystemKeys.Add(new ServerEntityKey("FileSystem", fileSystem.Value));
                    }
                }

                IList<Model.Filesystem> fs = fsController.GetFileSystems(fileSystemKeys);

                if(fs != null)
                {
                    List<ServerEntityKey> entityKeys = new List<ServerEntityKey>();
                    foreach(Filesystem f in fs)
                    {
                        entityKeys.Add(f.Key);
                    }
                    criteria.FilesystemKey.In(entityKeys);    
                }                
            }

            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;
        		                               			}
        		                               			else
        		                               			{
        		                               				// If x is null and y is not null, y
        		                               				// is greater. 
        		                               				return -1;
        		                               			}
        		                               		}
        		                               		else
        		                               		{
        		                               			// If a is not null...
        		                               			if (b == null)
        		                               			{
															// ...and b is null, x is greater.
															return 1;
        		                               			}
        		                               			else
        		                               			{
        		                               				// just compare
															if (a.Filesystem == null || b.Filesystem == null)
																return a.ServiceLockTypeEnum.Description.CompareTo(b.ServiceLockTypeEnum.Description);

															int retVal =
        		                               					a.Filesystem.Description.CompareTo(
        		                               						b.Filesystem.Description);
															if (retVal == 0)
																return a.ServiceLockTypeEnum.Description.CompareTo(b.ServiceLockTypeEnum.Description);
        		                               				return retVal;
        		                               			}
        		                               		}
        		                               	});

			
            ServiceLockCollection items = new ServiceLockCollection();
            items.Add(sortedServices);

            ServiceLockGridViewControl.ServiceLocks = items;

            ServiceLockGridViewControl.RefreshCurrentPage();
        }