Пример #1
0
        public override void Execute()
        {
            DataSet dataSet = Model;
            DataRow dataRow = HtmlUtil.GetMainRow(Model, ViewBag);

            WriteLiteral("\r\n\r\n");

            DefineSection("ModuleButtons", () => {
                WriteLiteral("\r\n    <div");

                WriteLiteral(" class=\"text-center clearfix mt5\"");

                WriteLiteral(">\r\n");

                WriteLiteral("        ");

                Write(BootcssUtil.CreateDetailButtons(dataSet, dataRow));

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

            Write(RenderSectionIfDefined("Main", "../Detail/main.cshtml", Model));
        }
Пример #2
0
        public override void Execute()
        {
            NormalDetailData pageData  = ViewBag.PageData;
            DataSet          dataSet   = Model;
            HtmlAttribute    attribute = pageData.DialogMode ? new HtmlAttribute("data-dialog-action", "close")
        : new HtmlAttribute("data-url", HtmlUtil.GetRetUrl(dataSet));
            HtmlAttribute retAttr   = new HtmlAttribute("data-action", "return");
            DataTable     operators = dataSet.Tables["DetailOperator"];

            Tk5NormalTableData    table   = ViewBag.MetaData.Table;
            DataRow               dataRow = HtmlUtil.GetMainRow(Model, ViewBag);
            List <Tk5FieldInfoEx> fields  = ViewBag.MetaData.Table.TableList;

            int  captionCol       = pageData.CaptionColumn;
            int  dataCol          = pageData.DataColumn;
            bool showHint         = pageData.AppendHint;
            bool ignoreEmptyField = pageData.IgnoreEmptyField;

            WriteLiteral("\r\n");

            DefineSection("DefaultButtons", () => {
                WriteLiteral("\r\n    <div");

                WriteLiteral(" class=\"text-center clearfix mt5\"");

                WriteLiteral(">\r\n");

                WriteLiteral("        ");

                Write(BootcssUtil.CreateDetailButtons(dataSet, dataRow));

                WriteLiteral("\r\n");

                WriteLiteral("        ");

                Write(BootcssUtil.Button("<i class='icon-remove mr5'></i>" + pageData.CancelCaption, "", BootcssButton.Default, false, attribute, retAttr));

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

            WriteLiteral("<form");

            WriteLiteral(" method=\"POST\"");

            WriteLiteral(" id=\"PostForm\"");

            WriteLiteral(" class=\"tk-dataform form-horizontal p5 mb15\"");

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

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

            WriteAttribute("id", Tuple.Create(" id=\"", 1406), Tuple.Create("\"", 1427)
                           , Tuple.Create(Tuple.Create("", 1411), Tuple.Create <System.Object, System.Int32>(table.TableName
                                                                                                             , 1411), false)
                           );

            WriteAttribute("class", Tuple.Create(" class=\"", 1428), Tuple.Create("\"", 1513)
                           , Tuple.Create(Tuple.Create("", 1436), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-datatable", "column" + table.ColumnCount.ToString())
                                                                                                             , 1436), false)
                           );

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

            WriteLiteral(" class=\"p10\"");

            WriteLiteral(">\r\n");


            foreach (Tk5FieldInfoEx field in fields)
            {
                string fieldString = RenderFieldItem(dataRow, field);
                string value       = dataRow.GetString(field.NickName);


                if (fieldString != null)
                {
                    Write(fieldString);
                }
                else
                {
                    if (ignoreEmptyField && string.IsNullOrEmpty(value))
                    {
                        continue;
                    }


                    WriteLiteral("                <div");

                    WriteAttribute("class", Tuple.Create(" class=\"", 2121), Tuple.Create("\"", 2191)
                                   , Tuple.Create(Tuple.Create("", 2129), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-column", field.LayoutClass(), "pt10")
                                                                                                                     , 2129), false)
                                   );

                    WriteLiteral(">\r\n                    <dl>\r\n                        <dt>");

                    Write(field.DisplayName);

                    WriteLiteral("</dt>\r\n                        <dd>\r\n                            <span");

                    WriteLiteral(" class=\"tk-control\"");

                    WriteLiteral(">\r\n");

                    WriteLiteral("                                ");

                    Write(field.Detail(dataRow, showHint, false));

                    WriteLiteral("\r\n                            </span>\r\n                        </dd>\r\n           " +
                                 "         </dl>\r\n                </div>\r\n");
                }
            }

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

            Write(RenderSectionOrDefault("ModuleButtons", "DefaultButtons"));
        }