public override object CreateObject(params object[] args) { NormalEditData result = new NormalEditData(this); SetRazorField(result); result.Initialize(); return(result); }
public override void Execute() { NormalEditData pageData = (NormalEditData)ViewBag.PageData; string title = HtmlUtil.GetDynamicEditTitle(Model.CallerInfo, ViewBag); WriteLiteral("\r\n"); DefineSection("DefaultHeader", () => { WriteLiteral("\r\n"); if (pageData.Header != null) { Write(RenderRazorOutputData(pageData.Header, Model)); } else { WriteLiteral(" <h1>"); Write(ViewBag.Title); WriteLiteral("</h1>\r\n"); } }); DefineSection("DefaultFooter", () => { WriteLiteral("\r\n"); WriteLiteral(" "); Write(RenderRazorOutputData(pageData.Footer, Model)); WriteLiteral("\r\n"); }); WriteLiteral("<!DOCTYPE html>\r\n<html>\r\n<head>\r\n <title>"); Write(title); WriteLiteral("</title>\r\n <meta"); WriteLiteral(" http-equiv=\"X-UA-Compatible\""); WriteLiteral(" content=\"IE=edge\""); WriteLiteral(" />\r\n <meta"); WriteLiteral(" http-equiv=\"Content-Type\""); WriteLiteral(" content=\"text/html; charset=utf-8\""); WriteLiteral(" />\r\n <meta"); WriteLiteral(" name=\"viewport\""); WriteLiteral(" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable" + "=0;\""); WriteLiteral(" />\r\n"); WriteLiteral(" "); Write(RenderLayoutPartial("../bin/css.cshtml", null)); WriteLiteral("\r\n"); WriteLiteral(" "); Write(ViewBag.Script.CreateUserCss()); WriteLiteral("\r\n</head>\r\n<body"); WriteAttribute("id", Tuple.Create(" id=\"", 988), Tuple.Create("\"", 1037) , Tuple.Create(Tuple.Create("", 993), Tuple.Create <System.Object, System.Int32>(HtmlUtil.GetDynamicPageId(Model.CallerInfo) , 993), false) ); WriteLiteral(" class=\"tk-dataPage\""); WriteLiteral(" data-webPath=\""); Write(HtmlUtil.AppVirtualPath); WriteLiteral("\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"container-fluid\""); WriteLiteral(">\r\n"); if (pageData.ShowTitle) { Write(RenderSectionOrDefault("Header", "DefaultHeader")); } WriteLiteral(" "); Write(RenderSectionIfDefined("Picture")); WriteLiteral("\r\n"); WriteLiteral(" "); Write(RenderSectionIfDefined("Main", "main.cshtml", Model)); WriteLiteral("\r\n"); WriteLiteral(" "); Write(RenderSectionOrDefault("Footer", "DefaultFooter")); WriteLiteral("\r\n </div>\r\n"); WriteLiteral(" "); Write(RenderLayoutPartial("../bin/js.cshtml", null)); WriteLiteral("\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 1521), Tuple.Create("\"", 1591) , Tuple.Create(Tuple.Create("", 1527), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/toolkit/coreT/toolkit.edit.js".AppVirutalPath() , 1527), false) ); WriteLiteral("> </script>\r\n"); WriteLiteral(" "); Write(ViewBag.Script.CreateUserJavaScript()); WriteLiteral("\r\n</body>\r\n</html>\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"); }
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"); DataRow dataRow = null; // HtmlUtil.GetMainRow((DataSet)Model, ViewBag); Tk5NormalTableData table = ViewBag.MetaData.Table; List <Tk5FieldInfoEx> hiddenFields = table.HiddenList; List <Tk5FieldInfoEx> normalFields = table.TableList; int columnCount = table.ColumnCount; int columnWidth = 12 / columnCount; int fieldsCount = normalFields.Count; int columnFieldCount = fieldsCount / columnCount; if ((fieldsCount % columnCount) != 0) { ++columnFieldCount; } //bool showCaption = pageData.ShowCaption; //string dataClass = showCaption ? string.Empty : "class=\"nocaption\""; WriteLiteral("\r\n"); DefineSection("DefaultButtons", () => { WriteLiteral("\r\n "); WriteLiteral("\r\n"); }); WriteLiteral("\r\n<form"); WriteAttribute("action", Tuple.Create(" action=\"", 1753), Tuple.Create("\"", 1790) , Tuple.Create(Tuple.Create("", 1762), Tuple.Create <System.Object, System.Int32>(ViewBag.PageData.FormAction , 1762), 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=\"", 1916), Tuple.Create("\"", 1937) , Tuple.Create(Tuple.Create("", 1921), Tuple.Create <System.Object, System.Int32>(table.TableName , 1921), false) ); WriteAttribute("class", Tuple.Create(" class=\"", 1938), Tuple.Create("\"", 2033) , Tuple.Create(Tuple.Create("", 1946), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-datatable table-row", "column" + table.ColumnCount.ToString()) , 1946), false) ); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"hide\""); WriteLiteral(">\r\n "); WriteLiteral("\r\n </div>\r\n <div"); WriteLiteral(" class=\"row\""); WriteLiteral(">\r\n"); for (int i = 0; i < columnCount; ++i) { int start = i * columnFieldCount; int end = start + columnFieldCount; if (end > fieldsCount) { end = fieldsCount; } WriteLiteral(" <div"); WriteAttribute("class", Tuple.Create(" class=\"", 2605), Tuple.Create("\"", 2650) , Tuple.Create(Tuple.Create("", 2613), Tuple.Create <System.Object, System.Int32>("col-sm-" + columnWidth.ToString() , 2613), false) ); WriteLiteral(">\r\n <table"); WriteLiteral(" class=\"table\""); WriteLiteral(">\r\n <tr>\r\n <th>资产</th>\r\n " + " <th>行次</th>\r\n <th>期末数</th>\r\n " + " </tr>\r\n"); for (int j = start; j < end; ++j) { var field = normalFields[j]; Tuple <int, byte, FieldStyle> info = field.Tag as Tuple <int, byte, FieldStyle>; string intendClass = info.Item2 == 0 ? string.Empty : "class=\"pdl-" + info.Item2 + "\""; if (info.Item3 == FieldStyle.Title) { WriteLiteral(" <tr"); WriteLiteral(" class=\"info\""); WriteLiteral(">\r\n <td>"); Write(field.DisplayName); WriteLiteral("</td>\r\n <td></td>\r\n " + " <td></td>\r\n </tr>\r\n"); } else { WriteLiteral(" <tr>\r\n <td "); Write(intendClass); WriteLiteral(">"); Write(field.DisplayName); WriteLiteral("</td>\r\n <td>"); Write(info.Item1); WriteLiteral("</td>\r\n <td>\r\n " + "<span"); WriteLiteral(" class=\"tk-control\""); WriteLiteral(">"); Write(field.Control(dataRow, (DataSet)Model, true)); WriteLiteral("</span>\r\n </td>\r\n </tr>" + "\r\n"); } } WriteLiteral(" </table>\r\n </div>\r\n"); } WriteLiteral(" </div>\r\n </div>\r\n</form>\r\n"); Write(RenderSectionOrDefault("ModuleButtons", "DefaultButtons")); WriteLiteral("\r\n"); }
public override void Execute() { DataSet dataSet = (DataSet)Model; NormalEditData pageData = (NormalEditData)ViewBag.PageData; string title = HtmlUtil.GetEditTitle(dataSet, ViewBag); WriteLiteral("\r\n"); DefineSection("DefaultHeader", () => { WriteLiteral("\r\n"); if (pageData.Header != null) { Write(RenderRazorOutputData(pageData.Header, Model)); } else { WriteLiteral(" <br />\r\n"); WriteLiteral(" <h1"); WriteLiteral(" class=\"text-center\""); WriteLiteral(">"); Write(ViewBag.Title); WriteLiteral("</h1>\r\n"); WriteLiteral(" <br />\r\n"); } }); DefineSection("DefaultFooter", () => { WriteLiteral("\r\n"); WriteLiteral(" "); Write(RenderRazorOutputData(pageData.Footer, Model)); WriteLiteral("\r\n"); }); WriteLiteral("<!DOCTYPE html>\r\n<html>\r\n<head>\r\n <title>"); Write(title); WriteLiteral("</title>\r\n <meta"); WriteLiteral(" http-equiv=\"X-UA-Compatible\""); WriteLiteral(" content=\"IE=edge\""); WriteLiteral(" />\r\n <meta"); WriteLiteral(" http-equiv=\"Content-Type\""); WriteLiteral(" content=\"text/html; charset=utf-8\""); WriteLiteral(" />\r\n <meta"); WriteLiteral(" name=\"viewport\""); WriteLiteral(" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable" + "=0\""); WriteLiteral(" />\r\n"); WriteLiteral(" "); Write(RenderLayoutPartial("../bin/css.cshtml", null)); WriteLiteral("\r\n"); WriteLiteral(" "); Write(ViewBag.Script.CreateUserCss()); WriteLiteral(@" <style> td { vertical-align: middle !important; } .pdl-1 { padding-left: 1.5em !important; } .pdl-2 { padding-left: 2.5em !important; } </style> </head> <body"); WriteAttribute("id", Tuple.Create(" id=\"", 1314), Tuple.Create("\"", 1345) , Tuple.Create(Tuple.Create("", 1319), Tuple.Create <System.Object, System.Int32>(HtmlUtil.GetPageId(Model) , 1319), false) ); WriteLiteral(" class=\"tk-dataPage\""); WriteLiteral(" data-webPath=\""); Write(HtmlUtil.AppVirtualPath); WriteLiteral("\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"container\""); WriteLiteral(">\r\n"); if (pageData.ShowTitle) { Write(RenderSectionOrDefault("Header", "DefaultHeader")); } WriteLiteral(" "); Write(RenderSectionIfDefined("Main", "main.cshtml", Model)); WriteLiteral("\r\n"); WriteLiteral(" "); Write(RenderSectionOrDefault("Footer", "DefaultFooter")); WriteLiteral("\r\n </div>\r\n"); WriteLiteral(" "); Write(RenderLayoutPartial("../bin/js.cshtml", null)); WriteLiteral("\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 1779), Tuple.Create("\"", 1849) , Tuple.Create(Tuple.Create("", 1785), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/toolkit/coreT/toolkit.edit.js".AppVirutalPath() , 1785), false) ); WriteLiteral("> </script>\r\n"); WriteLiteral(" "); Write(ViewBag.Script.CreateUserJavaScript()); WriteLiteral("\r\n</body>\r\n</html>\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.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"); }