Exemple #1
0
 public static LoadData[] LoadXml(string strpath)
 {
     LoadData[] dataArray = null;
     LoadData[] dataArray2;
     string str = strpath;
     QxXmlDocument document = new QxXmlDocument();
     try
     {
         document.Filepath = str;
         document.OpenXml();
         int depth = document.GetDepth("/DataMessage/DataTableItem");
         if (depth > 0)
         {
             int num2 = 0;
             dataArray = new LoadData[depth];
             for (int i = 0; i < depth; i++)
             {
                 dataArray[i] = new LoadData();
                 dataArray[i].TableName = document.SearchAttribute("/DataMessage/DataTableItem", i, null, "TableName");
                 dataArray[i].TextName = document.SearchAttribute("/DataMessage/DataTableItem", i, null, "Text");
                 dataArray[i].Type = "Table";
                 DataTable table = new DataTable();
                 table.Columns.Add(new DataColumn("列英文名"));
                 table.Columns.Add(new DataColumn("数据类型"));
                 table.Columns.Add(new DataColumn("列中文名"));
                 table.Columns.Add(new DataColumn("列英文名和数据类型"));
                 table.Columns.Add(new DataColumn("Column"));
                 XmlNode xn = document.GetNode("/DataMessage/DataTableItem", i);
                 int num4 = document.GetDepth(xn);
                 for (int j = 0; j < num4; j++)
                 {
                     DataRow row = table.NewRow();
                     row["列英文名"] = document.SearchAttribute("/DataMessage/DataTableItem/DataColumnItem", num2 + j, null, "ColumnName");
                     row["数据类型"] = document.SearchAttribute("/DataMessage/DataTableItem/DataColumnItem", num2 + j, null, "ColumnType");
                     row["列中文名"] = document.GetNodeString("/DataMessage/DataTableItem/DataColumnItem", num2 + j);
                     row["列英文名和数据类型"] = document.SearchAttribute("/DataMessage/DataTableItem/DataColumnItem", num2 + j, null, "ColumnName") + "|" + document.SearchAttribute("/DataMessage/DataTableItem/DataColumnItem", num2 + j, null, "ColumnType");
                     row["Column"] = "Column";
                     table.Rows.Add(row);
                 }
                 num2 += num4;
                 dataArray[i].ColumnMess = table;
             }
         }
         dataArray2 = dataArray;
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
     return dataArray2;
 }
Exemple #2
0
 public static string CreateNumXML(string tacheNo, out string num1, DB_OPT dbo)
 {
     QxXmlDocument document = new QxXmlDocument();
     string serverPath = Public.GetServerPath();
     document.Filepath = serverPath + @"\\bin\\TacheNo.xml";
     document.OpenXml();
     string innerText = document.GetNode("/TacheNo/Year", 0).InnerText;
     string str = DateTime.Now.Month.ToString();
     string str4 = "";
     num1 = "";
     int depth = document.GetDepth("/TacheNo/TacheNoMess");
     if (depth > 0)
     {
         for (int i = 0; i < depth; i++)
         {
             if (document.SearchAttribute("/TacheNo/TacheNoMess", i, null, "NoNum") == tacheNo)
             {
                 num1 = (int.Parse(document.GetNode("/TacheNo/TacheNoMess", i).InnerText) + 1).ToString();
                 str4 = (int.Parse(document.GetNode("/TacheNo/TacheNoMess", i).InnerText) + 1).ToString();
                 break;
             }
         }
     }
     document.Dispose();
     if (DateTime.Now.Year.ToString() != innerText)
     {
         str4 = "0";
         XmlDocument document2 = new XmlDocument();
         document2.Load(serverPath + @"\\bin\\TacheNo.xml");
         document2.SelectSingleNode("/TacheNo/Year").InnerText = DateTime.Now.Year.ToString();
         foreach (XmlNode node in document2.SelectNodes("/TacheNo/TacheNoMess"))
         {
             node.InnerText = str4;
         }
         document2.Save(serverPath + @"\\bin\\TacheNo.xml");
         str4 = "1";
     }
     if (str4.Length < 4)
     {
         str4 = Public.AddZero(str4, 4);
     }
     if (str.Length < 2)
     {
         str = Public.AddZero(str, 2);
     }
     return (DateTime.Now.Year.ToString() + str + tacheNo + str4);
 }