protected override void OnOK(object sender, EventArgs args)
        {
            CustomItemSettings settings = new CustomItemSettings(HttpContext.Current);

            ICustomItemNamespaceProvider  namespaceProvider = AssemblyUtil.GetNamespaceProvider(settings.NamespaceProvider);
            ICustomItemFolderPathProvider filePathProvider  = AssemblyUtil.GetFilePathProvider(settings.FilepathProvider);

            CustomItemInformation customItemInformation = new CustomItemInformation(template, CustomItemNamespace.Value,
                                                                                    CustomItemFilePath.Value, filePathProvider, namespaceProvider);
            CodeGenerator codeGenerator = new CodeGenerator(customItemInformation,
                                                            GenerateBaseFile.Checked, GenerateInstanceFile.Checked, GenerateInterfaceFile.Checked, GenerateStaticFile.Checked);

            codeGenerator.GenerateCode();

            SheerResponse.Alert(codeGenerator.GenerationMessage, new string[0]);

            base.OnOK(sender, args);
        }
        protected override void OnOK(object sender, EventArgs args)
        {
            foreach (ChecklistItem template in TemplateList.Items)
            {
                //Do nothing if the template has not been selected
                if (!template.Checked)
                {
                    continue;
                }

                //Try and get the template
                TemplateItem templateItem = masterDb.GetItem(template.Value);
                if (templateItem == null)
                {
                    continue;
                }

                //Using the settings item get the providers needed for creating both the namespaces for the custom items
                // as well as the file/folder strucutre.
                CustomItemSettings settings = new CustomItemSettings(HttpContext.Current);

                ICustomItemNamespaceProvider namespaceProvider =
                    AssemblyUtil.GetNamespaceProvider(settings.NamespaceProvider);

                ICustomItemFolderPathProvider filePathProvider = AssemblyUtil.GetFilePathProvider(settings.FilepathProvider);

                //Get all the custom item information
                CustomItemInformation customItemInformation = new CustomItemInformation(templateItem, CustomItemNamespace.Value,
                                                                                        CustomItemFilePath.Value,
                                                                                        filePathProvider,
                                                                                        namespaceProvider);
                //Generate the class file(s)
                CodeGenerator codeGenerator =
                    new CodeGenerator(customItemInformation,
                                      GenerateBaseFile.Checked, GenerateInstanceFile.Checked, GenerateInterfaceFile.Checked,
                                      GenerateStaticFile.Checked);

                codeGenerator.GenerateCode();
            }

            SheerResponse.Alert("Custom items sucessfully generated.", new string[0]);

            base.OnOK(sender, args);
        }
        public static string GetCodeFileString(HttpServerUtility server, CustomItemInformation info)
        {
            VelocityEngine velocity = new VelocityEngine();

            ExtendedProperties props = new ExtendedProperties();

            props.SetProperty("file.resource.loader.path", server.MapPath("."));             // The base path for Templates

            velocity.Init(props);

            //Template template = velocity.GetTemplate("template.tmp");
            NVelocity.Template template = velocity.GetTemplate("CustomItem.vm");

            VelocityContext context = new VelocityContext();

            context.Put("BaseTemplates", info.BaseTemplates);
            context.Put("CustomItemFields", info.Fields);
            context.Put("CustomItemInformation", info);

            StringWriter writer = new StringWriter();

            template.Merge(context, writer);
            return(writer.GetStringBuilder().ToString());
        }
 public SynapseItemAlreadyRegisteredException(string message, CustomItemInformation info) : base(message) => CustomItemInformation = info;