/// <summary> /// 只返回字符串格式模板组|模板组2 /// </summary> /// <param name="xmlDoc"></param> /// <returns></returns> public static string getTemplateOnlyRead(XmlDocument xmlDoc) { B_DocModel bll = new B_DocModel(); string html = @"<tr class='tdbg'> <td style='font-weight:bold;text-align:center;' class='tdbgleft'><span>模板组列表</span></td><td>"; DataTable dt = bll.selGroup(1);//获取模板组 try { if (xmlDoc != null) { string[] tempList = xmlDoc.SelectSingleNode("DocInfo/tempArr").InnerText.Split(',');//格式ID,ID2,ID3 for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < tempList.Length; j++) { if (dt.Rows[i]["ID"].ToString().Equals(tempList[j])) { html += "[" + dt.Rows[i]["DocName"] + "]"; break; } } } html += "</td></tr>"; return(html);//返回有选择的 } else { html += "[你当前没有选择任何模板组]</span></td></tr>"; return(html); } } catch { return("你没有选择模板组"); } }
//-------------静态方法区,XML操作 /// <summary> /// 返回模板组列表,checkBox选择,后台form["txt_mb"]获取 /// </summary> /// <returns></returns> public static string getTemplateArrayList() { B_DocModel bll = new B_DocModel(); string html = @"<tr class='tdbg'> <td align='right' class='tdbgleft'><span>模板组列表</span></td><td>"; //<td> <input id="txt_mb_0" type="checkbox" name="txt_mb" value="律师事务所函" />律师事务所函 DataTable dt = bll.selGroup(1); for (int i = 0; i < dt.Rows.Count; i++) { html += "<input id='txt_mb_" + i + "' type='checkbox' name='txt_mb' value='" + dt.Rows[i]["ID"] + "' style='margin-left:2px;'/>" + dt.Rows[i]["DocName"] + ""; } html += "<input type='button' id='taBtn' onclick=' allCheck(\"txt_mb\")' class='C_input' value='全选' style='margin-left:5px;'/></td></tr>"; return(html); }
/// <summary> /// 用于show页面,先看看xml中有无选取模板,再输出checkBox /// </summary> /// <returns></returns> public static string getTemplateArrayList(XmlDocument xmlDoc) { B_DocModel bll = new B_DocModel(); string html = @"<tr class='tdbg'> <td align='right' class='tdbgleft'><span>模板组列表</span></td><td>"; DataTable dt = bll.selGroup(1);//获取模板组 bool flag = true; try { if (xmlDoc != null) { string[] tempList = xmlDoc.SelectSingleNode("DocInfo/tempArr").InnerText.Split(',');//格式ID,ID2,ID3 for (int i = 0; i < dt.Rows.Count; i++) { flag = true; for (int j = 0; j < tempList.Length; j++) { if (dt.Rows[i]["ID"].ToString().Equals(tempList[j])) { html += "<input id='txt_mb_" + i + "' type='checkbox' checked='checked' name='txt_mb' value='" + dt.Rows[i]["ID"] + "' style='margin-left:2px;'/>" + dt.Rows[i]["DocName"] + ""; flag = false; break; } } if (flag) { html += "<input id='txt_mb_" + i + "' type='checkbox' name='txt_mb' value='" + dt.Rows[i]["ID"] + "' style='margin-left:2px;'/>" + dt.Rows[i]["DocName"] + ""; } } html += "<input type='button' id='taBtn' onclick=' allCheck(\"txt_mb\")' class='i_bottom' value='全选' style='margin-left:5px;'/></td></tr>"; return(html);//返回有选择的 } else { for (int i = 0; i < dt.Rows.Count; i++) { html += "<input id='txt_mb_" + i + "' type='checkbox' name='txt_mb' value='" + dt.Rows[i]["ID"] + "' style='margin-left:2px;'/>" + dt.Rows[i]["DocName"] + ""; } html += "<input type='button' id='taBtn' onclick=' allCheck(\"txt_mb\")' class='C_input' value='全选' style='margin-left:5px;'/></td></tr>"; return(html); } } catch { return(getTemplateArrayList()); } }
/// <summary> /// 更新TempArr,模板组选择信息 /// </summary> /// <param name="title"></param> /// <param name="value"></param> public static bool updateTempArr(string title, string value) { XmlDocument xmlDoc = B_DocModel.getTempXML(title); if (xmlDoc != null) { if (xmlDoc.SelectSingleNode("DocInfo/tempArr") == null) //如果无当前节点,则 { XmlElement temp = xmlDoc.CreateElement("tempArr"); temp.InnerText = ""; XmlElement root = xmlDoc.DocumentElement; root.AppendChild(temp); } XmlNode tempArr = xmlDoc.SelectSingleNode("DocInfo/tempArr"); tempArr.InnerText = value; xmlDoc.Save(HttpContext.Current.Server.MapPath(uploadPath + title + "/" + title + ".xml")); return(true); } else { return(false); } }