protected override bool Request(HandlerParameter input, ref IFormInput result) { var content = input.PropertyContent; var type = content.Property.PropertyType; if (type.IsGenericType && type.GetInterfaces().Contains(typeof(IEnumerable))) { var itemType = type.GetGenericArguments()[0]; if (itemType.IsEnum) { result = new Inputs.CheckBoxList(); input.SetInputProperty(result); result.Init(content, input.Name, input.Value, Util.EnumProvider.Instance.GetDataItems(itemType, input.Source.GetCanNull(input.Name))); return(true); } else if (ItemHandlers.TryGetValue(itemType, out Func <HandlerParameter, ModelPropertyContent, IFormInput> deal)) { result = deal(input, content); return(true); } else if (!itemType.IsClass) { result = new Inputs.CheckBoxList(); input.SetInputProperty(result); result.Init(content, input.Name, input.Value, input.Source.Get(input.Name)); return(true); } } return(false); }
protected override bool Request(HandlerParameter input, ref Input.IFormInput result) { if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(byte))) { result = new Inputs.Integer(); } else if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(short))) { result = new Inputs.Integer(); } else if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(uint))) { result = new Inputs.Integer(); } else if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(ulong))) { result = new Inputs.Integer(); } else if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(int))) { result = new Inputs.Integer(); } else if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(long))) { result = new Inputs.Integer(); } if (result == null) { return(false); } input.SetInputProperty(result); result.Init(input.PropertyContent, input.Name, input.Value, null); return(true); }
protected override bool Request(HandlerParameter input, ref Input.IFormInput result) { result = new Inputs.Text(); input.SetInputProperty(result); result.Init(input.PropertyContent, input.Name, input.Value, null); return(true); }
private static IFormInput DealFile(HandlerParameter input, ModelPropertyContent content) { var result = new FormInputCreator.Inputs.MultiFile(); input.SetInputProperty(result); result.Init(content, input.Name, input.Value, null); return(result); }
private static IFormInput DealString(HandlerParameter input, ModelPropertyContent content) { var result = new Inputs.MultiSelect(); input.SetInputProperty(result); result.Init(content, input.Name, input.Value, input.Source.Get(input.Name)); return(result); }
protected override bool Request(HandlerParameter input, ref Input.IFormInput result) { if (input.PropertyContent.DataType == System.ComponentModel.DataAnnotations.DataType.Time) { result = new Inputs.Time(); input.SetInputProperty(result); result.Init(input.PropertyContent, input.Name, input.Value, null); return(true); } return(false); }
protected override bool Request(HandlerParameter input, ref Input.IFormInput result) { if (input.Source.Contains(input.Name)) { result = new Inputs.Select(); input.SetInputProperty(result); result.Init(input.PropertyContent, input.Name, input.Value, input.Source.Get(input.Name)); return(true); } return(false); }
protected override bool Request(HandlerParameter input, ref Input.IFormInput result) { if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(bool))) { result = new Inputs.Bool(); input.SetInputProperty(result); result.Init(input.PropertyContent, input.Name, input.Value, null); return(true); } return(false); }
protected override bool Request(HandlerParameter input, ref Input.IFormInput result) { var content = input.PropertyContent; var type = content.Property.PropertyType; if (type.IsEnum) { result = new Inputs.RadioList(); input.SetInputProperty(result); result.Init(content, input.Name, input.Value, input.Source.Contains(input.Name) ? input.Source.Get(input.Name) : Util.EnumProvider.Instance.GetDataItems(type)); return(true); } else if (Util.EnumProvider.IsNullableEnum(type)) { result = new Inputs.RadioList(); input.SetInputProperty(result); result.Init(content, input.Name, input.Value, input.Source.Contains(input.Name) ? input.Source.Get(input.Name) : Util.EnumProvider.Instance.GetDataItems(type.GenericTypeArguments[0])); return(true); } return(false); }
protected override bool Request(HandlerParameter input, ref Input.IFormInput result) { var type = typeof(System.Web.HttpPostedFileBase); if (input.PropertyContent.Property.PropertyType == type || input.PropertyContent.Property.PropertyType.IsSubclassOf(type)) { result = new Inputs.File(); input.SetInputProperty(result); result.Init(input.PropertyContent, input.Name, input.Value, null); return(true); } return(false); }
protected override bool Request(HandlerParameter input, ref IFormInput result) { var customInput = input.PropertyContent.Attributes.Get <Annotations.CustomInputAttribute>(); if (customInput == null) { return(false); } var customer = Activator.CreateInstance(customInput.InputType) as ICustomInput; customer.Set(customInput.Parameter); result = customer; input.SetInputProperty(result); var options = Util.EnumProvider.Instance.GetDataItems(input.PropertyContent.Property.PropertyType, input.Source.GetCanNull(input.Name)); result.Init(input.PropertyContent, input.Name, input.Value, options); return(true); }
protected override bool Request(HandlerParameter input, ref Input.IFormInput result) { if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(float))) { result = new Inputs.Numeric(); } else if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(double))) { result = new Inputs.Numeric(); } else if (ModelPropertyContent.IsType(input.PropertyContent.Property.PropertyType, typeof(decimal))) { result = new Inputs.Numeric(); } if (result == null) { return(false); } input.SetInputProperty(result); result.Init(input.PropertyContent, input.Name, input.Value, null); return(true); }