Exemplo n.º 1
0
        private static TagBuilder GetParamsBuilder(Type type, string methodName, string wrapperTagName, Dictionary <string, object> defaults, object htmlAttributes, out int paramCount)
        {
            InputFormBuilder builder = new InputFormBuilder(type);

            builder.AddLabels = true;
            TagBuilder form = builder.MethodForm(wrapperTagName, methodName, defaults, out paramCount)
                              .AttrsIf(htmlAttributes != null, htmlAttributes);

            return(form);
        }
Exemplo n.º 2
0
        public override void ExecuteResult(ControllerContext context)
        {
            StringBuilder output = new StringBuilder();

            if (string.IsNullOrEmpty(ClassName))
            {
                Tag message = new Tag("div", new { Class = "error" }).Text("ClassName not specified");
                output = new StringBuilder(message.ToHtmlString());
            }
            else
            {
                Incubator incubator = ServiceProxySystem.Incubator;
                Type      type;
                incubator.Get(ClassName, out type);
                if (type == null)
                {
                    Tag message = new Tag("div", new { Class = "error" }).Text("The specified className ({0}) was not registered in the ServiceProxySystem"._Format(ClassName));
                    output = new StringBuilder(message.ToHtmlString());
                }
                else
                {
                    InputFormBuilder formBuilder = new InputFormBuilder(type);
                    formBuilder.Layout = Layout;
                    Dictionary <string, object> defaults = new Dictionary <string, object>();
                    if (Defaults != null)
                    {
                        defaults = Defaults.PropertiesToDictionary();
                    }

                    TagBuilder tag = formBuilder.MethodForm(MethodName, defaults);
                    output = new StringBuilder(tag.ToMvcHtml().ToString());
                }
            }

            HttpResponseBase response = context.HttpContext.Response;

            response.Write(output.ToString());
        }