public override void Execute()
        {
            DataSet       dataSet   = (DataSet)Model;
            DataTable     partTable = dataSet.Tables["PartFunc"];
            HashSet <int> partSet   = new HashSet <int>();

            if (partTable != null)
            {
                foreach (DataRow row in partTable.Rows)
                {
                    partSet.Add(row["FuncId"].Value <int>());
                }
            }
            DataTable             funcTable = dataSet.Tables["Function"];
            IEnumerable <DataRow> rootRows;

            if (funcTable == null)
            {
                rootRows = null;
            }
            else
            {
                rootRows = from item in funcTable.AsEnumerable()
                           where item.Field <int>("ParentId") == -1
                           orderby item.Field <string>("TreeLayer")
                           select item;
            }

            WriteLiteral("\r\n");

            DefineSection("Main", () => {
                WriteLiteral("\r\n");


                if (rootRows != null)
                {
                    WriteLiteral("        <div>\r\n            <input");

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

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

                    WriteAttribute("value", Tuple.Create(" value=\"", 1201), Tuple.Create("\"", 1252)
                                   , Tuple.Create(Tuple.Create("", 1209), Tuple.Create <System.Object, System.Int32>(dataSet.GetFieldValue("QueryString", "Id")
                                                                                                                     , 1209), false)
                                   );

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


                    foreach (var rootRow in rootRows)
                    {
                        int id = rootRow["Id"].Value <int>();
                        IEnumerable <DataRow> rows = from item in funcTable.AsEnumerable()
                                                     where item.Field <int>("ParentId") == id
                                                     orderby item.Field <string>("TreeLayer")
                                                     select item;



                        WriteLiteral("                <div");

                        WriteLiteral(" class=\"panel panel-default root\"");

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

                        Write(id);

                        WriteLiteral("\"");

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

                        WriteLiteral(" class=\"panel-heading\"");

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

                        WriteLiteral(" class=\"pull-right\"");

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

                        WriteLiteral(" class=\"mr5 checkall\"");

                        WriteLiteral(" href=\"#\"");

                        WriteLiteral(">全选</a>\r\n                            <a");

                        WriteLiteral(" class=\"mr5 anticheck\"");

                        WriteLiteral(" href=\"#\"");

                        WriteLiteral(">反选</a>\r\n                            <a");

                        WriteLiteral(" class=\"mr5 uncheckall\"");

                        WriteLiteral(" href=\"#\"");

                        WriteLiteral(">全不选</a>\r\n                        </div>");

                        Write(rootRow.GetString("Name"));

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

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

                        WriteLiteral(">\r\n");


                        foreach (DataRow childRow in rows)
                        {
                            WriteLiteral("                            <div");

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

                            WriteLiteral(">\r\n                                <label>\r\n                                    <" +
                                         "input");

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

                            WriteAttribute("value", Tuple.Create(" value=\"", 2481), Tuple.Create("\"", 2514)
                                           , Tuple.Create(Tuple.Create("", 2489), Tuple.Create <System.Object, System.Int32>(childRow.GetString("Id")
                                                                                                                             , 2489), false)
                                           );

                            WriteLiteral(" ");

                            Write(IsChecked(childRow, partSet));

                            WriteLiteral(">");

                            Write(childRow.GetString("Name"));

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

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

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

                WriteLiteral("    <div");

                WriteLiteral(" class=\"text-center cl pt10 mb15\"");

                WriteLiteral(">\r\n");


                if (rootRows != null)
                {
                    Write(BootcssUtil.Button("保存", "btn-save mr10", BootcssButton.Primary, false));
                }

                WriteLiteral("        ");

                Write(BootcssUtil.Button("关闭", "", BootcssButton.Default, false, new HtmlAttribute("data-dialog-action", "close")));

                WriteLiteral("\r\n    </div>\r\n");
            });
        }
        public override void Execute()
        {
            NormalEditData pageData  = ViewBag.PageData;
            HtmlAttribute  attribute = pageData.DialogMode ? new HtmlAttribute("data-dialog-action", "close")
        : new HtmlAttribute("data-url", HtmlUtil.GetRetUrl((DataSet)Model));
            HtmlAttribute retAttr = new HtmlAttribute("data-action", "return");

            WriteLiteral("\r\n");

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

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

                WriteLiteral(">\r\n");

                WriteLiteral("        ");

                Write(BootcssUtil.Button(pageData.SaveButtonCaption, "btn-submit", BootcssButton.Primary, false));

                WriteLiteral("\r\n");

                WriteLiteral("        ");

                Write(BootcssUtil.Button(pageData.CancelCaption, "m10", BootcssButton.Default, false, attribute, retAttr));

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


            DataRow               dataRow      = HtmlUtil.GetMainRow((DataSet)Model, ViewBag);
            Tk5NormalTableData    table        = ViewBag.MetaData.Table;
            List <Tk5FieldInfoEx> hiddenFields = table.HiddenList;
            List <Tk5FieldInfoEx> normalFields = table.TableList;
            bool   showCaption = pageData.ShowCaption;
            string dataClass   = showCaption ? string.Empty : "class=\"nocaption\"";

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

            WriteAttribute("action", Tuple.Create(" action=\"", 1428), Tuple.Create("\"", 1465)
                           , Tuple.Create(Tuple.Create("", 1437), Tuple.Create <System.Object, System.Int32>(ViewBag.PageData.FormAction
                                                                                                             , 1437), false)
                           );

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

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

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

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

            WriteLiteral(" data-check=\"true\"");

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

            Write(GetJson(table));

            WriteLiteral("\"");

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

            WriteAttribute("id", Tuple.Create(" id=\"", 1591), Tuple.Create("\"", 1612)
                           , Tuple.Create(Tuple.Create("", 1596), Tuple.Create <System.Object, System.Int32>(table.TableName
                                                                                                             , 1596), false)
                           );

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

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

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

            WriteLiteral(">\r\n");


            foreach (Tk5FieldInfoEx field in hiddenFields)
            {
                Write(RenderHidden(dataRow, field, true));
            }

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

            WriteLiteral(" class=\"p10 pull-left w100p\"");

            WriteLiteral(">\r\n");


            foreach (Tk5FieldInfoEx field in normalFields)
            {
                string fieldString = RenderFieldItem(dataRow, field);


                if (fieldString != null)
                {
                    Write(fieldString);
                }
                else
                {
                    WriteLiteral("                <div");

                    WriteAttribute("class", Tuple.Create(" class=\"", 2305), Tuple.Create("\"", 2378)
                                   , Tuple.Create(Tuple.Create("", 2313), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-column form-group", field.LayoutClass())
                                                                                                                     , 2313), false)
                                   );

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

                    Write(dataClass);

                    WriteLiteral(">\r\n");


                    if (showCaption)
                    {
                        WriteLiteral("                            <dt>");

                        Write(field.DisplayName);

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

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

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

                    WriteLiteral(">\r\n");

                    WriteLiteral("                                ");

                    Write(field.Control(dataRow, (DataSet)Model, true));

                    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"));

            WriteLiteral("\r\n");
        }
Beispiel #3
0
        public override void Execute()
        {
            DataSet       dataSet   = (DataSet)Model;
            DataTable     userTable = dataSet.Tables["UserPart"];
            HashSet <int> partSet   = new HashSet <int>();

            if (userTable != null)
            {
                foreach (DataRow row in userTable.Rows)
                {
                    partSet.Add(row["PartId"].Value <int>());
                }
            }
            DataTable partTable = dataSet.Tables["Part"];

            WriteLiteral("\r\n");

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

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

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

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

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

                WriteAttribute("value", Tuple.Create(" value=\"", 856), Tuple.Create("\"", 911)
                               , Tuple.Create(Tuple.Create("", 864), Tuple.Create <System.Object, System.Int32>(dataSet.GetFieldValue("QueryString", "UserId")
                                                                                                                , 864), false)
                               );

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


                if (partTable != null)
                {
                    WriteLiteral("        <div");

                    WriteLiteral(" class=\"panel panel-default\"");

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

                    WriteLiteral(" class=\"panel-heading\"");

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

                    WriteLiteral(" class=\"pull-right\"");

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

                    WriteLiteral(" class=\"mr5 checkall\"");

                    WriteLiteral(" href=\"#\"");

                    WriteLiteral(">全选</a>\r\n                    <a");

                    WriteLiteral(" class=\"mr5 anticheck\"");

                    WriteLiteral(" href=\"#\"");

                    WriteLiteral(">反选</a>\r\n                    <a");

                    WriteLiteral(" class=\"mr5 uncheckall\"");

                    WriteLiteral(" href=\"#\"");

                    WriteLiteral(">全不选</a>\r\n                </div>\r\n                角色\r\n            </div>\r\n       " +
                                 "     <div");

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

                    WriteLiteral(">\r\n");


                    foreach (DataRow row in partTable.Rows)
                    {
                        WriteLiteral("                    <div");

                        WriteLiteral(" class=\"w33p pull-left\"");

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

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

                        WriteLiteral(">\r\n                            <label>\r\n                                <input");

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

                        WriteAttribute("value", Tuple.Create(" value=\"", 1646), Tuple.Create("\"", 1674)
                                       , Tuple.Create(Tuple.Create("", 1654), Tuple.Create <System.Object, System.Int32>(row.GetString("Id")
                                                                                                                         , 1654), false)
                                       );

                        WriteLiteral(" ");

                        Write(IsChecked(row, partSet));

                        WriteLiteral(">");

                        Write(row.GetString("Name"));

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

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

                WriteLiteral("    <div");

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

                WriteLiteral(">\r\n");


                if (partTable != null)
                {
                    Write(BootcssUtil.Button("保存", "btn-save mr10", BootcssButton.Primary, false));
                }

                WriteLiteral("        ");

                Write(BootcssUtil.Button("关闭", "", BootcssButton.Default, false, new HtmlAttribute("data-dialog-action", "close")));

                WriteLiteral("\r\n    </div>\r\n");
            });
        }
Beispiel #4
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"));
        }
Beispiel #5
0
        public override void Execute()
        {
            NormalEditData pageData  = ViewBag.PageData;
            HtmlAttribute  attribute = pageData.DialogMode ? new HtmlAttribute("data-dialog-action", "close")
        : new HtmlAttribute("data-url", HtmlUtil.GetDynamicRetUrl(Model.CallerInfo));
            HtmlAttribute retAttr     = new HtmlAttribute("data-action", "return");
            bool          showCaption = pageData.ShowCaption;
            string        dataClass   = showCaption ? string.Empty : "class=\"nocaption\"";

            WriteLiteral("\r\n");

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

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

                WriteLiteral(">\r\n");

                WriteLiteral("        ");

                Write(BootcssUtil.Button(pageData.SaveButtonCaption, "btn-submit", BootcssButton.Primary, false));

                WriteLiteral("\r\n");

                WriteLiteral("        ");

                Write(BootcssUtil.Button(pageData.CancelCaption, "m10", BootcssButton.Default, false, attribute, retAttr));

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


            EditObjectModel       model        = Model as EditObjectModel;
            ObjectContainer       mainObject   = model.Object;// HtmlUtil.GetMainObject(Model, ViewBag);
            Tk5NormalTableData    table        = ViewBag.MetaData.Table;
            List <Tk5FieldInfoEx> hiddenFields = table.HiddenList;
            List <Tk5FieldInfoEx> normalFields = table.TableList;

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

            WriteAttribute("action", Tuple.Create(" action=\"", 1510), Tuple.Create("\"", 1547)
                           , Tuple.Create(Tuple.Create("", 1519), Tuple.Create <System.Object, System.Int32>(ViewBag.PageData.FormAction
                                                                                                             , 1519), false)
                           );

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

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

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

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

            WriteLiteral(" data-check=\"true\"");

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

            Write(GetJson(table));

            WriteLiteral("\"");

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

            WriteAttribute("id", Tuple.Create(" id=\"", 1689), Tuple.Create("\"", 1710)
                           , Tuple.Create(Tuple.Create("", 1694), Tuple.Create <System.Object, System.Int32>(table.TableName
                                                                                                             , 1694), false)
                           );

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

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

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

            WriteLiteral(">\r\n");


            foreach (Tk5FieldInfoEx field in hiddenFields)
            {
                Write(RenderHidden(mainObject, field, true));
            }

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

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

            WriteLiteral(">\r\n");


            foreach (Tk5FieldInfoEx field in normalFields)
            {
                string fieldString = RenderFieldItem(mainObject, field);


                if (fieldString != null)
                {
                    Write(fieldString);
                }
                else
                {
                    WriteLiteral("                <div");

                    WriteAttribute("class", Tuple.Create(" class=\"", 2399), Tuple.Create("\"", 2472)
                                   , Tuple.Create(Tuple.Create("", 2407), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-column form-group", field.LayoutClass())
                                                                                                                     , 2407), false)
                                   );

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

                    Write(dataClass);

                    WriteLiteral(">\r\n");


                    if (showCaption)
                    {
                        WriteLiteral("                            <dt>");

                        Write(field.DisplayName);

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

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

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

                    WriteLiteral(">\r\n");

                    WriteLiteral("                                ");

                    Write(field.Control(mainObject, model.CodeTables, true));

                    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"));

            WriteLiteral("\r\n");
        }