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)));
        }
        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));
        }
Exemplo n.º 3
0
        public override void Execute()
        {
            #line 2 "..\..\Signum\Views\ValueLineBox.cshtml"

            ValueLineBoxOptions options = ViewBag.Options;


            #line default
            #line hidden
            WriteLiteral("\r\n\r\n<div");

            WriteAttribute("id", Tuple.Create(" id=\"", 96), Tuple.Create("\"", 129)

            #line 6 "..\..\Signum\Views\ValueLineBox.cshtml"
                           , Tuple.Create(Tuple.Create("", 101), Tuple.Create <System.Object, System.Int32>(Model.Compose("panelPopup")

            #line default
            #line hidden
                                                                                                            , 101), false)
                           );

            WriteLiteral(" class=\"sf-popup-control modal fade sf-value-line-box\"");

            WriteLiteral(" tabindex=\"-1\"");

            WriteLiteral(" role=\"dialog\"");

            WriteLiteral(" aria-labelledby=\"XXXX\"");

            WriteLiteral(" data-prefix=\"");


            #line 6 "..\..\Signum\Views\ValueLineBox.cshtml"
            Write(Model.Prefix);


            #line default
            #line hidden
            WriteLiteral("\"");

            WriteLiteral(">\r\n    <div");

            WriteLiteral(" class=\"modal-dialog modal-sm\"");

            WriteLiteral(">\r\n        <div");

            WriteLiteral(" class=\"modal-content\"");

            WriteLiteral(">\r\n            <div");

            WriteLiteral(" class=\"modal-header\"");

            WriteLiteral(">\r\n                <button");

            WriteLiteral(" type=\"button\"");

            WriteLiteral(" class=\"close sf-close-button\"");

            WriteLiteral(">×</button>\r\n                <h4>");


            #line 11 "..\..\Signum\Views\ValueLineBox.cshtml"
            Write(options.title);


            #line default
            #line hidden
            WriteLiteral("</h4>\r\n            </div>\r\n\r\n            <div");

            WriteLiteral(" class=\"modal-body\"");

            WriteLiteral(">\r\n                <p>\r\n");

            WriteLiteral("                    ");


            #line 16 "..\..\Signum\Views\ValueLineBox.cshtml"
            Write(options.message);


            #line default
            #line hidden
            WriteLiteral("\r\n                </p>\r\n");

            WriteLiteral("                ");


            #line 18 "..\..\Signum\Views\ValueLineBox.cshtml"
            Write(Html.ValueLine(new ValueLine(@ViewBag.type, options.value, Model, "value", null)
            {
                LabelText      = options.labelText,
                FormGroupStyle = options.labelText.HasText() ? FormGroupStyle.Basic : FormGroupStyle.None,
                Format         = options.format,
                UnitText       = options.unit,
            }));


            #line default
            #line hidden
            WriteLiteral("\r\n            </div>\r\n            <div");

            WriteLiteral(" class=\"modal-footer\"");

            WriteLiteral(">\r\n                <button");

            WriteAttribute("id", Tuple.Create(" id=\"", 1123), Tuple.Create("\"", 1151)

            #line 27 "..\..\Signum\Views\ValueLineBox.cshtml"
                           , Tuple.Create(Tuple.Create("", 1128), Tuple.Create <System.Object, System.Int32>(Model.Compose("btnOk")

            #line default
            #line hidden
                                                                                                             , 1128), false)
                           );

            WriteLiteral(" class=\"btn btn-primary sf-entity-button sf-close-button sf-ok-button\"");

            WriteLiteral(">");


            #line 27 "..\..\Signum\Views\ValueLineBox.cshtml"
            Write(JavascriptMessage.ok.NiceToString());


            #line default
            #line hidden
            WriteLiteral("</button>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</div>\r\n");
        }