コード例 #1
0
        /**
         * Return the template model for the given form type. Serves the template out of the cache, if cached; fetches it
         * fresh and caches it otherwise. If form types are restricted and the given form type is not allowed, throw an error
         */
        public FormInstance getTemplateInstance(int formID)
        {
            if (restrictFormTypes && !allowedFormTypes.Contains(formID))
            {
                throw new SystemException("form ID [" + formID + "] is not an allowed form type!");
            }

            FormInstance template = templateCache[formID];

            if (template == null)
            {
                template = CompactInstanceWrapper.loadTemplateInstance(formID);
                if (template == null)
                {
                    throw new SystemException("no formdef found for form id [" + formID + "]");
                }
                templateCache.Add(formID, template);
            }
            return(template);
        }
コード例 #2
0
        /// <summary> Return the template model for the given form type. Serves the template out of the cache, if cached; fetches it
        /// fresh and caches it otherwise. If form types are restricted and the given form type is not allowed, throw an error
        /// </summary>
        public virtual FormInstance getTemplateInstance(int formID)
        {
            if (restrictFormTypes && !allowedFormTypes.contains((System.Int32)formID))
            {
                throw new System.SystemException("form ID [" + formID + "] is not an allowed form type!");
            }

            FormInstance template = templateCache.get_Renamed((System.Int32)formID);

            if (template == null)
            {
                template = CompactInstanceWrapper.loadTemplateInstance(formID);
                if (template == null)
                {
                    throw new System.SystemException("no formdef found for form id [" + formID + "]");
                }
                templateCache.put((System.Int32)formID, template);
            }
            return(template);
        }