public virtual DataSet getDataSet(Env env) { ArrayList list; ArrayList list2; DesignReportEvent.UserDefineDataSet(this.hashtable_0, out list, out list2, env.Request, env.Session); int num = list2.Count; int num2 = list.Count; DataSet set = new DataSet(); for (int i = 0; i < num2; i++) { set.addColumn((string)list[i]); } for (int j = 0; j < num; j++) { Row row = set.addRow(); for (int k = 1; k <= num2; k++) { row.setData(k, ((object[])list2[j])[k - 1]); } } return(set); }
public string saveFile() { string str = cn.com.fcsoft.util.Tools.demoAction(this.httpRequest_0); if (str != "") { throw new Exception(str); } Logger.debug("开始保存文件:"); ArrayList list = new ArrayList(); ArrayList list3 = new ArrayList(); string str2 = ""; StreamReader reader = new StreamReader(this.httpRequest_0.InputStream); string sFileContent = reader.ReadToEnd().Replace("<FC />", "").Replace("<FC></FC>", ""); XmlDocument document = new XmlDocument(); try { document.LoadXml(sFileContent); if (document.DocumentElement == null) { return("所保存的文件内容不是合法的XML数据!"); } } catch (Exception exception2) { return(exception2.Message); } XmlNodeList list5 = document.DocumentElement.SelectNodes("//TD[@e_merge!='']"); int num9 = list5.Count; for (int i = 0; i < num9; i++) { string[] strArray = list5.Item(i).Attributes["e_merge"].InnerXml.Split(new char[] { '-' }); string[] strArray2 = strArray[0].Split(new char[] { ',' }); string[] strArray3 = strArray[1].Split(new char[] { ',' }); int num7 = 0; int num12 = 0; int num6 = 0; int num13 = 0; num7 = Convert.ToInt32(strArray2[0]) - 1; num12 = Convert.ToInt32(strArray2[1]) - 1; num6 = Convert.ToInt32(strArray3[0]) - 1; num13 = Convert.ToInt32(strArray3[1]) - 1; for (int k = 0; k <= (num6 - num7); k++) { int index = 0; if ((k > 0) || ((num13 - num12) > 0)) { index = list.IndexOf(k + num7); if (index < 0) { list.Add(k + num7); list3.Add(new ArrayList()); index = list.Count - 1; } } int num11 = 0; if (k == 0) { num11 = 1; } while (num11 <= (num13 - num12)) { ((ArrayList)list3[index]).Add(num11 + num12); num11++; } } } for (int j = 0; j < list.Count; j++) { ArrayList list2 = (ArrayList)list3[j]; list2.Sort(); int num4 = (int)(list[j]); for (int m = 0; m < list2.Count; m++) { int num3 = (int)(list2[m]); XmlNode node = document.CreateNode((XmlNodeType)1, "fc", ""); XmlNode node2 = document.DocumentElement.ChildNodes[1].ChildNodes[num4]; node2.InsertBefore(node, node2.ChildNodes[num3]); } } sFileContent = document.OuterXml; string str7 = this.httpRequest_0.Params["edit"]; string str6 = this.httpRequest_0.Params["spath"]; string sFileName = str6; str6 = PathTool.getRealPath(this.httpRequest_0, FileAction.basePath + str6); Logger.debug("保存的文件名:" + sFileName + " ::: " + str6); string str4 = DesignReportEvent.BeforeSave(this.httpRequest_0, this.dboperator_0, sFileName, sFileContent); if (str4 != "ok") { if (str4 != "") { str2 = str4; } } else { try { if (sFileContent == null) { return(str2); } byte[] bytes = Encoding.GetEncoding("GB2312").GetBytes(sFileContent.ToCharArray()); if (bytes != null) { if (File.Exists(str6) && (str7 != "yes")) { return(str6 + "已存在! 请另取一个名称!!"); } FileStream stream = new FileStream(str6, (FileMode)2); if (stream.CanWrite) { stream.Write(bytes, 0, bytes.Length); } stream.Close(); } } catch (Exception exception) { str2 = exception.Message; } } return(str2); }