/// <summary> /// 获取list页的数据源 /// 支持主模块的链接 /// 支持枚举量 /// 支持时间格式 /// </summary> /// <param name="f1"></param> /// <returns></returns> public string GetHtmlList(DataBaseField f1, ITableImplement this1) { if (!f1.Desc.af_Enable) { return(""); //是否可用 } if (!f1.Desc.af_Visable) { return(""); //是否可见 } string html = ""; string tableName = f1.TableName; AttributeItem attr1 = AttributeItem.Factory(f1); object value1 = (this1.GetValue(attr1)); DataBaseTable dt1 = f1.DataBaseTable; //DataBaseField f1; try { DataBaseField id1 = dt1.IDField; DataBaseField name1 = dt1.NameField; if (f1 == dt1.IDField) { //html = "<a href='index.aspx?id=" + this1.GetValue(dt1.FieldID.FieldName) + "'>" + html + "</a>"; } else if (f1 == dt1.NameField) // != null && dt1.NameField.FieldName == f1.FieldName)//本模块name详细链接 { string showUrl = "../" + dt1.TableName + "/show.aspx"; if (!Exist(showUrl)) { showUrl = "show.aspx"; } html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + tableName + "' target='_blank'>" + value1 + "</a>"; } else if (isSelect(f1)) //枚举量 { html = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, value1); } else if (isChaZhao(f1)) //父表 { DataBaseField f2 = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField; AttributeItem attr2 = AttributeItem.Factory(f2); html = Convert.ToString(this1.GetValue(attr2)); } else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage) { html = "<img src ='" + value1 + "' style='height:40px' />"; } } catch (Exception ex) { Cs.Error(ex.ToString()); } if (html == "") { html = Convert.ToString(value1); } return(html); }
protected void Page_Load(object sender, EventArgs e) { //base.Page_Init(sender, e); //初始化模块加载参数 base.InitModule(ref valObj, ref KeyID, ref fieldList); title = valObj._ZhName + "详细"; Page.Title = title; if (!IsPostBack) { try { resultObj.IsOnlyForModuleIDName = false; valObj.IsOnlyForModuleIDName = false; if (!string.IsNullOrEmpty(Request["ID"])) { AttributeItem id1 = AttributeItem.Factory(valObj.DataBaseTable.IDField); ITableImplement cond1 = new ITableImplement(); cond1.SetValue(id1, Request["ID"]); resultObj = BLLTable <ITableImplement> .Factory(conn).GetRowData(valObj, cond1); if (resultObj == null) { ScriptHelper.Alert(this, "记录不存在"); ScriptHelper.CloseMe(this); return; } BLLTable.SQL_Test.ToArray(); object obj1 = resultObj.GetValue(WEC_A_VOTE.Attribute.TITLE); } } catch (Exception ex) { //litWarn.Text = ex.Message; } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["deleteFile"] == null) { base.InitModule(ref valObj, ref KeyID, ref fieldList); } //在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录 if (Request["DelID"] != null) { valObj.SetValue(valObj.KeyID, Request["DelID"]); int re = BLLTable <ITableImplement> .Factory(conn).Delete(valObj); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录 if (Request["DelKeyIDS"] != null) { ITableImplement cond = valObj; cond.In(AttributeItem.Factory(cond.DataBaseTable.IDField), Request["DelKeyIDS"]); int re = BLLTable <ITableImplement> .Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新 if (Request["saveInfo"] != null) { valObj.SetValue(valObj.KeyID, Request["FieldKeyID"]); List <AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { valObj.SetValue(lstCol[i], Request["txt" + lstCol[i].FieldName]); } } BLLTable <ITableImplement> .Factory(conn).Update(valObj, valObj.KeyID); Response.Write("修改记录信息成功"); } //删除本地文件 if (Request["deleteFile"] != null) { //string filepath=WebHelper.GetAppPath() + Request["fileName"]; string filepath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + Request["fileName"];; if (File.Exists(filepath)) { File.Delete(filepath); } } //分页AJAX请求 if (Request["paging"] != null) { int pageSize = 10; int pageIndex = 1; int count1 = -1; pageIndex = Convert.ToInt32(HttpUtil.GetReqStrValue("pageIndex")); int num = Convert.ToInt32(HttpUtil.GetReqStrValue("num"));; StringBuilder sb = new StringBuilder(); try { //DataBaseField[] flist = valObj.af_GetAvailableDataBaseField(); //foreach (DataBaseField f1 in flist) { //父表的id object id1 = HttpUtil.GetReqStrValue("id1"); string tableName1 = "关系表1"; if (valObj.DataBaseTable.SubTable_ChaZhao.Count > 0) { // foreach (DataBaseTableRelation dr1 in valObj.DataBaseTable.SubTable_ChaZhao) //{ DataBaseTableRelation dr1 = valObj.DataBaseTable.SubTable_ChaZhao[num]; DataBaseTable table2 = dr1.DataBaseTable; tableName1 = table2.TableName; DataBaseField IDField = dr1.DataBaseTable.IDField; DataBaseField NameField = dr1.DataBaseTable.NameField; List <Relation> lstRel = new List <Relation>(); foreach (DataBaseRelation r1 in dr1.Relations) { lstRel.Add(new Relation(r1)); } ITableImplement value2 = new ITableImplement(table2); ITableImplement cond2 = new ITableImplement(table2); cond2.SetValue(AttributeItem.Factory(value2.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.IDField), id1); List <ITableImplement> lstCond = new List <ITableImplement>(); lstCond.Add(cond2); List <ITableImplement> lstOther = new List <ITableImplement>(); //显示明显表的 父表的信息 //value2.setConn(conn).setModule("WEC_QC_CARS"); List <ITableImplement> list2 = BLLTable <ITableImplement> .Factory(conn).SelectByPage(value2, lstRel, lstOther, lstCond, pageSize, pageIndex, ref count1); // BLLTable.SQL_Test.ToString(); if (list2.Count > 0) { foreach (ITableImplement tb2 in list2) { sb.Append("<tr>"); foreach (DataBaseField d2 in tb2.af_GetAvailableDataBaseField()) { sb.Append("<td>" + GetHtmlList(d2, tb2) + ""); } sb.Append("</tr>"); } } } } } catch (Exception ex) { } Response.Write(sb.ToString()); } //下载文件 if (Request["download"] != null) { string filename = Request["filename"]; string fullpath = Request.PhysicalApplicationPath + filename; Response.ContentType = "APPLICATION/OCTET-STREAM"; Response.AddHeader("Content-Disposition", "attachment;filename=" + filename.Substring(filename.LastIndexOf("/") + 1)); FileStream fs = new FileStream(fullpath, FileMode.Open); int len = (int)fs.Length; byte[] buf = new byte[len]; int count; int sum = 0; while ((count = fs.Read(buf, 0, len)) > 0) { sum += count; Response.OutputStream.Write(buf, 0, count); } } Response.End(); }
protected void Page_Load(object sender, EventArgs e) { base.InitModule(ref valObj, ref KeyID, ref fieldList); if (!string.IsNullOrEmpty(ModuleName)) { pageAttr1 = AttributeItem.Factory(valObj.DataBaseTable.IDField); condObj.af_PageBy(pageAttr1, Order.Desc); //condObj111._TableName = valObj111._TableName; finderObj._TableName = valObj._TableName; DataBaseField[] ds1 = valObj.af_GetAvailableDataBaseField(); foreach (DataBaseField f1 in ds1) { if (!f1.Desc.af_Enable || !f1.Desc.af_Visable) { continue; } fieldList.Add(f1); } } title = valObj._ZhName + "管理"; Page.Title = title; if (!IsPostBack) { //从数据库获取配置的取值对象和条件对象,作为视图。jinsj Ec_View cond1 = new Ec_View(); cond1.ModuleName = valObj._TableName; Ec_View v1 = BLLTable <Ec_View> .GetRowData(cond1); if (v1 != null && v1.IsNotNull()) { if (v1.ValueJsonString != "") { valObj = JsonServiceBase.FromJson <ITableImplement>(v1.ValueJsonString); } if (v1.ConditionJsonString != "") { condObj = JsonServiceBase.FromJson <ITableImplement>(v1.ConditionJsonString); } string viewName = v1.ViewName; } #region //默认属性初始化 aspPager.CurrentPageIndex = 1; txtPageSize.Value = "30"; aspPager.PageSize = 30; #endregion #region //数据初始化 #endregion BindList(1); } if (hidCondition.Value != "") { //condObj111 = JsonServiceBase.FromJson<ITableImplement>(hidCondition.Value); } if (hidFind.Value != "") { finderObj = JsonServiceBase.FromJson <ITableImplement>(hidFind.Value); } if (hidVal.Value != "") { //valObj111 = JsonServiceBase.FromJson<ITableImplement>(hidVal.Value); } if (valObj.IsNull()) { //valObj111.LoadAllAttributes(true); } }
/// <summary> /// ÊäÈëhtml /// </summary> /// <returns></returns> protected string getInput() { StringBuilder sb = new StringBuilder(); try { foreach (DataBaseField f1 in fieldList) { if (f1.TableName.ToLower() == valObj._TableName.ToLower())//±¾±í×ֶΠ{ AttributeItem attr1 = new AttributeItem(f1); f1.Value = Convert.ToString(resultObj.GetValue(attr1)); if (f1.ZhName == "¶àÑ¡ÊýÁ¿") { "".ToString(); } if (f1.ZhName == "¹Ø¼ü´Ê") { "".ToString(); } string attrHtml = Input; BuildByTag b1 = new BuildByTag(BuildType.ForHtmlValue); b1.ParseForSwitch±êÇ©(ref attrHtml, f1); if (isChaZhao(f1)) { DataBaseField f2 = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField; AttributeItem attr11 = AttributeItem.Factory(f2); string html = Convert.ToString(resultObj.GetValue(attr11)); attrHtml = attrHtml.Replace("{×Ö¶ÎÏÔʾֵ}", html); } else if (f1.Desc.CtrlType == BaseCtrlType.SelectDrop) { string[] strs = null; if (f1.Value.Contains(",")) { strs = f1.Value.Split(','); foreach (string s in strs) { string str = "value='" + s + "'"; attrHtml = attrHtml.Replace(str, str + " selected"); } } } else if (f1.Desc.CtrlType == BaseCtrlType.FileUpUpDoc) { if (!f1.Value.Equals(" ")) { string val = Convert.ToString(f1.Value); string[] strs = val.Split(';'); string html = ""; for (int i = 0; i < strs.Length - 1; i++) { string[] ss = strs[i].Split(','); string title = ss[0]; string url = ss[1]; string hidId = ss[2]; html += "<div>" + title + "<a href=\"javascript:\" flag=\"delete\" url=\"" + url + "\" onclick=\"deleteFileName(this,'" + hidId + "')\"><img src=\"../../Themes/WEC/del-icon.png\"></a></div>"; } attrHtml = attrHtml.Replace("<div id='files' style='margin-bottom:10px;'></div>", "<div id='files' style='margin-bottom:10px;'>" + html + "</div>"); } } sb.Append("<dl><dt>").Append(f1.Desc.ZhName).Append("£º</dt><!--").Append(f1.FieldName) .Append("--><dd><span>"); sb.Append(attrHtml); sb.Append("</span></dd></dl>"); } } } catch (Exception ex) { Cs.Error("34" + ex.ToString()); } return(sb.ToString()); }
/// <summary> /// 相关子表 /// </summary> /// <returns></returns> protected string getSubForm() { StringBuilder sb = new StringBuilder(); try { //DataBaseField[] flist = valObj.af_GetAvailableDataBaseField(); //foreach (DataBaseField f1 in flist) { //父表的id object id1 = resultObj.GetValue(valObj.DataBaseTable.IDField); string tableName1 = "关系表1"; if (valObj.DataBaseTable.SubTable_ChaZhao.Count > 0) { int count2 = 0;//计数 foreach (DataBaseTableRelation dr1 in valObj.DataBaseTable.SubTable_ChaZhao) { DataBaseTable table2 = dr1.DataBaseTable; tableName1 = table2.TableName; DataBaseField IDField = dr1.DataBaseTable.IDField; DataBaseField NameField = dr1.DataBaseTable.NameField; List <Relation> lstRel = new List <Relation>(); foreach (DataBaseRelation r1 in dr1.Relations) { lstRel.Add(new Relation(r1)); } ITableImplement value2 = new ITableImplement(table2); ITableImplement cond2 = new ITableImplement(table2); cond2.SetValue(AttributeItem.Factory(value2.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.IDField), id1); List <ITableImplement> lstCond = new List <ITableImplement>(); lstCond.Add(cond2); List <ITableImplement> lstOther = new List <ITableImplement>(); count1 = -1; //显示明显表的 父表的信息 //value2.setConn(conn).setModule("WEC_QC_CARS"); List <ITableImplement> list2 = BLLTable <ITableImplement> .Factory(conn).SelectByPage(value2, lstRel, lstOther, lstCond, pageSize, pageIndex, ref count1); int num = count1 / pageSize; if (list2.Count > 0) { sb.Append("<script type=\"text/javascript\">"); sb.Append("$(function () {"); sb.Append("$(\"#tbl" + tableName1 + "Title\").click(function () {"); sb.Append("$(\"#tbl" + tableName1 + "\").toggleClass(\"hide\");"); sb.Append("$(\"#tbl" + tableName1 + "Img\").toggleClass(\"showUp\");"); sb.Append("});"); //sb.Append("$(\"ul >li >a[name="+count2+"]\").click(function () {" + // "alert($(this).attr(\"rel\"))" + // "});"); // sb.Append("$(\"ul >li >a[name=" + count2 + "]\").click(function () {" + // //"$(\"ul >li >a[name=" + count2 + "]\").parent().removeClass(\"active\");"+ // //"$(this).parent().addClass(\"active\");"+ // "var str = $(this).attr(\"rel\");" + // "var strs = str.split(\".\");" + // "var content=$(this).html();"+ // // "alert(content==\"下一页\");" + // "if(content==\"下一页\"){"+ // "if((parseInt(strs[1])+1)<="+(num+1)+"){"+ // "var nextStr=strs[0]+\".\"+(parseInt(strs[1])+1);"+ // "var prevStr=strs[0]+\".\"+(parseInt(strs[1])-1);" + // "$(this).attr(\"rel\",nextStr);"+ // "$(this).parent().siblings().find(\"a\").attr(\"rel\",prevStr);" + // "$(this).parent().siblings().removeClass(\"disabled\");" + // "}else{"+ // "var nextStr=strs[0]+\".\"+(parseInt(strs[1])+1);" + // "var prevStr=strs[0]+\".\"+(parseInt(strs[1])-1);" + // "$(this).attr(\"rel\",nextStr);" + // "$(this).parent().siblings().find(\"a\").attr(\"rel\",prevStr);" + // "$(this).parent().siblings().removeClass(\"disabled\");" + // "$(this).parent().addClass(\"disabled\");"+ // "}"+ // " }else{"+ // "if((parseInt(strs[1])-1)>=1){"+ // "var nextStr=strs[0]+\".\"+(parseInt(strs[1])+1);" + // "var prevStr=strs[0]+\".\"+(parseInt(strs[1])-1);"+ // "$(this).attr(\"rel\",prevStr);"+ // "$(this).parent().siblings().find(\"a\").attr(\"rel\",nextStr);" + // "$(this).parent().siblings().removeClass(\"disabled\");" + // "}else{"+ // "var nextStr=strs[0]+\".\"+(parseInt(strs[1])+1);" + // "var prevStr=strs[0]+\".\"+(parseInt(strs[1])-1);" + // "$(this).attr(\"rel\",prevStr);" + // "$(this).parent().siblings().find(\"a\").attr(\"rel\",nextStr);" + // "$(this).parent().siblings().removeClass(\"disabled\");" + // "$(this).parent().addClass(\"disabled\");"+ // "}"+ // "}"+ // "$.ajax({" + // "url:\"Back.aspx\"," + // "type:\"post\"," + // "data:{\"ModuleName\":\"" + ModuleName + "\",\"pageIndex\":strs[1],\"num\":strs[0],\"id1\":"+id1+",\"paging\":\"true\"}," + // "dataType:\"text\"," + // "success: function (data) {" + // "$(\"tbody[rel=\" + strs[0] + \"]\").html(data);" + // "}," + // "error: function (data) {" + // "alert(data);" + // "}" + // "});" + //"});"); sb.Append(" var options = {" + "currentPage: 1," + "totalPages: " + (count1 / 10 + 1) + "," + "numberOfPages:5," + "onPageChanged:function(event){" + // "alert($(event.currentTarget).find(\"ul li.active a\").html());" + "$.ajax({" + "url:\"Back.aspx\"," + "type:\"post\"," + "data:{\"ModuleName\":\"" + ModuleName + "\",\"pageIndex\":$(event.currentTarget).find(\"ul li.active a\").html(),\"num\":" + count2 + ",\"id1\":" + id1 + ",\"paging\":\"true\"}," + "dataType:\"text\"," + "success: function (data) {" + "$(\"tbody[rel=" + count2 + "]\").html(data);" + "}," + "error: function (data) {" + "alert(data);" + "}" + "});" + "}" + "};" + "$('#page" + count2 + "').bootstrapPaginator(options);"); sb.Append("});"); sb.Append("</script>"); sb.Append("<div id='tbl" + tableName1 + "Title' class='showTitle'><span >" + value2._ZhName + "信息</span><span id='tbl" + tableName1 + "Img' class='showImg'></span></div>"); sb.Append("<div id='tbl" + tableName1 + "' class=\"tblist\">"); sb.Append("<table cellpadding=\"0\" cellspacing=\"0\" id=\"tbList\" class=\"table table-hover\">"); sb.Append("<thead>"); sb.Append("<tr keyname=\"ID\">"); foreach (DataBaseField d2 in value2.af_GetAvailableDataBaseField()) { sb.Append("<td data=\"{colname:'" + d2.LongAttributeName + "',show:1}\">" + d2.ZhName + "</td>"); } sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody rel=\"" + count2 + "\">"); foreach (ITableImplement tb2 in list2) { sb.Append("<tr>"); foreach (DataBaseField d2 in tb2.af_GetAvailableDataBaseField()) { sb.Append("<td>" + GetHtmlList(d2, tb2) + ""); } sb.Append("</tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); //sb.Append("<div class=\"container\"><div><ul class=\"pager\">"); ////for (int i = 0; i <= num;i++ ) ////{ //// if (pageIndex == i + 1) //// { //// sb.Append("<li class=\"active\"><a href=\"javascript:;\" name=\""+count2+"\" rel="+count2+"."+(i+1)+">" + (i + 1) + "</a></li>"); //// } //// else //// { //// sb.Append("<li><a href=\"javascript:;\" name=\""+count2+"\" rel=" + count2 + "." + (i + 1) + ">" + (i + 1) + "</a></li>"); //// } ////} //sb.Append("<li class=\"disabled\"><a href=\"javascript:;\" name=\"" + count2 + "\" rel=" + count2 + "." + 1 + ">上一页</a></li>"); //if (num==0) //{ // sb.Append("<li class=\"disabled\"><a href=\"javascript:;\" name=\"" + count2 + "\" rel=" + count2 + "." + 2 + ">下一页</a></li>"); //}else{ // sb.Append("<li><a href=\"javascript:;\" name=\"" + count2 + "\" rel=" + count2 + "." + 2 + ">下一页</a></li>"); //} //sb.Append("</ul></div></div>"); sb.Append("<div id=\"page" + count2 + "\"></div>"); sb.Append("</div>"); count2++; } } } else if (valObj.DataBaseTable.SubTable_ExtField.Count > 0) { DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField; } else if (valObj.DataBaseTable.SubTable_Many2Many.Count > 0) { DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField; } else if (valObj.DataBaseTable.SubTable_MingXi.Count > 0) { DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField; } else if (valObj.DataBaseTable.SubTable_MyTree.Count > 0) { DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField; } else if (valObj.DataBaseTable.SubTable_Tree.Count > 0) { DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField; } } } catch (Exception ex) { } return(sb.ToString()); }
/// <summary> /// 输入html /// </summary> /// <returns></returns> protected string getInput() { StringBuilder sb = new StringBuilder(); string strChazhaoID = ""; try { DataBaseField[] flist = valObj.af_GetAvailableDataBaseField(); foreach (DataBaseField f1 in flist) { string block = "基础信息"; block = f1.Desc.af_BlockName; string blockid = f1.Desc.af_BlockID; if (f1.TableName != resultObj._TableName) //说明不是本表字段 { block = f1.TableName; //布局名,就是 关联表的父表 表名 if (resultObj.IsOnlyForModuleIDName == true) { break; } else { } } f1.Value = Convert.ToString(resultObj.GetValue(f1)); string attrHtml = Input; BuildByTag b1 = new BuildByTag(BuildType.ForHtmlValue); b1.ParseForSwitch标签(ref attrHtml, f1); if (isChaZhao(f1)) { DataBaseField f2 = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField; string html = Convert.ToString(resultObj.GetValue(f2)); attrHtml = attrHtml.Replace("{字段显示值}", html); strChazhaoID = f1.Value; } else if (isSelect(f1))//枚举量 { AttributeItem attr2 = AttributeItem.Factory(f1); string html = BaseFormHelper.Factory(resultObj.ConnectKey).GetOptionText(attr2, f1.Value); attrHtml = html; } else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage) { attrHtml = "<img style='height:19px;top:5px;postion:relative;' src ='" + f1.Value + "' style='height:40px' />"; } sb.Append("<dl class=\"dl-horizontal\"><dt><span>").Append(f1.Desc.ZhName).Append("</span></dt><!--").Append(f1.FieldName) .Append("--><dd><span>"); sb.Append(attrHtml); sb.Append("</span></dd></dl>"); } } catch (Exception ex) { Cs.Error("34" + ex.ToString()); } return(sb.ToString()); }
/// <summary> /// 获取list页的数据源 /// 支持主模块的链接 /// 支持枚举量 /// 支持时间格式 /// </summary> /// <param name="f1"></param> /// <returns></returns> public string GetHtmlList(DataBaseField f1, ITableImplement this1) { string html = ""; try { DataBaseTable dt1 = f1.DataBaseTable; if (f1 != dt1.IDField && f1 != dt1.NameField) { if (!f1.Desc.af_Enable) { return(""); //是否可用 } if (!f1.Desc.af_Visable) { return(""); //是否可见 } } AttributeItem attr1 = AttributeItem.Factory(f1); object value1 = (this1.GetValue(attr1)); //DataBaseField f1; DataBaseField id1 = dt1.IDField; DataBaseField name1 = dt1.NameField; if (f1 == dt1.IDField)//编号字段 { //html = "<a href='index.aspx?id=" + this1.GetValue(dt1.FieldID.FieldName) + "'>" + html + "</a>"; } else if (f1 == dt1.NameField)// != null && dt1.NameField.FieldName == f1.FieldName)//本模块name详细链接 { string showUrl = "../" + f1.TableName + "/show.aspx"; if (!Exist(showUrl)) { showUrl = "show.aspx"; } html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + f1.TableName + "' target='_blank'>" + value1 + "</a>"; } else if (isSelect(f1))//枚举量 { string str = Convert.ToString(value1); if (str.Contains(",")) { //多选 string[] strs = str.Split(','); List <object> valueList = new List <object>(strs); List <object> nameList = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, valueList); StringBuilder sb = new StringBuilder(); foreach (object s in nameList) { String ss = Convert.ToString(s); sb.Append(ss + ","); } html = sb.ToString(); html = html.Substring(0, html.LastIndexOf(",")); } else { //单选 html = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, value1); } } else if (isChaZhao(f1))//父表 { DataBaseField f2 = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField; AttributeItem attr2 = AttributeItem.Factory(f2); html = Convert.ToString(this1.GetValue(attr2)); //为关联的表的name设置链接 string showUrl = "../" + f1.TableName + "/show.aspx"; if (!Exist(showUrl)) { showUrl = "show.aspx"; } html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + f1.TableName + "' target='_blank'>" + html + "</a>"; } else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage) { html = "<img src ='" + value1 + "' style='height:40px' />"; } else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpUpDoc) {// if (!value1.Equals(" ")) { string val = Convert.ToString(value1); string[] strs = val.Split(';'); for (int i = 0; i < strs.Length - 1; i++) { string[] ss = strs[i].Split(','); string title = ss[0]; string url = ss[1]; html += "<span>" + title + " <a href='Back.aspx?moduleName=" + ModuleName + "&download=true&filename=" + url + "'>下载</a></span>"; } } } if (html == "") { html = Convert.ToString(value1); } } catch (Exception ex) { Cs.Error(ex.ToString()); } return(html);//.TrimEnd('\n').TrimEnd('\r').Trim(); }