internal static async Task <string> RenderReplacementPackageModulesDesignedAsync(Guid modGuid)
        {
            string areaName = await ModuleSelectionModuleNewEditComponent.GetAreaNameFromGuidAsync(false, modGuid);

            List <SelectionItem <string> > list = (
                from module in await DesignedModules.LoadDesignedModulesAsync()
                where module.AreaName == areaName
                orderby module.Name select
                new SelectionItem <string> {
                Text = module.Name,
                Value = module.ModuleGuid.ToString(),
                Tooltip = module.Description,
            }).ToList <SelectionItem <string> >();

            list.Insert(0, new SelectionItem <string> {
                Text = __ResStr("none", "(none)"), Value = null
            });
            return(DropDownListEditComponentBase <string> .RenderDataSource(list, areaName));
        }
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(Guid?model)
        {
            model = model ?? Guid.Empty;
            string areaName = await ModuleSelectionModuleNewEditComponent.GetAreaNameFromGuidAsync(false, model);

            List <SelectionItem <string> > list = (
                from module in await DesignedModules.LoadDesignedModulesAsync()
                where module.AreaName == areaName
                orderby module.Name select
                new SelectionItem <string> {
                Text = module.Name,
                Value = module.ModuleGuid.ToString(),
                Tooltip = module.Description,
            }).ToList <SelectionItem <string> >();

            list.Insert(0, new SelectionItem <string> {
                Text = this.__ResStr("none", "(none)"), Value = null
            });
            return(await DropDownListComponent.RenderDropDownListAsync(this, model.ToString(), list, null));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(Guid?model)
        {
            model = model ?? Guid.Empty;
            string areaName = await ModuleSelectionModuleNewEditComponent.GetAreaNameFromGuidAsync(true, model);

            List <SelectionItem <string> > list = (
                from p in InstalledModules.Packages orderby p.Name select
                new SelectionItem <string> {
                Text = this.__ResStr("package", "{0}", p.Name),
                Value = p.AreaName,
                Tooltip = this.__ResStr("packageTT", "{0} - {1}", p.Description.ToString(), p.CompanyDisplayName),
            }).ToList <SelectionItem <string> >();

            list = (from l in list orderby l.Text select l).ToList();
            list.Insert(0, new SelectionItem <string> {
                Text = this.__ResStr("selectPackage", "(select)"), Value = null
            });

            return(await DropDownListComponent.RenderDropDownListAsync(this, areaName, list, null));
        }