/// <summary> /// 生成model文件 /// </summary> /// <param name="fileName"></param> /// <param name="pathRoot"></param> public void BuildMode(string pathRoot) { string buildModePath = pathRoot + "\\App_Code\\DataProvider\\Table"; string newFileName = buildModePath + "\\" + StringDeal.HeadUpper(m_table.EnglishName) + ".cs"; string fileName = pathRoot + "\\Admin\\ManageTableManage\\Template\\{首字母大写表名}.cs.bak"; string fileContent = File.ReadAllText(fileName); string resultContent = BuildByStr(fileContent); File.WriteAllText(newFileName, resultContent, Encoding.UTF8); }
//赋值必要条件 public string GetUpdateConditon() { string str = ""; string members = m_table.SelectMember; string[] values = m_table.SelectValue.Split('|'); if (m_table.EditType == "下拉框表关联") { str = @" List<" + StringDeal.HeadUpper(members) + @"> " + StringDeal.HeadLower(members) + @"List = TableOperate<" + StringDeal.HeadUpper(members) + @">.Select(); " + StringDeal.HeadLower(m_table.Name) + @".DataSource = " + StringDeal.HeadLower(members) + @"List; " + StringDeal.HeadLower(m_table.Name) + @".DataTextField = """ + StringDeal.HeadUpper(values[1]) + @"""; " + StringDeal.HeadLower(m_table.Name) + @".DataValueField = """ + StringDeal.HeadUpper(values[0]) + @"""; "; str += StringDeal.HeadLower(m_table.Name) + ".DataBind();\r\n"; } return(str); }
public string GetSetSearchForm() { if (!m_table.BSearch) { return(""); } string members = m_table.SelectMember; string[] values = m_table.SelectValue.Split('|'); string str = ""; if (m_table.EditType == "时间选择框(datetime)") { str = "begin_" + StringDeal.HeadLower(m_table.Name) + ".Value = GetStrFrom(\"begin_" + StringDeal.HeadUpper(m_table.Name) + "\"); \r\n"; str += "end_" + StringDeal.HeadLower(m_table.Name) + ".Value = GetStrFrom(\"end_" + StringDeal.HeadUpper(m_table.Name) + "\"); \r\n"; } else if (m_table.EditType == "下拉框表关联") { str += @"List<" + StringDeal.HeadUpper(members) + @"> " + StringDeal.HeadLower(members) + @"List = TableOperate<" + StringDeal.HeadUpper(members) + @">.Select(); " + StringDeal.HeadUpper(members) + @" one" + StringDeal.HeadUpper(members) + @" = new " + StringDeal.HeadUpper(members) + @"(); one" + StringDeal.HeadUpper(members) + @"." + StringDeal.HeadUpper(values[0]) + @" = 0; one" + StringDeal.HeadUpper(members) + @"." + StringDeal.HeadUpper(values[1]) + @" = ""选择" + m_table.Brief + @"""; " + StringDeal.HeadLower(members) + @"List.Insert(0, one" + StringDeal.HeadUpper(members) + @"); " + StringDeal.HeadLower(m_table.Name) + @".DataSource = " + StringDeal.HeadLower(members) + @"List; " + StringDeal.HeadLower(m_table.Name) + @".DataTextField = """ + StringDeal.HeadUpper(values[1]) + @"""; " + StringDeal.HeadLower(m_table.Name) + @".DataValueField = """ + StringDeal.HeadUpper(values[0]) + @"""; "; str += StringDeal.HeadLower(m_table.Name) + ".DataBind();\r\n"; str += StringDeal.HeadLower(m_table.Name) + ".Value= GetStrFrom(\"" + StringDeal.HeadUpper(m_table.Name) + "\"); \r\n"; } else if (m_table.EditType == "弹出框表关联") { str = StringDeal.HeadLower(m_table.Name) + ".Value= GetStrFrom(\"" + StringDeal.HeadUpper(m_table.Name) + "\"); \r\n"; str = StringDeal.HeadLower(m_table.Name) + "_name.Value= GetStrFrom(\"" + StringDeal.HeadUpper(m_table.Name) + "_name\"); \r\n"; } else { str = StringDeal.HeadLower(m_table.Name) + ".Value= GetStrFrom(\"" + StringDeal.HeadUpper(m_table.Name) + "\"); \r\n"; } return(str); }
/// <summary> /// 读取数据建立文件 /// </summary> /// <param name="_fileList"></param> public void BuildByFiles(string file, string pathRoot, bool bfugai) { string fileName = pathRoot + "\\Admin\\ManageTableManage\\Template\\" + file + ".bak"; string buildPath = pathRoot + "\\Admin\\Manage" + StringDeal.HeadUpper(m_table.EnglishName); if (!Directory.Exists(buildPath)) { Directory.CreateDirectory(buildPath); } string newFileName = buildPath + "\\" + file; if (File.Exists(newFileName) && !bfugai) { File.Move(newFileName, newFileName + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bak"); } string fileContent = File.ReadAllText(fileName); string resultContent = BuildByStr(fileContent); File.WriteAllText(newFileName, resultContent, Encoding.UTF8); }
public string GetShouYeTanList() { string str = ""; string members = m_table.SelectMember; string[] values = m_table.SelectValue.Split('|'); if (m_table.EditType == "下拉框表关联" || m_table.EditType == "弹出框表关联") { str += " " + StringDeal.HeadUpper(m_table.SelectMember) + " v" + StringDeal.HeadUpper(m_table.Name) + " = new " + StringDeal.HeadUpper(m_table.SelectMember) + "();\r\n"; str += " v" + StringDeal.HeadUpper(m_table.Name) + "." + StringDeal.HeadUpper(values[0]) + " = 0;\r\n"; str += " v" + StringDeal.HeadUpper(m_table.Name) + "." + StringDeal.HeadUpper(values[1]) + " = \"\";\r\n"; str += " " + StringDeal.HeadUpper(m_table.SelectMember) + " c" + StringDeal.HeadUpper(m_table.Name) + " = new " + StringDeal.HeadUpper(m_table.SelectMember) + "();\r\n"; str += " string " + StringDeal.HeadLower(m_table.Name) + "Str = \"where id in(0\";\r\n"; str += " for (int i = 0; i < m_" + StringDeal.HeadLower(m_table.TableName) + "List.Count; i++)\r\n"; str += " {\r\n"; str += " " + StringDeal.HeadLower(m_table.Name) + "Str += \",\" + m_" + StringDeal.HeadLower(m_table.TableName) + "List[i]." + StringDeal.HeadUpper(m_table.Name) + ";\r\n"; str += " }\r\n"; str += " " + StringDeal.HeadLower(m_table.Name) + "Str = " + StringDeal.HeadLower(m_table.Name) + "Str + \")\";\r\n"; str += " c" + StringDeal.HeadUpper(m_table.Name) + ".SetConditon(" + StringDeal.HeadLower(m_table.Name) + "Str);\r\n"; str += " m_" + StringDeal.HeadLower(m_table.Name) + "List = TableOperate<" + StringDeal.HeadUpper(m_table.SelectMember) + ">.Select(v" + StringDeal.HeadUpper(m_table.Name) + ", c" + StringDeal.HeadUpper(m_table.Name) + ");\r\n"; } return(str); }
//赋值 public string GetUpdateSetValue() { string str = ""; string members = m_table.SelectMember; string[] values = m_table.SelectValue.Split('|'); if (m_table.EditType == "复选选择框(checkBox)" || m_table.EditType == "单选选择框(radio)") { str = "FormDeal.SetRadioValue(\"" + StringDeal.HeadLower(m_table.Name) + "\", Convert.ToString({首字母小写表名}." + StringDeal.HeadUpper(m_table.Name) + "), this.Page); \r\n"; } else { str = StringDeal.HeadLower(m_table.Name) + ".Value= Convert.ToString({首字母小写表名}." + StringDeal.HeadUpper(m_table.Name) + "); \r\n"; } if (m_table.EditType == "下拉框表关联" || m_table.EditType == "弹出框表关联") { str += "" + StringDeal.HeadUpper(m_table.SelectMember) + " v" + StringDeal.HeadUpper(m_table.Name) + " = new " + StringDeal.HeadUpper(m_table.SelectMember) + "();\r\n"; str += "v" + StringDeal.HeadUpper(m_table.Name) + "." + values[1] + " = \"\";\r\n"; str += "" + StringDeal.HeadUpper(m_table.SelectMember) + " c" + StringDeal.HeadUpper(m_table.Name) + " = new " + StringDeal.HeadUpper(m_table.SelectMember) + "();\r\n"; str += "c" + StringDeal.HeadUpper(m_table.Name) + "." + values[0] + " = " + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(m_table.Name) + ";\r\n"; str += "" + StringDeal.HeadLower(m_table.Name) + "_name.Value = TableOperate<" + StringDeal.HeadUpper(m_table.SelectMember) + ">.GetOneValue(v" + StringDeal.HeadUpper(m_table.Name) + ", c" + StringDeal.HeadUpper(m_table.Name) + ");\r\n"; //str += " " + StringDeal.HeadUpper(m_table.SelectMember) + " v" + StringDeal.HeadUpper(m_table.Name) + " = new " + StringDeal.HeadUpper(m_table.SelectMember) + "();\r\n"; //str += " v" + StringDeal.HeadUpper(m_table.Name) + "." + StringDeal.HeadUpper(values[0]) + " = 0;\r\n"; //str += " v" + StringDeal.HeadUpper(m_table.Name) + "." + StringDeal.HeadUpper(values[1]) + " = \"\";\r\n"; //str += " " + StringDeal.HeadUpper(m_table.SelectMember) + " c" + StringDeal.HeadUpper(m_table.Name) + " = new " + StringDeal.HeadUpper(m_table.SelectMember) + "();\r\n"; //str += " string " + StringDeal.HeadLower(m_table.Name) + "Str = \"where id in(0\";\r\n"; //str += " for (int i = 0; i < m_" + StringDeal.HeadLower(m_table.TableName) + "LiList.Count; i++)\r\n"; //str += " {\r\n"; //str += " " + StringDeal.HeadLower(m_table.Name) + "Str += \",\" + m_" + StringDeal.HeadLower(m_table.TableName) + "LiList[i]." + StringDeal.HeadUpper(m_table.Name) + ";\r\n"; //str += " }\r\n"; //str += " " + StringDeal.HeadLower(m_table.Name) + "Str = " + StringDeal.HeadLower(m_table.Name) + "Str + \")\";\r\n"; //str += " c" + StringDeal.HeadUpper(m_table.Name) + ".SetConditon(" + StringDeal.HeadLower(m_table.Name) + "Str);\r\n"; //str += " m_" + StringDeal.HeadLower(m_table.Name) + "List = TableOperate<" + StringDeal.HeadUpper(m_table.SelectMember) + ">.Select(v" + StringDeal.HeadUpper(m_table.Name) + ", c" + StringDeal.HeadUpper(m_table.Name) + ");\r\n"; } return(str); }
private string BuildByStr(string templateStr) { bool bSearch = false; bool bDate = false; bool bIndexDate = false; bool bUpload = false; bool bEditer = false; int i = 0; int indexCount = 0; while (templateStr.IndexOf("{循环") != -1) { string forBegin = "{循环" + i + "}"; string forEnd = "{结束循环" + i + "}"; string itemStr = StringDeal.CutString(templateStr, forBegin, forEnd); string newStr = ""; indexCount = 0; int colCount = 0; for (int j = 0; j < m_listTable.Count; j++) { Table table = m_listTable[j]; if ((templateStr == "Edit.aspx" || templateStr == "Edit.aspx.cs") && (table.Name == "AddTime" || table.Name == "AddID")) { continue; } //string[] ziduanZWArr = "编号,添加时间,添加人ID,添加人姓名,审批人,审批结果,钉钉,钉钉发送结果".Split(','); //string[] ziduanArr = "ID,XTAddTime,XTAddID,XTAddName,XTShenPi,XTShenPiResult,XTDingDing,XTDingDingResult".Split(','); //string[] ziduanTypeArr = "2,3,2,0,1,1,1,1".Split(','); string tempStr = itemStr.Replace("{列名}", table.Name); string beginStr11 = "{首页显示}"; string endStr11 = "{结束首页显示}"; string delItemStr11 = StringDeal.CutString(tempStr, beginStr11, endStr11); if (table.BIndex) { tempStr = tempStr.Replace("{首页显示}", ""); tempStr = tempStr.Replace("{结束首页显示}", ""); colCount++; } else { tempStr = tempStr.Replace(beginStr11 + delItemStr11 + endStr11, ""); } beginStr11 = "{搜索字段}"; endStr11 = "{结束搜索字段}"; delItemStr11 = StringDeal.CutString(tempStr, beginStr11, endStr11); if (table.BSearch) { tempStr = tempStr.Replace("{搜索字段}", ""); tempStr = tempStr.Replace("{结束搜索字段}", ""); } else { tempStr = tempStr.Replace(beginStr11 + delItemStr11 + endStr11, ""); } tempStr = tempStr.Replace("{表名}", table.TableName); tempStr = tempStr.Replace("{首字母大写表名}", StringDeal.HeadUpper(table.TableName)); tempStr = tempStr.Replace("{首字母小写表名}", StringDeal.HeadLower(table.TableName)); tempStr = tempStr.Replace("{中文表名}", string.IsNullOrEmpty(table.ChineseTableName) ? table.TableName : table.ChineseTableName); tempStr = tempStr.Replace("{小写列名}", StringDeal.HeadLower(table.Name)); tempStr = tempStr.Replace("{列名NET类型}", table.NetType); tempStr = tempStr.Replace("{首字母大写列名}", StringDeal.HeadUpper(table.Name)); tempStr = tempStr.Replace("{列名sql类型}", table.SqlType); tempStr = tempStr.Replace("{类型转化字符}", table.ConvertString); tempStr = tempStr.Replace("{中文列名}", string.IsNullOrEmpty(table.Brief) ? table.Name : table.Brief); FormItem formItem = new FormItem(table); tempStr = tempStr.Replace("{表单字符串}", formItem.GetForm()); tempStr = tempStr.Replace("{更新表单字符串}", formItem.GetUpdateForm()); tempStr = tempStr.Replace("{添加和更新表单字符串}", formItem.GetServerForm()); string lieLength = "col-sm-3"; if (table.EditType == "可视化编辑器" || table.EditType == "上传选择框(upload)" || table.EditType == "进度条上传") { lieLength = "col-sm-10"; } tempStr = tempStr.Replace("{列的长度}", lieLength); tempStr = tempStr.Replace("{设置值表单字符串}", formItem.GetUpdateSetValue()); tempStr = tempStr.Replace("{设置值表单条件字符串}", formItem.GetUpdateConditon()); tempStr = tempStr.Replace("{验证字符串}", formItem.GetJs()); tempStr = tempStr.Replace("{插入验证是否必须}", formItem.GetInsertNecessary()); tempStr = tempStr.Replace("{更新验证是否必须}", formItem.GetUpdateNecessary()); string liexianshi = "((" + StringDeal.HeadUpper(table.TableName) + ")Container.DataItem)." + StringDeal.HeadUpper(table.Name); if ((table.EditType == "选择框(select)" || table.EditType == "复选选择框(checkBox)" || table.EditType == "单选选择框(radio)") && table.SelectMember != table.SelectValue) { liexianshi = "GetSelect" + StringDeal.HeadUpper(table.Name) + "(" + liexianshi + ")"; } else if (table.EditType == "下拉框表关联" || table.EditType == "弹出框表关联") { liexianshi = "GetTanChu" + StringDeal.HeadUpper(table.Name) + "(" + liexianshi + ")"; } tempStr = tempStr.Replace("{首页列表字段显示}", liexianshi); tempStr = tempStr.Replace("{首页列表字段显示函数}", formItem.GetListShowHanShu()); tempStr = tempStr.Replace("{显示页字段显示函数}", formItem.GetViewShowHanShu()); tempStr = tempStr.Replace("{首页列表弹出字段获取列表}", formItem.GetShouYeTanList()); if (colCount == 2) { string ljie = "<a href=\"View.aspx?" + StringDeal.HeadLower(m_listTable[0].Name) + "=<%#((" + StringDeal.HeadUpper(table.TableName) + ")Container.DataItem)." + StringDeal.HeadUpper(m_listTable[0].Name) + " %>\">"; tempStr = tempStr.Replace("{首页列表链接}", ljie); tempStr = tempStr.Replace("{首页列表链接结束}", "</a>"); } else { tempStr = tempStr.Replace("{首页列表链接}", ""); tempStr = tempStr.Replace("{首页列表链接结束}", ""); } //{首页列表字段显示} if (table.BSearch) { bSearch = true; } if (table.EditType == "时间选择框(datetime)") { bDate = true; } if (table.EditType == "时间选择框(datetime)" && table.BSearch) { bIndexDate = true; } if (table.BIndex) { indexCount++; } if (table.EditType == "进度条上传") { bUpload = true; } if (table.EditType == "可视化编辑器") { bEditer = true; } tempStr = tempStr.Replace("{搜索表单字符串}", formItem.GetSearchForm()); tempStr = tempStr.Replace("{弹出框搜索表单字符串}", formItem.GetTanChuSearchForm()); tempStr = tempStr.Replace("{设置搜索表单字符串}", formItem.GetSetSearchForm()); tempStr = tempStr.Replace("{设置搜索表单查询条件}", formItem.GetSetSearchCondition()); tempStr = tempStr.Replace("{设置搜索表单查询条件1}", formItem.GetSetSearchCondition().Replace("this.Request[", "context.Request[")); tempStr = tempStr.Replace("{表单相关JS}", formItem.GetEditerJsValue()); if (table.EditType == "进度条上传" || table.EditType == "上传选择框(upload)") { string setBiaoDan = "new" + StringDeal.HeadUpper(table.TableName) + "." + StringDeal.HeadUpper(table.Name) + " = this.Request[\"" + StringDeal.HeadLower(table.Name) + "_fileName\"] + \"|\" + this.Request[\"" + StringDeal.HeadLower(table.Name) + "_showName\"] + \"|\" + this.Request[\"" + StringDeal.HeadLower(table.Name) + "_addTime\"];\r\n"; tempStr = tempStr.Replace("{设置上传文件列表表单}", setBiaoDan); } else { tempStr = tempStr.Replace("{设置上传文件列表表单}", ""); } if (table.Name == "DaKuanZhuangTai" || table.Name == "XTShenHeZhuangTai") { string setBiaoDan = "new" + StringDeal.HeadUpper(table.TableName) + "." + StringDeal.HeadUpper(table.Name) + " = 0;\r\n"; tempStr = tempStr.Replace("{设置值数字默认值}", setBiaoDan); } else { tempStr = tempStr.Replace("{设置值数字默认值}", ""); } newStr += tempStr; } itemStr = "{循环" + i + "}" + itemStr + "{结束循环" + i + "}"; templateStr = templateStr.Replace(itemStr, newStr); i++; } #region 处理特殊循环 string teshuForBegin = "{第二列开始循环}"; string teshuForEnd = "{结束第二列开始循环}"; string teshuItemStr = StringDeal.CutString(templateStr, teshuForBegin, teshuForEnd); string teshuNewStr = ""; for (int j = 1; j < m_listTable.Count; j++) { Table table = m_listTable[j]; if ((templateStr == "Edit.aspx" || templateStr == "Edit.aspx.cs") && (table.Name == "AddTime" || table.Name == "AddID")) { continue; } string tempStr = teshuItemStr.Replace("{列名}", table.Name); tempStr = tempStr.Replace("{表名}", table.TableName); tempStr = tempStr.Replace("{首字母大写表名}", StringDeal.HeadUpper(table.TableName)); tempStr = tempStr.Replace("{首字母小写表名}", StringDeal.HeadLower(table.TableName)); tempStr = tempStr.Replace("{小写列名}", StringDeal.HeadLower(table.Name)); tempStr = tempStr.Replace("{列名NET类型}", table.NetType); tempStr = tempStr.Replace("{首字母大写列名}", StringDeal.HeadUpper(table.Name)); tempStr = tempStr.Replace("{列名sql类型}", table.SqlType); tempStr = tempStr.Replace("{类型转化字符}", table.ConvertString); tempStr = tempStr.Replace("{中文列名}", string.IsNullOrEmpty(table.Brief) ? table.Name : table.Brief); FormItem formItem = new FormItem(table); tempStr = tempStr.Replace("{表单字符串}", formItem.GetForm()); tempStr = tempStr.Replace("{更新表单字符串}", formItem.GetUpdateForm()); tempStr = tempStr.Replace("{添加和更新表单字符串}", formItem.GetServerForm()); string lieLength = "col-sm-3"; if (table.EditType == "可视化编辑器" || table.EditType == "上传选择框(upload)" || table.EditType == "进度条上传") { lieLength = "col-sm-10"; } tempStr = tempStr.Replace("{列的长度}", lieLength); tempStr = tempStr.Replace("{设置值表单字符串}", formItem.GetUpdateSetValue()); tempStr = tempStr.Replace("{验证字符串}", formItem.GetJs()); tempStr = tempStr.Replace("{插入验证是否必须}", formItem.GetInsertNecessary()); tempStr = tempStr.Replace("{更新验证是否必须}", formItem.GetUpdateNecessary()); // <%#getFileHtml(m_baoXiaoGuanLi.BaoXiaoPingZheng, "baoXiaoPingZheng", false)%> <%#{文件列表预览函数}m_{首字母小写表名}.{首字母大写列名}{文件列表预览函数结束}%> teshuNewStr += tempStr; } //templateStr = templateStr.Replace("{循环" + i + "}", ""); //templateStr = templateStr.Replace("{结束循环" + i + "}", ""); //newStr = "{循环" + i + "}" + newStr + "{结束循环" + i + "}"; teshuItemStr = "{第二列开始循环}" + teshuItemStr + "{结束第二列开始循环}"; templateStr = templateStr.Replace(teshuItemStr, teshuNewStr); #endregion #region 处理特殊循环1 string teshuForBegin1 = "{第二列开始循环1}"; string teshuForEnd1 = "{结束第二列开始循环1}"; string teshuItemStr1 = StringDeal.CutString(templateStr, teshuForBegin1, teshuForEnd1); string teshuNewStr1 = ""; for (int j = 1; j < m_listTable.Count; j++) { Table table = m_listTable[j]; if ((templateStr == "Edit.aspx" || templateStr == "Edit.aspx.cs") && (table.Name == "AddTime" || table.Name == "AddID")) { continue; } string tempStr = teshuItemStr1.Replace("{列名}", table.Name); tempStr = tempStr.Replace("{表名}", table.TableName); tempStr = tempStr.Replace("{首字母大写表名}", StringDeal.HeadUpper(table.TableName)); tempStr = tempStr.Replace("{首字母小写表名}", StringDeal.HeadLower(table.TableName)); tempStr = tempStr.Replace("{小写列名}", StringDeal.HeadLower(table.Name)); tempStr = tempStr.Replace("{列名NET类型}", table.NetType); tempStr = tempStr.Replace("{首字母大写列名}", StringDeal.HeadUpper(table.Name)); tempStr = tempStr.Replace("{列名sql类型}", table.SqlType); tempStr = tempStr.Replace("{类型转化字符}", table.ConvertString); tempStr = tempStr.Replace("{中文列名}", string.IsNullOrEmpty(table.Brief) ? table.Name : table.Brief); FormItem formItem = new FormItem(table); tempStr = tempStr.Replace("{表单字符串}", formItem.GetForm()); tempStr = tempStr.Replace("{更新表单字符串}", formItem.GetUpdateForm()); tempStr = tempStr.Replace("{添加和更新表单字符串}", formItem.GetServerForm()); string lieLength = "col-sm-3"; if (table.EditType == "可视化编辑器" || table.EditType == "上传选择框(upload)" || table.EditType == "进度条上传") { lieLength = "col-sm-10"; } tempStr = tempStr.Replace("{列的长度}", lieLength); tempStr = tempStr.Replace("{设置值表单字符串}", formItem.GetUpdateSetValue()); tempStr = tempStr.Replace("{验证字符串}", formItem.GetJs()); tempStr = tempStr.Replace("{插入验证是否必须}", formItem.GetInsertNecessary()); tempStr = tempStr.Replace("{更新验证是否必须}", formItem.GetUpdateNecessary()); if (table.EditType == "上传选择框(upload)" || table.EditType == "进度条上传") { tempStr = tempStr.Replace("{文件列表预览函数}", "getFileHtml("); tempStr = tempStr.Replace("{文件列表预览函数结束}", ", \"" + StringDeal.HeadLower(table.Name) + "\", true)"); } else if ((table.EditType == "选择框(select)" || table.EditType == "复选选择框(checkBox)" || table.EditType == "单选选择框(radio)") && table.SelectMember != table.SelectValue) { //liexianshi = "GetSelect" + StringDeal.HeadUpper(table.Name) + "(" + liexianshi + ")"; tempStr = tempStr.Replace("{文件列表预览函数}", "GetSelect" + StringDeal.HeadUpper(table.Name) + "("); tempStr = tempStr.Replace("{文件列表预览函数结束}", ")"); } else if (table.EditType == "下拉框表关联" || table.EditType == "弹出框表关联") { //liexianshi = "GetView" + StringDeal.HeadUpper(table.Name) + "(" + liexianshi + ")"; tempStr = tempStr.Replace("{文件列表预览函数}", "GetView" + StringDeal.HeadUpper(table.Name) + "("); tempStr = tempStr.Replace("{文件列表预览函数结束}", ")"); } else { tempStr = tempStr.Replace("{文件列表预览函数}", ""); tempStr = tempStr.Replace("{文件列表预览函数结束}", ""); } teshuNewStr1 += tempStr; } //templateStr = templateStr.Replace("{循环" + i + "}", ""); //templateStr = templateStr.Replace("{结束循环" + i + "}", ""); //newStr = "{循环" + i + "}" + newStr + "{结束循环" + i + "}"; teshuItemStr1 = "{第二列开始循环1}" + teshuItemStr1 + "{结束第二列开始循环1}"; templateStr = templateStr.Replace(teshuItemStr1, teshuNewStr1); #endregion #region 处理默认字段不显示循环1 teshuForBegin1 = "{不显示默认循环1}"; teshuForEnd1 = "{结束不显示默认循环1}"; teshuItemStr1 = StringDeal.CutString(templateStr, teshuForBegin1, teshuForEnd1); teshuNewStr1 = ""; for (int j = 1; j < m_listTable.Count; j++) { Table table = m_listTable[j]; if (table.Name == "AddTime" || table.Name == "AddID") { continue; } string tempStr = teshuItemStr1.Replace("{列名}", table.Name); tempStr = tempStr.Replace("{表名}", table.TableName); tempStr = tempStr.Replace("{首字母大写表名}", StringDeal.HeadUpper(table.TableName)); tempStr = tempStr.Replace("{首字母小写表名}", StringDeal.HeadLower(table.TableName)); tempStr = tempStr.Replace("{小写列名}", StringDeal.HeadLower(table.Name)); tempStr = tempStr.Replace("{列名NET类型}", table.NetType); tempStr = tempStr.Replace("{首字母大写列名}", StringDeal.HeadUpper(table.Name)); tempStr = tempStr.Replace("{列名sql类型}", table.SqlType); tempStr = tempStr.Replace("{类型转化字符}", table.ConvertString); tempStr = tempStr.Replace("{中文列名}", string.IsNullOrEmpty(table.Brief) ? table.Name : table.Brief); FormItem formItem = new FormItem(table); tempStr = tempStr.Replace("{表单字符串}", formItem.GetForm()); tempStr = tempStr.Replace("{更新表单字符串}", formItem.GetUpdateForm()); tempStr = tempStr.Replace("{添加和更新表单字符串}", formItem.GetServerForm()); string lieLength = "col-sm-3"; if (table.EditType == "可视化编辑器" || table.EditType == "上传选择框(upload)" || table.EditType == "进度条上传") { lieLength = "col-sm-10"; } tempStr = tempStr.Replace("{列的长度}", lieLength); tempStr = tempStr.Replace("{设置值表单字符串}", formItem.GetUpdateSetValue()); tempStr = tempStr.Replace("{验证字符串}", formItem.GetJs()); tempStr = tempStr.Replace("{插入验证是否必须}", formItem.GetInsertNecessary()); tempStr = tempStr.Replace("{更新验证是否必须}", formItem.GetUpdateNecessary()); teshuNewStr1 += tempStr; } //templateStr = templateStr.Replace("{循环" + i + "}", ""); //templateStr = templateStr.Replace("{结束循环" + i + "}", ""); //newStr = "{循环" + i + "}" + newStr + "{结束循环" + i + "}"; teshuItemStr1 = "{不显示默认循环1}" + teshuItemStr1 + "{结束不显示默认循环1}"; templateStr = templateStr.Replace(teshuItemStr1, teshuNewStr1); #endregion Table table1 = m_listTable[0]; //TypeUnit oneTypeUnit = TypeDeal.Convert(oneVarData.VarType); templateStr = templateStr.Replace("{第一列首字母大写列名}", StringDeal.HeadUpper(table1.Name)); templateStr = templateStr.Replace("{第一列列名}", table1.Name); templateStr = templateStr.Replace("{第一列列名NET类型}", table1.NetType); templateStr = templateStr.Replace("{第一列列名sql类型}", table1.SqlType); templateStr = templateStr.Replace("{第一列类型转化字符}", table1.ConvertString); templateStr = templateStr.Replace("{第一列小写列名}", StringDeal.HeadLower(table1.Name)); templateStr = templateStr.Replace("{列数+1}", (m_listTable.Count + 1) + ""); templateStr = templateStr.Replace("{列数+2}", (m_listTable.Count + 2) + ""); templateStr = templateStr.Replace("{首页列数+1}", (indexCount + 1) + ""); templateStr = templateStr.Replace("{首页列数+2}", (indexCount + 2) + ""); templateStr = templateStr.Replace("{首页列数+3}", (indexCount + 3) + ""); templateStr = templateStr.Replace("{首页列数+4}", (indexCount + 4) + ""); templateStr = templateStr.Replace("{表名}", table1.TableName); templateStr = templateStr.Replace("{中文表名}", string.IsNullOrEmpty(table1.ChineseTableName) ? table1.TableName : table1.ChineseTableName); templateStr = templateStr.Replace("{首字母大写表名}", StringDeal.HeadUpper(table1.TableName)); templateStr = templateStr.Replace("{首字母小写表名}", StringDeal.HeadLower(table1.TableName)); templateStr = templateStr.Replace("{现在时间}", DateTime.Now.ToString()); if (m_table.ShenPiID > 0) { string shenpiStr = "DingDingSpHelper helper = new DingDingSpHelper();\r\n"; shenpiStr += "new" + StringDeal.HeadUpper(table1.TableName) + "." + StringDeal.HeadUpper(table1.Name) + " = _" + StringDeal.HeadLower(table1.Name) + ";\r\n"; shenpiStr += "helper.Send(new" + StringDeal.HeadUpper(table1.TableName) + ", TableOperate<TableManage>.GetRowData(new TableManage() { EnglishName = new" + StringDeal.HeadUpper(table1.TableName) + ".GetType().Name }));\r\n"; templateStr = templateStr.Replace("{添加审批流程}", shenpiStr); } else { templateStr = templateStr.Replace("{添加审批流程}", ""); } //string ceshi11 = "<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"Delete.aspx.cs\" Inherits=\"Admin_Manage{首字母大写表名}_Delete\" %>"; //ceshi11 = ceshi11.Replace("{首字母大写表名}", StringDeal.HeadUpper(table1.TableName)); //templateStr = templateStr.Replace("首字母大写表名", "测测"); string beginStr111 = "{搜索}"; string endStr111 = "{结束搜索}"; string delItemStr111 = StringDeal.CutString(templateStr, beginStr111, endStr111); if (bSearch) { templateStr = templateStr.Replace("{搜索}", ""); templateStr = templateStr.Replace("{结束搜索}", ""); } else { templateStr = templateStr.Replace(beginStr111 + delItemStr111 + endStr111, ""); } if (bDate) { templateStr = templateStr.Replace("{日期表单JS}", @" <link rel=""stylesheet"" type=""text/css"" media=""all"" href=""../calendar/calendar-win2k-cold-1.css"" title=""win2k-cold-1"" /> <script type=""text/javascript"" src=""../calendar/calendar.js""></script> <script type=""text/javascript"" src=""../calendar/lang/calendar-zh.js""></script> <script type=""text/javascript"" src=""../calendar/calendar-setup.js""></script>"); } else { templateStr = templateStr.Replace("{日期表单JS}", ""); } if (bIndexDate) { templateStr = templateStr.Replace("{搜索日期表单JS}", @" <link rel=""stylesheet"" type=""text/css"" media=""all"" href=""../calendar/calendar-win2k-cold-1.css"" title=""win2k-cold-1"" /> <script type=""text/javascript"" src=""../calendar/calendar.js""></script> <script type=""text/javascript"" src=""../calendar/lang/calendar-zh.js""></script> <script type=""text/javascript"" src=""../calendar/calendar-setup.js""></script>"); } else { templateStr = templateStr.Replace("{搜索日期表单JS}", ""); } if (bEditer) { templateStr = templateStr.Replace("{可视化编辑器JS}", @"<script type=""text/javascript"" charset=""utf-8"" src=""../../kindeditor/kindeditor.js""></script>"); } else { templateStr = templateStr.Replace("{可视化编辑器JS}", ""); } if (bUpload) { templateStr = templateStr.Replace("{进度条上传JS}", @" <script type=""text/javascript"" src=""../swfupload/swfupload.js""></script> <script type=""text/javascript"" src=""../js/handlers.js""></script> "); } else { templateStr = templateStr.Replace("{进度条上传JS}", ""); } if (bEditer) { templateStr = templateStr.Replace("{是否带有可视化编辑器}", " ValidateRequest=\"false\" "); } else { templateStr = templateStr.Replace("{是否带有可视化编辑器}", ""); } string beginStr = "{删除右侧,}"; string endStr = "{结束删除右侧,}"; string delItemStr = StringDeal.CutString(templateStr, beginStr, endStr); string newDelStr = delItemStr.TrimEnd(',', ' '); delItemStr = beginStr + delItemStr + endStr; templateStr = templateStr.Replace(delItemStr, newDelStr); beginStr = "{删除右侧||}"; endStr = "{结束删除右侧||}"; delItemStr = StringDeal.CutString(templateStr, beginStr, endStr); newDelStr = delItemStr.TrimEnd('|', ' '); //newDelStr = delItemStr.TrimEnd('|'); delItemStr = beginStr + delItemStr + endStr; templateStr = templateStr.Replace(delItemStr, newDelStr); return(templateStr); }
public string GetViewShowHanShu() { string str = ""; string[] members = m_table.SelectMember.Split('|'); string[] value = m_table.SelectValue.Split('|'); if (m_table.EditType == "复选选择框(checkBox)" || m_table.EditType == "选择框(select)" || m_table.EditType == "单选选择框(radio)") { if (m_table.SelectMember != m_table.SelectValue) { str += "#region " + m_table.Brief + "显示函数\r\n"; str += "protected string GetSelect" + StringDeal.HeadUpper(m_table.Name) + "(" + m_table.NetType + " word)\r\n"; str += "{\r\n"; str += " switch (word)\r\n"; str += " {\r\n"; for (int i = 0; i < members.Length; i++) { if (m_table.NetType == "string") { str += " case \"" + value[i] + "\":\r\n"; } else { str += " case " + value[i] + ":\r\n"; } str += " return \"" + members[i] + "\";\r\n"; } str += " default:\r\n"; str += " return \"\";\r\n"; str += " }\r\n"; str += "}\r\n"; str += "#endregion \r\n"; } } else if (m_table.EditType == "下拉框表关联" || m_table.EditType == "弹出框表关联") { if (value.Length == 2) { string name = value[0]; string name1 = value[1]; str += "#region " + m_table.Brief + "表关联显示函数\r\n"; str += "protected string GetView" + StringDeal.HeadUpper(m_table.Name) + "(" + m_table.NetType + " word) \r\n"; str += "{ \r\n"; str += "" + StringDeal.HeadUpper(m_table.SelectMember) + " v" + StringDeal.HeadUpper(m_table.Name) + " = new " + StringDeal.HeadUpper(m_table.SelectMember) + "();\r\n"; str += "v" + StringDeal.HeadUpper(m_table.Name) + "." + value[1] + " = \"\";\r\n"; str += "" + StringDeal.HeadUpper(m_table.SelectMember) + " c" + StringDeal.HeadUpper(m_table.Name) + " = new " + StringDeal.HeadUpper(m_table.SelectMember) + "();\r\n"; str += "c" + StringDeal.HeadUpper(m_table.Name) + "." + value[0] + " = word;\r\n"; str += "return TableOperate<" + StringDeal.HeadUpper(m_table.SelectMember) + ">.GetOneValue(v" + StringDeal.HeadUpper(m_table.Name) + ", c" + StringDeal.HeadUpper(m_table.Name) + ");\r\n"; //str += " for (int i = 0; i < m_" + StringDeal.HeadLower(m_table.Name) + "List.Count; i++) \r\n"; // str += " { \r\n"; // str += " if (m_" + StringDeal.HeadLower(m_table.Name) + "List[i]." + StringDeal.HeadUpper(name) + " == word) \r\n"; // str += " { \r\n"; // str += " return m_" + StringDeal.HeadLower(m_table.Name) + "List[i]." + StringDeal.HeadUpper(name1) + "; \r\n"; // str += " } \r\n"; // str += " } \r\n"; // str += " return \"\"; \r\n"; str += "} \r\n"; str += "#endregion \r\n"; } } return(str); }
public string GetServerForm() { string str = ""; string[] members = m_table.SelectMember.Split('|'); string[] value = m_table.SelectValue.Split('|'); string strNecessary = ""; string strCheckType = ""; if (m_table.Necessary) { strNecessary = "required"; } if (m_table.NetType == "int") { strCheckType = " checkint"; } else if (m_table.NetType == "double") { strCheckType = " checkfloat"; } switch (m_table.EditType) { case "文本框(text)": str = "<input requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" class=\"form-control " + strNecessary + strCheckType + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" runat=\"server\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" /> "; break; case "密码框(password)": str = "<input requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" class=\"form-control " + strNecessary + strCheckType + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" type=\"password\" runat=\"server\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" /> "; break; case "复选选择框(checkBox)": for (int i = 0; i < members.Length; i++) { str += "<input requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" type=\"checkbox\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"_" + StringDeal.HeadLower(m_table.Name) + "__" + i + "\" value=\"" + value[i] + "\" runat=\"server\" />" + members[i] + " \r\n "; } if (string.IsNullOrEmpty(m_table.SelectMember)) { str = "<input requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" type=\"checkbox\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"_" + StringDeal.HeadLower(m_table.Name) + "__\" value=\"" + StringDeal.HeadLower(m_table.Name) + "\" runat=\"server\" />" + StringDeal.HeadLower(m_table.Name) + " \r\n "; } break; case "选择框(select)": str = "<select requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" class=\"form-control " + strNecessary + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" runat=\"server\"> \r\n"; for (int i = 0; i < members.Length; i++) { str += "<option value=\"" + value[i] + "\">" + members[i] + "</option> \r\n"; } str += "</select>"; break; //"_" + strID + "__" case "单选选择框(radio)": for (int i = 0; i < members.Length; i++) { str += "<input requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"_" + StringDeal.HeadLower(m_table.Name) + "__" + i + "\" type=\"radio\" value=\"" + value[i] + "\" runat=\"server\" />" + members[i] + " \r\n"; } break; case "时间选择框(datetime)": str = "<div class=\"input-group date\"><span class=\"input-group-addon\"><i class=\"fa fa-calendar\"></i></span><input requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" class=\"form-control form-datetime " + strNecessary + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" readonly=\"readonly\" runat=\"server\" /></div>"; break; case "上传选择框(upload)": str = @"<INPUT requiredName=""" + StringDeal.HeadLower(m_table.Brief) + @""" type=""hidden"" class=""form-control " + strNecessary + strCheckType + @""" name=""" + StringDeal.HeadLower(m_table.Name) + @""" id=""" + StringDeal.HeadLower(m_table.Name) + @""" runat=""server"" > <iframe id=""Iframe1_" + StringDeal.HeadLower(m_table.Name) + @""" name=""upimg_" + StringDeal.HeadLower(m_table.Name) + @""" src=""../UpFile.aspx?name=" + StringDeal.HeadLower(m_table.Name) + @""" width=""365"" height=""48"" frameborder=0></IFRAME> <br /> <div id=""div_" + StringDeal.HeadLower(m_table.Name) + @"""> <%#getFileHtml(" + StringDeal.HeadLower(m_table.TableName) + @"." + StringDeal.HeadUpper(m_table.Name) + @", """ + StringDeal.HeadLower(m_table.Name) + @""")%> </div> "; break; case "文本框(textarea)": str = "<textarea requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" class=\"form-control " + strNecessary + strCheckType + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" cols=\"50\" rows=\"6\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" runat=\"server\" ></textarea>"; break; case "可视化编辑器": str = "<textarea requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" class=\"form-control summernote " + strNecessary + strCheckType + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" style=\" width:100%; height:400px\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" runat=\"server\"></textarea>"; break; case "进度条上传": str = @"<INPUT requiredName=""" + StringDeal.HeadLower(m_table.Brief) + @""" type=""hidden"" class=""form-control " + strNecessary + strCheckType + @""" name=""" + StringDeal.HeadLower(m_table.Name) + @""" id=""" + StringDeal.HeadLower(m_table.Name) + @""" runat=""server""> <iframe id=""Iframe1_" + StringDeal.HeadLower(m_table.Name) + @""" name=""upimg_" + StringDeal.HeadLower(m_table.Name) + @""" src=""../UpFileProgress.aspx?name=" + StringDeal.HeadLower(m_table.Name) + @""" width=""375"" height=""140"" frameborder=0></IFRAME> <br /> <div id=""div_" + StringDeal.HeadLower(m_table.Name) + @"""> <%#getFileHtml(" + StringDeal.HeadLower(m_table.TableName) + @"." + StringDeal.HeadUpper(m_table.Name) + @", """ + StringDeal.HeadLower(m_table.Name) + @""")%> </div> "; break; case "下拉框表关联": str = "<select requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" class=\"form-control " + strNecessary + strCheckType + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" runat=\"server\" > </select>"; break; case "弹出框表关联": str = "<input type=\"hidden\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" runat=\"server\"/>"; str += "<input requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" readonly=\"readonly\" placeholder=\"点击选择" + m_table.Brief + "\" class=\"form-control form-showpanel " + strNecessary + "\" vid=\"" + StringDeal.HeadLower(m_table.Name) + "\" modal_title=\"选择" + m_table.Brief + "\" modal_url=\"../Manage" + m_table.SelectMember + "/Modal.aspx\" name=\"" + StringDeal.HeadLower(m_table.Name) + "_name\" id=\"" + StringDeal.HeadLower(m_table.Name) + "_name\" runat=\"server\"/>"; break; default: str = "<input requiredName=\"" + StringDeal.HeadLower(m_table.Brief) + "\" class=\"form-control " + strNecessary + strCheckType + "\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" runat=\"server\" /> "; break; } return(str); }
//没在用 public string GetUpdateForm() { string str = ""; string[] members = m_table.SelectMember.Split('|'); string[] value = m_table.SelectValue.Split('|'); string strNecessary = ""; if (m_table.Necessary) { strNecessary = "required"; } switch (m_table.EditType) { case "文本框(text)": str = "<input class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" value=\"<%#" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "%>\" /> "; break; case "密码框(password)": str = "<input class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" type=\"password\" value=\"<%#" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "%>\" /> "; break; case "复选选择框(checkBox)": for (int i = 0; i < members.Length; i++) { str += "<input type=\"checkbox\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" value=\"" + value[i] + "\" <%#SetChecked(Convert.ToString(" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "), \"" + value[i] + "\") %> />" + members[i] + ""; } if (string.IsNullOrEmpty(m_table.SelectMember)) { str = "<input type=\"checkbox\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" value=\"" + StringDeal.HeadLower(m_table.Name) + "\" <%#SetChecked(Convert.ToString(" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "), " + StringDeal.HeadLower(m_table.Name) + ") %>/>" + StringDeal.HeadLower(m_table.Name) + ""; } break; case "选择框(select)": str = "<select class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" >"; for (int i = 0; i < members.Length; i++) { str += "<option value=\"" + value[i] + "\" <%#SetSelected(Convert.ToString(" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "), \"" + value[i] + "\") %> >" + members[i] + "</option>"; } str += "</select>"; break; case "单选选择框(radio)": for (int i = 0; i < members.Length; i++) { str += "<input name=\"" + StringDeal.HeadLower(m_table.Name) + "\" type=\"radio\" value=\"" + value[i] + "\" <%#SetChecked(Convert.ToString(" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "), \"" + value[i] + "\") %> />" + members[i] + ""; } break; case "时间选择框(datetime)": str = "<input class=\"form-control form-datetime\"" + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" value=\"<%#" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "%>\" readonly=\"readonly\" />"; break; case "上传选择框(upload)": str = @"<INPUT class=""form-control"" " + strNecessary + @" name=""" + StringDeal.HeadLower(m_table.Name) + @""" value=""<%#" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + @"%>"" > <input type=""button"" id=""btn_" + StringDeal.HeadLower(m_table.Name) + @""" value=""上传"" onClick=""openwin(this);"" /> </td> </tr> <TR id=""upPic_" + StringDeal.HeadLower(m_table.Name) + @""" style="" display:none""> <TD class=row height=30 style=""width: 83px"">上传图片:</TD> <TD class=row ><iframe id=""Iframe1_" + StringDeal.HeadLower(m_table.Name) + @""" name=""upimg_" + StringDeal.HeadLower(m_table.Name) + @""" src=""../UpFile.aspx?name=" + StringDeal.HeadLower(m_table.Name) + @""" width=""450"" height=""55"" frameborder=0></IFRAME>"; break; case "文本框(textarea)": str = "<textarea class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" cols=\"50\" rows=\"10\" ><%#" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "</textarea>"; break; default: str = "<input class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" value=\"<%#" + StringDeal.HeadLower(m_table.TableName) + "." + StringDeal.HeadUpper(StringDeal.HeadLower(m_table.Name)) + "%>\" /> "; break; } return(str); }
public string GetSetSearchCondition() { if (!m_table.BSearch) { return(""); } string members = m_table.SelectMember; string[] values = m_table.SelectValue.Split('|'); string str = ""; if (m_table.EditType == "时间选择框(datetime)") { str = @" #region " + m_table.Brief + @" if (GetStrFrom(""begin_" + StringDeal.HeadLower(m_table.Name) + @""") != """") { DateTime " + StringDeal.HeadUpper(m_table.Name) + @"begin = Convert." + m_table.ConvertString + @"(this.Request[""begin_" + StringDeal.HeadLower(m_table.Name) + @"""]); condition.AddConditon("" and " + StringDeal.HeadUpper(m_table.Name) + @">=@begin_" + StringDeal.HeadUpper(m_table.Name) + @" ""); condition.AddParameter(""begin_" + StringDeal.HeadUpper(m_table.Name) + @""", " + StringDeal.HeadUpper(m_table.Name) + @"begin); }"; str += @" if (GetStrFrom(""end_" + StringDeal.HeadLower(m_table.Name) + @""") != """") { DateTime " + StringDeal.HeadUpper(m_table.Name) + @"end = Convert." + m_table.ConvertString + @"(this.Request[""end_" + StringDeal.HeadLower(m_table.Name) + @"""]); condition.AddConditon("" and " + StringDeal.HeadUpper(m_table.Name) + @"<=@end_" + StringDeal.HeadUpper(m_table.Name) + @" ""); condition.AddParameter(""end_" + StringDeal.HeadUpper(m_table.Name) + @""", " + StringDeal.HeadUpper(m_table.Name) + @"end); } #endregion "; } else { if (m_table.NetType == "long" || m_table.NetType == "decimal" || m_table.NetType == "double" || m_table.NetType == "int" || m_table.NetType == "Single" || m_table.NetType == "UInt32") { str = @" #region " + m_table.Brief + @" " + m_table.NetType + @" condition" + StringDeal.HeadUpper(m_table.Name) + @" = -1 ;"; str += @" if (!string.IsNullOrEmpty(this.Request[""" + StringDeal.HeadUpper(m_table.Name) + @"""])) { condition" + StringDeal.HeadUpper(m_table.Name) + @" = Convert." + m_table.ConvertString + @"(this.Request[""" + StringDeal.HeadLower(m_table.Name) + @"""]); } if (condition" + StringDeal.HeadUpper(m_table.Name) + @" != -1) { condition." + StringDeal.HeadUpper(m_table.Name) + @" = condition" + StringDeal.HeadUpper(m_table.Name) + @" ; } #endregion "; } else { str = @" #region " + m_table.Brief + @" if (!string.IsNullOrEmpty(this.Request[""" + StringDeal.HeadUpper(m_table.Name) + @"""])) { " + m_table.NetType + @" condition" + StringDeal.HeadUpper(m_table.Name) + @" = Convert." + m_table.ConvertString + @"(this.Request[""" + StringDeal.HeadLower(m_table.Name) + @"""]); condition." + StringDeal.HeadUpper(m_table.Name) + @" = ""%"" + condition" + StringDeal.HeadUpper(m_table.Name) + @" + ""%""; condition.AddAttach(""" + StringDeal.HeadUpper(m_table.Name) + @""", ""like""); } #endregion "; } } return(str); }
//没在用 public string GetForm() { string str = ""; string[] members = m_table.SelectMember.Split('|'); string[] value = m_table.SelectValue.Split('|'); string strNecessary = ""; if (m_table.Necessary) { strNecessary = "required"; } switch (m_table.EditType) { case "文本框(text)": str = "<input type=\"text\" class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" /> "; break; case "密码框(password)": str = "<input class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" type=\"password\" /> "; break; case "复选选择框(checkBox)": for (int i = 0; i < members.Length; i++) { str += "<label class=\"checkbox-inline i-checks\"><input type=\"checkbox\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" value=\"" + value[i] + "\" />" + members[i] + "</label> "; } if (string.IsNullOrEmpty(m_table.SelectMember)) { str = "<label class=\"checkbox-inline i-checks\"><input type=\"checkbox\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" value=\"" + StringDeal.HeadLower(m_table.Name) + "\" />" + StringDeal.HeadLower(m_table.Name) + "</label> "; } break; case "选择框(select)": str = "<select class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" >"; for (int i = 0; i < members.Length; i++) { str += "<option value=\"" + value[i] + "\">" + members[i] + "</option>"; } str += "</select>"; break; case "单选选择框(radio)": for (int i = 0; i < members.Length; i++) { str += "<input class=\"form-control\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" type=\"radio\" value=\"" + value[i] + "\" />" + members[i] + ""; } break; case "时间选择框(datetime)": str = "<div class=\"input-group date\"><span class=\"input-group-addon\"><i class=\"fa fa-calendar\"></i></span><input class=\"form-control form-datetime\"" + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" readonly=\"readonly\" /></div>"; break; case "上传选择框(upload)": str = @"<INPUT class=""form-control"" " + strNecessary + @" name=""" + StringDeal.HeadLower(m_table.Name) + @""" > <input type=""button"" id=""btn_" + StringDeal.HeadLower(m_table.Name) + @""" value=""上传"" onClick=""openwin(this);"" /> </td> </tr> <TR id=""upPic_" + StringDeal.HeadLower(m_table.Name) + @""" style="" display:none""> <TD class=row height=30 style=""width: 83px"">上传图片:</TD> <TD class=row ><iframe id=""Iframe1_" + StringDeal.HeadLower(m_table.Name) + @""" name=""upimg_" + StringDeal.HeadLower(m_table.Name) + @""" src=""../UpFile.aspx?name=" + StringDeal.HeadLower(m_table.Name) + @""" width=""450"" height=""55"" frameborder=0></IFRAME>"; break; case "文本框(textarea)": str = "<textarea class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" cols=\"50\" rows=\"10\" ></textarea>"; break; case "可视化编辑器": str = "<textarea class=\"form-control\" name=\"" + StringDeal.HeadLower(m_table.Name) + "\" cols=\"50\" rows=\"10\" ></textarea>"; break; case "进度条上传": str = @"<INPUT class=""form-control"" name=""" + StringDeal.HeadLower(m_table.Name) + @""" > <span id=""sBPlace_" + StringDeal.HeadLower(m_table.Name) + @""" ></span> <span id=""sBPlace1" + StringDeal.HeadLower(m_table.Name) + @""" ></span> "; break; case "下拉框表关联": str = @"<select class=""form-control"" " + strNecessary + @" name=""" + StringDeal.HeadLower(m_table.Name) + @""" id=""" + StringDeal.HeadLower(m_table.Name) + @""" > <asp:repeater id=""Repeater1"" runat=""server"" DataSource=""<%# m_" + StringDeal.HeadLower(m_table.Name) + @"List %>""> <ItemTemplate> <option value=""<%# ((" + StringDeal.HeadUpper(m_table.Name) + @")Container.DataItem).ID%>""><%# ((" + StringDeal.HeadUpper(m_table.Name) + @")Container.DataItem).Name%></option> </ItemTemplate> </asp:repeater> </select> "; break; case "弹出框表关联": str = "<input type=\"hidden\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" id=\"" + StringDeal.HeadLower(m_table.Name) + "\" />"; str += "<input readonly=\"readonly\" class=\"form-control form-showpanel\" vid=\"" + StringDeal.HeadLower(m_table.Name) + "\" modal_title=\"选择" + m_table.Brief + "\" modal_url=\"../Manage" + m_table.SelectMember + "/Modal.aspx\" name=\"" + StringDeal.HeadLower(m_table.Name) + "_name\" id=\"" + StringDeal.HeadLower(m_table.Name) + "_name\"/>"; break; default: str = "<input class=\"form-control\" " + strNecessary + " name=\"" + StringDeal.HeadLower(m_table.Name) + "\" /> "; break; } return(str); }