//查詢操作 public int SearchOperation(XmlDocument Search, string account) { int FileCount = 0; //轉換成XDocument this.SearchXml = XDocument.Parse(Search.OuterXml); //做LogRecord // alternatively you can call the Log() method // and pass log level as the parameter. Log.Log(LogLevel.Info, "Sample informational message"); //把結果給學弟 try { search SearchFun = new search(); FileCount = SearchFun.ProcessXML(SearchXml, account); } catch (Exception e) { throw e.GetBaseException(); } return FileCount; }
//最後階段 public XDocument FinalSection() { XDocument SearchXml = OpenXml("SearchTemp", Path_Info.SearchPath, "STUDYXML-1.xml"); //呼叫查詢 search SearchFun = new search(); int FileCount = SearchFun.ProcessXML(SearchXml, "ServerTemp"); //進行資料新增 string Operation = "InsertQuery", ReadFileName = "Insert.xml"; XDocument QueryXml = OpenXml("Query", Path_Info.SearchPath, FileCount.ToString().Trim()); //Insert Xml XDocument Doc = OpenXml(Operation, Path_Info.InsertPath, ReadFileName); foreach (XElement element in Doc.Root.Elements()) { string FieldName = element.Attribute("FieldName").Value; foreach (XElement Element in QueryXml.Root.Elements()) { string QueryName = Element.Attribute("FieldName").Value; if (FieldName.Equals(QueryName)) { element.SetValue(Element.Value); break; } } if (FieldName.Equals("SeriesInstanceUID")) break; } WriteXml(Doc, Operation, Path_Info.InsertPath, ReadFileName); return Doc; }