Пример #1
0
        public DataControlField GetColumn(Page pageInstance, MetaField field, bool isPrimaryKey)
        {
            if (pageInstance == null)
                throw new ArgumentNullException("pageInstance");
            if (field == null)
                throw new ArgumentNullException("field");

            if (ControlPathResolver.Current == null)
                throw new ArgumentNullException("ControlPathResolver");

            TemplateField retVal = new TemplateField();

            if (!isPrimaryKey)
            {
                ResolvedPath resPath = ControlPathResolver.Current.Resolve(CHelper.GetMetaTypeName(field), "Grid", field.Owner.Name, field.Name, viewName);

                //retVal.ItemTemplate = PageInstance.LoadTemplate(MetaFieldControlPathResolver.Resolve(CHelper.GetMetaTypeName(Field)/*Field.TypeName*/, "Grid", Field.Owner.Name, Field.Name, viewName, string.Empty));
                if(resPath!= null)
                    retVal.ItemTemplate = pageInstance.LoadTemplate(resPath.Path);
            }
            else
                retVal.ItemTemplate = pageInstance.LoadTemplate("~/Apps/MetaUI/Primitives/Text.Grid.@[email protected]");

            return retVal;
        }
Пример #2
0
        public DataControlField GetColumn(Page PageInstance, MetaField Field, bool IsPrimaryKey)
        {
            if (PageInstance == null)
                throw new ArgumentNullException("pageInstance");
            if (Field == null)
                throw new ArgumentNullException("field");

            TemplateField retVal = new TemplateField();

            if (!IsPrimaryKey)
            {
                string className = Field.Owner.Name;
                if (ListManager.MetaClassIsList(className))
                    className = "List_@";
                ResolvedPath resPath = ControlPathResolver.Current.Resolve(CHelper.GetMetaTypeName(Field), "GridEntity", className, Field.Name, viewName);

                if (resPath != null)
                    retVal.ItemTemplate = PageInstance.LoadTemplate(resPath.Path);
            }
            else
                retVal.ItemTemplate = PageInstance.LoadTemplate("~/Apps/MetaUIEntity/Primitives/Text.GridEntity.@[email protected]");

            return retVal;
        }
Пример #3
0
        public DataControlField GetAllowEditColumn(Page PageInstance, string MetaClassName)
        {
            TemplateField retVal = new TemplateField();

            string className = MetaClassName;
            if (ListManager.MetaClassIsList(className))
                className = "List_@";

            ResolvedPath resPath = ControlPathResolver.Current.Resolve("AllowEdit", "GridEntity", className, String.Empty, viewName);

            if (resPath != null)
                retVal.ItemTemplate = PageInstance.LoadTemplate(resPath.Path);

            return retVal;
        }
Пример #4
0
        public DataControlField GetAllowEditColumn(Page PageInstance, string MetaClassName)
        {
            TemplateField retVal = new TemplateField();

            if (ControlPathResolver.Current == null)
                throw new ArgumentNullException("ControlPathResolver");

            if (PageInstance == null)
                throw new ArgumentNullException("PageInstance");

            ResolvedPath resPath = ControlPathResolver.Current.Resolve("AllowEdit", "Grid", MetaClassName, String.Empty, viewName);

            //retVal.ItemTemplate = PageInstance.LoadTemplate(MetaFieldControlPathResolver.Resolve("AllowEdit", "Grid", MetaClassName, string.Empty, viewName, string.Empty));
            if(resPath!=null)
                retVal.ItemTemplate = PageInstance.LoadTemplate(resPath.Path);

            return retVal;
        }
Пример #5
0
        /// <summary>
        /// Gets the column.
        /// </summary>
        /// <param name="pageInstance">The page instance.</param>
        /// <param name="field">The field.</param>
        /// <param name="placeName">Name of the place.</param>
        /// <returns></returns>
        public DataControlField GetColumn(Page pageInstance, MetaField field, string placeName)
        {
            if (pageInstance == null)
                throw new ArgumentNullException("pageInstance");
            if (field == null)
                throw new ArgumentNullException("field");

            TemplateField retVal = new TemplateField();

            string className = field.Owner.Name;
            if (ListManager.MetaClassIsList(className))
                className = "List_@";

            ResolvedPath resPath = ControlPathResolver.Current.Resolve(CHelper.GetMetaTypeName(field), "GridEntity", className, field.Name, placeName);

            if (resPath != null)
                retVal.ItemTemplate = pageInstance.LoadTemplate(resPath.Path);

            return retVal;
        }
Пример #6
0
        // *********************************************************************
        //  LoadSkinnedTemplate
        //
        /// <summary>
        /// Attempts to load a template from the skin defined for the application.
        /// If no template is found, or if an error occurs, a maker is added to the
        /// cache to indicate that we won't try the code path again. Otherwise the
        /// template is added to the cache and loaded from memory.
        /// </summary>
        /// 
        // ********************************************************************/
        public static ITemplate LoadSkinnedTemplate(string virtualPathToTemplate, string templateKey, Page page)
        {
            ITemplate _template;
            CacheDependency fileDep;

            // Get the instance of the Cache
            Cache cache = HttpContext.Current.Cache;

            // Attempt to load template from Cache
            if ((cache[templateKey] == null) || (cache[templateKey].GetType() != typeof(FileNotFoundException)))
            {
                try
                {
                    // Create a file dependency
                    fileDep = new CacheDependency(page.Server.MapPath(virtualPathToTemplate));

                    // Load the template
                    _template = page.LoadTemplate(virtualPathToTemplate);

                    // Add to cache
                    cache.Insert(templateKey, _template, fileDep);

                }
                catch (FileNotFoundException fileNotFound)
                {

                    // Add a marker we can check for to skip this in the future
                    cache.Insert(templateKey, fileNotFound);

                    return null;
                }
                catch (HttpException httpException)
                {

                    // Add a marker we can check for to skip this in the future
                    if (httpException.ErrorCode == -2147467259 || httpException.ErrorCode == -2147024894)
                        cache.Insert(templateKey, new FileNotFoundException("Template not found"));
                    else
                        throw httpException;

                    return null;
                }
            }
            else
            {
                return null;
            }

            // return the template from Cache
            return (ITemplate)cache[templateKey];
        }
Пример #7
0
        /// <summary>
        /// Gets the column.
        /// </summary>
        /// <param name="pageInstance">The page instance.</param>
        /// <param name="field">The field.</param>
        /// <param name="placeName">Name of the place.</param>
        /// <returns></returns>
        public DataControlField GetColumn(Page pageInstance, MetaField field, string placeName)
        {
            if (pageInstance == null)
                throw new ArgumentNullException("pageInstance");
            if (field == null)
                throw new ArgumentNullException("field");

            if (ControlPathResolver.Current == null)
                throw new ArgumentNullException("ControlPathResolver");

            if (pageInstance == null)
                throw new ArgumentNullException("pageInstance");

            TemplateField retVal = new TemplateField();

            ResolvedPath resPath = ControlPathResolver.Current.Resolve(CHelper.GetMetaTypeName(field), "Grid", field.Owner.Name, field.Name, placeName);

            if (resPath != null)
                retVal.ItemTemplate = pageInstance.LoadTemplate(resPath.Path);

            return retVal;
        }
Пример #8
0
        public DataControlField GetCustomColumn(Page PageInstance, string MetaClassName, string ColumnType)
        {
            TemplateField retVal = new TemplateField();

            if (ControlPathResolver.Current == null)
                throw new ArgumentNullException("ControlPathResolver");

            ResolvedPath resPath = ControlPathResolver.Current.Resolve(ColumnType, "Grid", MetaClassName, viewName, String.Empty);

            if (resPath != null)
                retVal.ItemTemplate = PageInstance.LoadTemplate(resPath.Path);

            return retVal;
        }