示例#1
0
        protected ComponentWriter GetListViewWriter <T>(IHtmlHelper <T> helper, Expression <Func <T, IEnumerable> > exp, string listName, string display, bool mutli, string change)
        {
            var mod = new ComponentWriter(helper);

            mod.UseExpression(exp);
            var sel = mod.InputModel.GetSelectInput(listName, display, null, mutli);

            sel.Display    = display;
            mod.InputModel = sel;
            return(mod);
        }
示例#2
0
        public virtual IHtmlContent InputControl <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, InputControls component, string textType, Dictionary <string, object> radioOptions, int size, string alternateLabel, string placeHolder, IValidationCollection coll, object attrs, object inputAttr, string inputClasses, string groupClasses)
        {
            ComponentWriter mod = GetInputControlWriter(helper, exp, component, textType, radioOptions, size, alternateLabel, placeHolder, coll, attrs, inputAttr, inputClasses, groupClasses);

            if (!mod.Accessibility.Read)
            {
                return(null);
            }
            if (!mod.Accessibility.Write)
            {
                return(mod.GetLabelControl());
            }
            return(mod.GetInputControl(component));
        }
示例#3
0
        protected ComponentWriter GetListViewWriter <T>(IHtmlHelper <T> helper, string selectionSource, string dataSource, string display, bool mutli, string change)
        {
            var mod = new ComponentWriter(helper);

            mod.InputModel = new Models.NgInput
            {
                MemberName  = selectionSource,
                NgModelName = helper.GetModelName(),
                NgFormName  = helper.GetFormName()
            };
            var sel = mod.InputModel.GetSelectInput(dataSource, display, null, mutli);

            sel.Display    = display;
            mod.InputModel = sel;
            return(mod);
        }
示例#4
0
        public virtual IHtmlContent ListView <T>(IHtmlHelper <T> helper, string selectionSource, string dataSource, string display, bool mutli, string onChange)
        {
            ComponentWriter mod = GetListViewWriter(helper, selectionSource, dataSource, display, mutli, onChange);

            return(mod.Write("Components/ListView"));;
        }
示例#5
0
        public virtual IHtmlContent ListView <T>(IHtmlHelper <T> helper, Expression <Func <T, IEnumerable> > exp, string listName, string display, bool mutli, string change)
        {
            ComponentWriter mod = GetListViewWriter(helper, exp, listName, display, mutli, change);

            return(mod.Write("Components/ListView"));
        }
示例#6
0
        public int Run(string[] args)
        {
            var appCommand = new CommandLineApplication(false)
            {
                Name        = "Angular Generator",
                FullName    = "Angular Generator",
                Description = "Angular Generator can generate Component, Service and Pipe",
            };

            var help = appCommand.HelpOption("-h|--help");
            var name = appCommand.Argument("[terms]", "Name of items to be generate");

            var module    = appCommand.Option("-m|--module", "Module", CommandOptionType.SingleValue);
            var feature   = appCommand.Option("-f|--feature", "Feature", CommandOptionType.SingleValue);
            var component = appCommand.Option("-c|--component", "Generate a new Component with HTML, TS and SCSS", CommandOptionType.NoValue);
            var service   = appCommand.Option("-s|--service", "Generate a new Angular service", CommandOptionType.NoValue);

            appCommand.OnExecute(() =>
            {
                if (appCommand.OptionHelp.HasValue())
                {
                    appCommand.ShowHelp();
                    return(0);
                }

                var moduleName  = module.HasValue() ? module.Value() : "";
                var featureName = feature.HasValue() ? feature.Value() : "";

                if (component.HasValue())
                {
                    var erro = false;

                    if (!feature.HasValue())
                    {
                        Console.WriteLine("Name of component doesn't specified");
                        erro = true;
                    }

                    if (string.IsNullOrEmpty(name.Value) || !feature.HasValue())
                    {
                        Console.WriteLine("Name of component doesn't specified");
                        erro = true;
                    }

                    if (erro)
                    {
                        return(-1);
                    }

                    var path = ParsePath(ItemType.Component, moduleName, featureName);

                    ComponentWriter.Run(path, moduleName, featureName, GetItems(appCommand, name));
                    return(0);
                }

                if (service.HasValue())
                {
                    if (string.IsNullOrEmpty(name.Value))
                    {
                        Console.WriteLine("Name of component/feature doesn't specified");
                        return(-1);
                    }

                    var path = ParsePath(ItemType.Service, moduleName, featureName);

                    ServiceWriter.Run(path, GetItems(appCommand, name));
                    return(0);
                }

                appCommand.ShowHelp();
                return(0);
            });

            var arguments = args.ToList();

            arguments.Remove("-a");

            return(appCommand.Execute(arguments.ToArray()));
        }