public PartialViewResult ValueLineBox(string prefix, ValueLineType type, string title, string labelText, string message, string unit, string format)
        {
            ValueLineBoxOptions options = new ValueLineBoxOptions(type, prefix, null)
            {
                message   = message,
                labelText = labelText,
                title     = title,
                unit      = unit,
                format    = format
            };

            Type vlType = null;

            switch (type)
            {
            case ValueLineType.TextBox:
            case ValueLineType.TextArea:
                vlType        = typeof(string);
                options.value = this.ParseValue <string>("value");
                break;

            case ValueLineType.Boolean:
                vlType        = typeof(bool);
                options.value = this.ParseValue <bool?>("value");
                break;

            case ValueLineType.Number:
                vlType = typeof(decimal);

                options.value = format != null && format.StartsWith("p", StringComparison.InvariantCultureIgnoreCase) ?
                                this.ParsePercentage <decimal?>("value"):
                                this.ParseValue <decimal?>("value");
                break;

            case ValueLineType.DateTime:
                vlType        = typeof(DateTime);
                options.value = this.ParseValue <DateTime?>("value");
                break;

            default:
                break;
            }

            ViewData["type"]    = vlType;
            ViewData["options"] = options;

            return(this.PartialView(Navigator.Manager.ValueLineBoxView, new Context(null, prefix)));
        }
Example #2
0
        private static MvcHtmlString InternalValue(HtmlHelper helper, ValueLine valueLine)
        {
            HtmlStringBuilder sb     = new HtmlStringBuilder();
            ValueLineType     vltype = valueLine.ValueLineType ?? Configurator.GetDefaultValueLineType(valueLine.Type);

            using (valueLine.UnitText == null ? null : sb.SurroundLine(new HtmlTag("div").Class("input-group")))
            {
                sb.AddLine(Configurator.Helper[vltype](helper, valueLine));

                if (valueLine.UnitText.HasText())
                {
                    sb.AddLine(helper.Span(null, valueLine.UnitText, "input-group-addon"));
                }
            }

            return(sb.ToHtml());
        }
        public PartialViewResult ValueLineBox(string prefix, ValueLineType type, string title, string labelText, string message, string unit, string format)
        {
            ValueLineBoxOptions options = new ValueLineBoxOptions(type, prefix, null) 
            { 
                message = message,
                labelText = labelText, 
                title = title, 
                unit = unit, 
                format = format 
            };

            Type vlType = null;
            switch (type)
            {
                case ValueLineType.TextBox:
                case ValueLineType.TextArea:
                    vlType = typeof(string);
                    options.value = this.ParseValue<string>("value");
                    break;
                case ValueLineType.Boolean:
                    vlType = typeof(bool);
                    options.value = this.ParseValue<bool?>("value");
                    break;
                case ValueLineType.Number:
                    vlType = typeof(decimal);

                    options.value = format != null && format.StartsWith("p", StringComparison.InvariantCultureIgnoreCase) ?
                        this.ParsePercentage<decimal?>("value"):
                        this.ParseValue<decimal?>("value");
                    break;
                case ValueLineType.DateTime:
                    vlType = typeof(DateTime);
                    options.value = this.ParseValue<DateTime?>("value");
                    break;
                default:
                    break;
            }

            ViewData["type"] = vlType;
            ViewData["options"] = options;

            return this.PartialView(Navigator.Manager.ValueLineBoxView, new Context(null, prefix));
        }
Example #4
0
 public ValueLineBoxOptions(ValueLineType type, string parentPrefix, string newPart)
     :this(type, "_".CombineIfNotEmpty(parentPrefix, newPart))
 {
 }
Example #5
0
 public ValueLineBoxOptions(ValueLineType type, string prefix)
 {
     this.type = type;
     this.prefix = prefix;
 }
Example #6
0
 public ValueLineBoxOptions(ValueLineType type, string parentPrefix, string newPart)
     : this(type, "_".CombineIfNotEmpty(parentPrefix, newPart))
 {
 }
Example #7
0
 public ValueLineBoxOptions(ValueLineType type, string prefix)
 {
     this.type   = type;
     this.prefix = prefix;
 }