コード例 #1
0
        } // End Sub AddOrReplaceParameter

        public static void AddCustomParameter(string strFilename, System.Xml.XmlNode xnInsertHere, bool bFirst, bool bLast, string strXmlFragment)
        {
            string strReportName = System.IO.Path.GetFileNameWithoutExtension(strFilename);


            if (xnInsertHere != null)
            {
                Logging.LogMessage("{0}\t{1}", strReportName, "hasParameters");

                System.Xml.XmlDocument         doc        = xnInsertHere.OwnerDocument;
                System.Xml.XmlDocumentFragment xmlDocFrag = doc.CreateDocumentFragment();
                xmlDocFrag.InnerXml = strXmlFragment;


                bool bDoNotFechParameter = bFirst || bLast;

                if (bDoNotFechParameter)
                {
                    if (bFirst)
                    {
                        xnInsertHere.PrependChild(xmlDocFrag);
                    }
                    else
                    {
                        xnInsertHere.AppendChild(xmlDocFrag);
                    }
                }
                else
                {
                    if (StringComparer.InvariantCultureIgnoreCase.Equals(xnInsertHere.LocalName, "ReportParameters"))
                    {
                        xnInsertHere.AppendChild(xmlDocFrag);
                    }
                    else
                    {
                        xnInsertHere.ParentNode.InsertAfter(xmlDocFrag, xnInsertHere);
                    }
                } // End else of if (bDoNotFechParameter)

                XmlTools.SaveDocument(doc, strFilename, true);
            } // End if (xn
            else
            {
                Logging.LogMessage("{0}\tKeine Parameter in Report.", strReportName);
            }
        } // End Sub AddCustomParameter