Exemple #1
0
        /// <summary>
        /// Write out settings for the Picture dataset
        /// </summary>
        /// <param name="oDatasetElement"></param>
        /// <param name="strDestFolder"></param>
        /// <param name="bDefaultResolution"></param>
        /// <returns></returns>
        internal override ExtractSaveResult Save(System.Xml.XmlElement oDatasetElement, string strDestFolder, DownloadSettings.DownloadCoordinateSystem eCS)
        {
            ExtractSaveResult result = base.Save(oDatasetElement, strDestFolder, eCS);

            SetExtension();
            System.Xml.XmlAttribute oPathAttr = oDatasetElement.OwnerDocument.CreateAttribute("file");
            oPathAttr.Value = System.IO.Path.Combine(strDestFolder, Utility.FileSystem.SanitizeFilename(tbFilename.Text));
            oDatasetElement.Attributes.Append(oPathAttr);

            System.Xml.XmlAttribute oResolutionAttr = oDatasetElement.OwnerDocument.CreateAttribute("resolution");
            oResolutionAttr.Value = oResolution.ResolutionValueSpecific(eCS).ToString(CultureInfo.InvariantCulture);
            oDatasetElement.Attributes.Append(oResolutionAttr);

            System.Xml.XmlElement           oDownloadElement = oDatasetElement.OwnerDocument.CreateElement("download_options");
            Options.Picture.DownloadOptions eOption          = (Options.Picture.DownloadOptions)cbDownloadOptions.SelectedIndex;
            oDownloadElement.InnerText = eOption.ToString();
            oDatasetElement.AppendChild(oDownloadElement);

            System.Xml.XmlElement          oDisplayElement = oDatasetElement.OwnerDocument.CreateElement("display_options");
            Options.Picture.DisplayOptions eDisplayOption  = (Options.Picture.DisplayOptions)cbDisplayOptions.SelectedIndex;
            oDisplayElement.InnerText = eDisplayOption.ToString();
            oDatasetElement.AppendChild(oDisplayElement);

            return(result);
        }
Exemple #2
0
        public bool AddNewProjekt(ProjectEntity projekt)
        {
            System.Xml.XmlDocument myXml = new System.Xml.XmlDocument();
            myXml.Load(Server.MapPath("~/projects.xml"));
            System.Xml.XmlElement ParentElement = myXml.CreateElement("project");

            System.Xml.XmlElement NamE = myXml.CreateElement("name");
            NamE.InnerText = projekt.ProjektName;
            System.Xml.XmlElement AbbreviatioN = myXml.CreateElement("abbreviation");
            AbbreviatioN.InnerText = projekt.ProjektAbbreviation;
            System.Xml.XmlElement CustomeR = myXml.CreateElement("customer");
            CustomeR.InnerText = projekt.ProjektCustomer;

            System.Xml.XmlNodeList nodeListCount = myXml.GetElementsByTagName("project");
            int nodeCount = nodeListCount.Count + 1;

            ParentElement.SetAttribute("id", "prj" + nodeCount.ToString());

            ParentElement.AppendChild(NamE);
            ParentElement.AppendChild(AbbreviatioN);
            ParentElement.AppendChild(CustomeR);

            myXml.DocumentElement.AppendChild(ParentElement);
            myXml.Save(Server.MapPath("~/projects.xml"));

            return(true);
        }
        private void SaveToXml(ref string ProductsXml, ref string FilterXml)
        {
            System.Xml.XmlDocument doc    = null;
            System.Xml.XmlElement  rootEl = null;

            // products
            doc    = new System.Xml.XmlDocument();
            rootEl = doc.CreateElement("PRODUCTS");
            doc.AppendChild(rootEl);
            foreach (string serNo in this._productsSerNoList)
            {
                System.Xml.XmlElement childEl = doc.CreateElement("PR");
                childEl.SetAttribute("SN", serNo);
                rootEl.AppendChild(childEl);
            }
            ProductsXml = doc.InnerXml;

            // filter
            doc    = new System.Xml.XmlDocument();
            rootEl = doc.CreateElement("FILTER");
            doc.AppendChild(rootEl);
            for (int i = 0; i < this._filterList.Count; i++)
            {
                string colName = this._filterList.Keys[i];
                string val     = this._filterList[i];

                System.Xml.XmlElement childEl = doc.CreateElement("COL");
                childEl.SetAttribute("N", colName);
                childEl.SetAttribute("V", val);
                rootEl.AppendChild(childEl);
            }
            FilterXml = doc.InnerXml;
        }
        private System.Xml.XmlElement ToXMLElement(System.Xml.XmlDocument doc, ICSSoft.STORMNET.FunctionalLanguage.Function funct)
        {
            System.Xml.XmlElement el = doc.CreateElement("Function");
            if (funct != null)
            {
                el.SetAttribute("Name", funct.FunctionDef.StringedView);
                for (int i = 0; i < funct.Parameters.Count; i++)
                {
                    if (funct.Parameters[i] is ICSSoft.STORMNET.FunctionalLanguage.Function)
                    {
                        el.AppendChild(ToXMLElement(doc, funct.Parameters[i] as ICSSoft.STORMNET.FunctionalLanguage.Function));
                    }
                    else if (funct.Parameters[i] is ICSSoft.STORMNET.FunctionalLanguage.VariableDef)
                    {
                        System.Xml.XmlElement varel = doc.CreateElement("Variable");
                        varel.SetAttribute("Value", (funct.Parameters[i] as ICSSoft.STORMNET.FunctionalLanguage.VariableDef).StringedView);
                        el.AppendChild(varel);
                    }
                    else
                    {
                        System.Xml.XmlElement valel = doc.CreateElement("Value");
                        int parindex = (i >= funct.FunctionDef.Parameters.Count) ? funct.FunctionDef.Parameters.Count - 1 : i;
                        valel.SetAttribute("ConstType", funct.FunctionDef.Parameters[parindex].Type.StringedView);
                        valel.SetAttribute("Value", funct.Parameters[i].ToString());
                        el.AppendChild(valel);
                    }
                }
            }

            return(el);
        }
Exemple #5
0
        public static void SaveWindowConfig(string path)
        {
            var size = Manager.NativeManager.GetSize();

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();

            System.Xml.XmlElement project_root = doc.CreateElement("Root");
            project_root.AppendChild(doc.CreateTextElement("WindowWidth", size.X.ToString()));
            project_root.AppendChild(doc.CreateTextElement("WindowHeight", size.Y.ToString()));

            System.Xml.XmlElement docks = doc.CreateElement("Docks");

            foreach (var panel in panels)
            {
                if (panel != null)
                {
                    docks.AppendChild(doc.CreateTextElement(panel.GetType().ToString(), "Open"));
                }
            }

            project_root.AppendChild(docks);

            doc.AppendChild(project_root);

            var dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);

            doc.InsertBefore(dec, project_root);
            doc.Save(path);
        }
Exemple #6
0
        /// <summary>
        /// 已重载:向XML节点保存文本格式信息和字符数据
        /// </summary>
        /// <param name="myElement"></param>
        /// <returns></returns>
        public override bool ToXML(System.Xml.XmlElement myElement)
        {
            if (myElement == null)
            {
                return(false);
            }
            switch (myOwnerDocument.Info.SaveMode)
            {
            case 0:     // 保存所有数据
                System.Xml.XmlText myText = myElement.OwnerDocument.CreateTextNode(myChar.ToString());
                myElement.AppendChild(myText);
                //base.BaseToXML( myElement );
                myAttributes.ToXML(myElement);
                break;

            case 1:     // 保存纯文本数据
                System.Xml.XmlText myText2 = myElement.OwnerDocument.CreateTextNode(myChar.ToString());
                myElement.AppendChild(myText2);
                return(true);

            //break;
            case 2:     // 只保存结构化数据
                break;

            default:
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// Virtual method - override to define appropriate save to XML semantics for
        /// the subclass. Note: Call base class method from override to correctly
        /// save common elements.
        /// </summary>
        public virtual System.Xml.XmlDocument ToXml()
        {
            DateTime Start = Debug.ExecStart;

            try
            {
                System.Xml.XmlDocument xmlData = new System.Xml.XmlDocument();

                System.Xml.XmlElement xmlRoot = xmlData.CreateElement(xmlNodeInstance);
                xmlRoot.SetAttribute(xmlAttrName, Name);
                xmlData.AppendChild(xmlRoot);

                System.Xml.XmlElement xmlLogFile = xmlData.CreateElement(xmlNodeFAHLog);
                xmlLogFile.InnerText = this._RemoteFAHLogFilename;
                xmlRoot.AppendChild(xmlLogFile);

                System.Xml.XmlElement xmlUIFile = xmlData.CreateElement(xmlNodeUnitInfo);
                xmlUIFile.InnerText = this._RemoteUnitInfoFilename;
                xmlRoot.AppendChild(xmlUIFile);

                ClassLogger.Log(LogLevel.Trace, String.Format("{0} Execution Time: {1}", Debug.FunctionName, Debug.GetExecTime(Start)), "");
                return(xmlData);
            }
            catch (Exception Ex)
            {
                ClassLogger.LogException(LogLevel.Error, String.Format("{0} threw exception {1}.", Debug.FunctionName, Ex.Message), null);
            }
            return(null);
        }
Exemple #8
0
 protected override void SaveUserData(System.Xml.XmlElement node)
 {
     System.Xml.XmlDocument doc = node.OwnerDocument;
     for (int i = 0; i < this.camViews.Count; i++)
     {
         System.Xml.XmlElement camViewElem = doc.CreateElement("CamView_" + i);
         node.AppendChild(camViewElem);
         this.camViews[i].SaveUserData(camViewElem);
     }
     for (int i = 0; i < this.objViews.Count; i++)
     {
         System.Xml.XmlElement objViewElem = doc.CreateElement("ObjInspector_" + i);
         node.AppendChild(objViewElem);
         this.objViews[i].SaveUserData(objViewElem);
     }
     if (this.logView != null)
     {
         System.Xml.XmlElement logViewElem = doc.CreateElement("LogView_0");
         node.AppendChild(logViewElem);
         this.logView.SaveUserData(logViewElem);
     }
     if (this.sceneView != null)
     {
         System.Xml.XmlElement sceneViewElem = doc.CreateElement("SceneView_0");
         node.AppendChild(sceneViewElem);
         this.sceneView.SaveUserData(sceneViewElem);
     }
 }
Exemple #9
0
        /// <summary>
        /// Save this catalog to a file for the next time where WPP start.
        /// </summary>
        internal void Save(string baseFolder)
        {
            Logger.EnteringMethod(baseFolder);

            System.Xml.XmlDocument xmlDoc      = new System.Xml.XmlDocument();
            System.Xml.XmlElement  rootElement = (System.Xml.XmlElement)xmlDoc.AppendChild(xmlDoc.CreateElement("CatalogSubscription"));

            rootElement.AppendChild(xmlDoc.CreateElement("IsActive")).InnerText         = IsActive.ToString();
            rootElement.AppendChild(xmlDoc.CreateElement("Address")).InnerText          = Address;
            rootElement.AppendChild(xmlDoc.CreateElement("CheckEvery")).InnerText       = CheckEvery.ToString();
            rootElement.AppendChild(xmlDoc.CreateElement("Unit")).InnerText             = Unit.ToString();
            rootElement.AppendChild(xmlDoc.CreateElement("LastCheck")).InnerText        = LastCheckDate.ToString();
            rootElement.AppendChild(xmlDoc.CreateElement("LastCheckResult")).InnerText  = LastCheckResult.ToString();
            rootElement.AppendChild(xmlDoc.CreateElement("CatalogName")).InnerText      = CatalogName;
            rootElement.AppendChild(xmlDoc.CreateElement("Hash")).InnerText             = Hash;
            rootElement.AppendChild(xmlDoc.CreateElement("LastDownloadDate")).InnerText = LastDownloadDate.ToString();

            FileInfo catalogFile = new FileInfo(baseFolder + "\\" + this.CatalogName + ".xml");

            if (!catalogFile.Directory.Exists)
            {
                catalogFile.Directory.Create();
            }

            try
            {
                xmlDoc.Save(catalogFile.FullName);
            }
            catch (Exception ex)
            {
                Logger.Write("**** Error when saving " + catalogFile.FullName + ".\r\n" + ex.Message);
            }
        }
Exemple #10
0
        private static void CreateNode(string siteUrlRoot, long siteID, System.Xml.XmlDocument xmldoc, ref System.Xml.XmlElement parent, List <Areas.Backend.ViewModels.MenuStructure> menuList)
        {
            if (menuList != null && menuList.Count > 0)
            {
                IEnumerable <Areas.Backend.ViewModels.MenuStructure> childList = null;
                foreach (Areas.Backend.ViewModels.MenuStructure node in menuList)
                {
                    string url = "", title = "", lastmod = "";
                    if (node.Type == Areas.Backend.ViewModels.StructureType.Menu)
                    {
                        Models.MenusModels item = Models.DataAccess.MenusDAO.GetInfo(siteID, long.Parse(node.ID));
                        if (item == null || string.IsNullOrEmpty(item.Title) || string.IsNullOrEmpty(item.SN))
                        {
                            continue;
                        }
                        url     = string.Format("{0}/{1}", siteUrlRoot, item.SN);
                        title   = item.Title;
                        lastmod = item.ModifyTime.HasValue ? item.ModifyTime.Value.ToString("yyyy-MM-dd") : (item.CreateTime.HasValue ? item.CreateTime.Value.ToString("yyyy-MM-dd") : DateTime.Now.ToString("yyyy-MM-dd"));

                        childList = Areas.Backend.Models.DataAccess.StatisticConditionDAO.GetMenuORPages(siteID, long.Parse(node.ID));
                    }
                    else
                    {
                        Areas.Backend.Models.PagesModels item = Areas.Backend.Models.DataAccess.PagesDAO.GetPageInfo(siteID, long.Parse(node.ID));
                        if (item == null || string.IsNullOrEmpty(item.Title) || string.IsNullOrEmpty(item.SN))
                        {
                            continue;
                        }
                        url     = string.Format("{0}/{1}", siteUrlRoot, item.SN);
                        title   = item.Title;
                        lastmod = item.ModifyTime.HasValue ? item.ModifyTime.Value.ToString("yyyy-MM-dd") : (item.CreateTime.HasValue ? item.CreateTime.Value.ToString("yyyy-MM-dd") : DateTime.Now.ToString("yyyy-MM-dd"));
                    }
                    if (childList != null && childList.Count() > 0)
                    {
                        CreateNode(siteUrlRoot, siteID, xmldoc, ref parent, childList.ToList());
                    }
                    System.Xml.XmlElement urlNode = xmldoc.CreateElement("url");
                    System.Xml.XmlElement locNode = xmldoc.CreateElement("loc");
                    System.Xml.XmlElement lastmodNode = xmldoc.CreateElement("lastmod");
                    System.Xml.XmlElement titleNode = xmldoc.CreateElement("title");
                    titleNode.InnerXml   = title;
                    lastmodNode.InnerXml = lastmod;
                    locNode.InnerXml     = url;
                    urlNode.AppendChild(titleNode);
                    urlNode.AppendChild(locNode);
                    urlNode.AppendChild(lastmodNode);
                    parent.AppendChild(urlNode);
                }
            }
        }
        public override void SaveToXml(System.Xml.XmlElement xmlEl, System.Xml.XmlDocument doc)
        {
            base.SaveToXml(xmlEl, doc);
            xmlEl.SetAttribute("C", "1");
            xmlEl.SetAttribute("FS", ((int)this.Format).ToString());
            if (this._prompt)
            {
                xmlEl.SetAttribute("PR", "1");
            }

            foreach (Object obj in this.MdxParameters)            //calculated member references
            {
                System.Xml.XmlElement childEl = null;

                if (obj is Dimension)                // dimension
                {
                    throw new NotImplementedException();
                }
                else if (obj is Hierarchy)                // hierarchy
                {
                    childEl = doc.CreateElement("H");
                    childEl.SetAttribute("UN", obj.UniqueName);
                    xmlEl.AppendChild(childEl);
                }
                else if (obj is Level)                // level
                {
                    childEl = doc.CreateElement("L");
                    childEl.SetAttribute("UN", obj.UniqueName);
                    xmlEl.AppendChild(childEl);
                }
                else if (obj is Member)                // member
                {
                    Member mem = obj as Member;

                    childEl = doc.CreateElement("M");
                    mem.SaveToXml(childEl, doc);
                    if (mem.Hierarchy != this.Hierarchy)
                    {
                        childEl.SetAttribute("H", mem.Hierarchy.UniqueName);
                    }
                    xmlEl.AppendChild(childEl);
                }

                if (childEl != null && this.MdxParameters.CheckHierarchy(obj.UniqueName))
                {
                    childEl.SetAttribute("CH", "1");
                }
            }
        }
Exemple #12
0
        CreateKeyValuePair(
            System.Xml.XmlDocument doc,
            System.Xml.XmlElement parent,
            string key,
            string value)
        {
            var keyEl = doc.CreateElement("key");

            keyEl.InnerText = key;
            var valueEl = doc.CreateElement("string");

            valueEl.InnerText = value;
            parent.AppendChild(keyEl);
            parent.AppendChild(valueEl);
        }
Exemple #13
0
        internal void SaveSettings(List <WsusServer> wsusServers)
        {
            Logger.EnteringMethod(wsusServers.Count.ToString());
            try
            {
                if (System.IO.File.Exists("Options.xml"))
                {
                    System.IO.File.Move("Options.xml", "Options.xml.bak");
                }
            }
            catch (Exception ex)
            {
                Logger.Write("**** Error when backuping options.xml.\r\n" + ex.Message);
                MessageBox.Show(ex.Message);
            }

            System.Xml.XmlDocument xmlDoc      = new System.Xml.XmlDocument();
            System.Xml.XmlElement  rootElement = (System.Xml.XmlElement)xmlDoc.AppendChild(xmlDoc.CreateElement("WsusPackagePublisher"));

            foreach (WsusServer server in wsusServers)
            {
                Logger.Write(server.Name);
                System.Xml.XmlElement serverElement = (System.Xml.XmlElement)rootElement.AppendChild(xmlDoc.CreateElement("Server"));
                serverElement.AppendChild(xmlDoc.CreateElement("Name")).InnerText                 = server.Name;
                serverElement.AppendChild(xmlDoc.CreateElement("IsLocal")).InnerText              = server.IsLocal.ToString();
                serverElement.AppendChild(xmlDoc.CreateElement("Port")).InnerText                 = server.Port.ToString();
                serverElement.AppendChild(xmlDoc.CreateElement("UseSSL")).InnerText               = server.UseSSL.ToString();
                serverElement.AppendChild(xmlDoc.CreateElement("IgnoreCertErrors")).InnerText     = server.IgnoreCertificateErrors.ToString();
                serverElement.AppendChild(xmlDoc.CreateElement("DeadLineDaysSpan")).InnerText     = server.DeadLineDaysSpan.ToString();
                serverElement.AppendChild(xmlDoc.CreateElement("DeadLineHour")).InnerText         = server.DeadLineHour.ToString();
                serverElement.AppendChild(xmlDoc.CreateElement("DeadLineMinute")).InnerText       = server.DeadLineMinute.ToString();
                serverElement.AppendChild(xmlDoc.CreateElement("VisibleInWsusConsole")).InnerText = server.VisibleInWsusConsole.ToString();
                if (server.MetaGroups.Count != 0)
                {
                    SaveMetaGroup(xmlDoc, server, serverElement);
                }
            }

            try
            {
                xmlDoc.Save("Options.xml");

                if (System.IO.File.Exists("Options.xml.bak"))
                {
                    System.IO.File.Delete("Options.xml.bak");
                }
            }
            catch (Exception ex)
            {
                Logger.Write("**** Error when saving options.xml or deleting option.xml.bak.\r\n" + ex.Message);
                MessageBox.Show(ex.Message);
            }
        }
Exemple #14
0
        /// <summary> Encodes a Composite in XML by looping through it's components, creating new
        /// children for each of them (with the appropriate names) and populating them by
        /// calling encode(Type, Element) using these children.  Returns true if at least
        /// one component contains a value.
        /// </summary>
        private bool encodeComposite(Composite datatypeObject, System.Xml.XmlElement datatypeElement)
        {
            Type[] components = datatypeObject.Components;
            bool   hasValue   = false;

            for (int i = 0; i < components.Length; i++)
            {
                System.String         name    = makeElementName(datatypeObject, i + 1);
                System.Xml.XmlElement newNode = datatypeElement.OwnerDocument.CreateElement(name);
                bool componentHasValue        = encode(components[i], newNode);
                if (componentHasValue)
                {
                    try
                    {
                        datatypeElement.AppendChild(newNode);
                    }
                    //UPGRADE_TODO: Class 'org.w3c.dom.DOMException' was converted to 'System.Exceptiont' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                    catch (System.Exception e)
                    {
                        throw new DataTypeException("DOMException encoding Composite: ", e);
                    }
                    hasValue = true;
                }
            }
            return(hasValue);
        }
Exemple #15
0
        /// <summary> Populates the given Element with data from the given Segment, by inserting
        /// Elements corresponding to the Segment's fields, their components, etc.  Returns
        /// true if there is at least one data value in the segment.
        /// </summary>
        public virtual bool encode(Segment segmentObject, System.Xml.XmlElement segmentElement)
        {
            bool hasValue = false;
            int  n        = segmentObject.numFields();

            for (int i = 1; i <= n; i++)
            {
                System.String name = makeElementName(segmentObject, i);
                Type[]        reps = segmentObject.getField(i);
                for (int j = 0; j < reps.Length; j++)
                {
                    System.Xml.XmlElement newNode = segmentElement.OwnerDocument.CreateElement(name);
                    bool componentHasValue        = encode(reps[j], newNode);
                    if (componentHasValue)
                    {
                        try
                        {
                            segmentElement.AppendChild(newNode);
                        }
                        //UPGRADE_TODO: Class 'org.w3c.dom.DOMException' was converted to 'System.Exceptiont' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                        catch (System.Exception e)
                        {
                            throw new HL7Exception("DOMException encoding Segment: ", HL7Exception.APPLICATION_INTERNAL_ERROR, e);
                        }
                        hasValue = true;
                    }
                }
            }
            return(hasValue);
        }
Exemple #16
0
        private void MyXml(CLAS.InsolvencyRow r, System.Xml.XmlDocument xd)
        {
            System.Xml.XmlElement xe = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@type='insolvency' and @id=" + r.InsolvencyID.ToString() + "]");
            if (xe == null)
            {
                xe = xd.CreateElement("toc");
                xe.SetAttribute("type", "insolvency");
            }
            xe.SetAttribute("id", r.InsolvencyID.ToString());

            string dischargeable = Properties.Resources.BKCSLDischargeable;

            if (r.CSLNonDischargeable)
            {
                dischargeable = Properties.Resources.BKCSLNonDischargeable;
            }

            string title = r.InsolvencyType.ToString();

            title += " - " + r.InsolvencyFiledDate.ToString("yyyy/MM/dd") + dischargeable;
            xe.SetAttribute("titlee", title);
            xe.SetAttribute("titlef", title);
            if (!r.IsProvenClaimAmountNull())
            {
                xe.SetAttribute("tooltipee", r.ProvenClaimAmount.ToString("C"));
                xe.SetAttribute("tooltipef", r.ProvenClaimAmount.ToString("C"));
            }

            if (xe.ParentNode == null)
            {
                System.Xml.XmlElement xes = EFileBE.XmlAddFld(xd, "insolvency", "Insolvency", "Insolvabilité", 240);
                xes.AppendChild(xe);
            }
        }
Exemple #17
0
        }     // End Sub SaveRows

        private void SaveCell(System.Data.DataRow row
                              , System.Xml.XmlNode rowNode,
                              System.Xml.XmlDocument ownerDocument)
        {
            object[] cells = row.ItemArray;

            for (int i = 0; i < cells.Length; i++)
            {
                System.Xml.XmlElement cellNode =
                    ownerDocument.CreateElement("table:table-cell", this.GetNamespaceUri("table"));

                if (row[i] != System.DBNull.Value)
                {
                    // We save values as text (string)
                    System.Xml.XmlAttribute valueType =
                        ownerDocument.CreateAttribute("office:value-type", this.GetNamespaceUri("office"));
                    valueType.Value = "string";
                    cellNode.Attributes.Append(valueType);

                    System.Xml.XmlElement cellValue =
                        ownerDocument.CreateElement("text:p", this.GetNamespaceUri("text"));
                    cellValue.InnerText = row[i].ToString();
                    cellNode.AppendChild(cellValue);
                } // End if (row[i] != System.DBNull.Value)

                rowNode.AppendChild(cellNode);
            } // Next i
        }     // End Sub SaveCell
Exemple #18
0
        private static double MSXMLapproach(int numberOfElements, int numerOfAttributes, List <string> elemetNames, List <string> attributeNames, List <string> attributeValues)
        {
            DateTime now = DateTime.Now;

            System.Xml.XmlDocument    doc    = new System.Xml.XmlDocument();
            System.Xml.XmlDeclaration header = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes");
            System.Xml.XmlElement     root   = doc.DocumentElement;
            doc.InsertBefore(header, root);
            System.Xml.XmlElement rootElement = doc.CreateElement(string.Empty, "root", string.Empty);
            doc.AppendChild(rootElement);
            for (int i = 0; i < numberOfElements; i++)
            {
                System.Xml.XmlElement element = doc.CreateElement(string.Empty, elemetNames[i], string.Empty);
                for (int j = 0; j < numerOfAttributes; j++)
                {
                    //element.SetAttribute(attributeNameTemplate + j, attributeValueTemplate);
                    element.SetAttribute(attributeNames[j], attributeValues[j]);
                }
                rootElement.AppendChild(element);
            }
            string   output = doc.OuterXml;
            TimeSpan t      = DateTime.Now - now;

            return(t.TotalMilliseconds);
        }
Exemple #19
0
        /// <summary>
        /// Populates the given Element with data from the given Segment, by inserting Elements
        /// corresponding to the Segment's fields, their components, etc.  Returns true if there is at
        /// least one data value in the segment.
        /// </summary>
        ///
        /// <exception cref="HL7Exception"> Thrown when a HL 7 error condition occurs. </exception>
        ///
        /// <param name="segmentObject">    The segment object. </param>
        /// <param name="segmentElement">   Element describing the segment. </param>
        ///
        /// <returns>   true if it succeeds, false if it fails. </returns>

        public virtual bool Encode(ISegment segmentObject, System.Xml.XmlElement segmentElement)
        {
            bool hasValue = false;
            int  n        = segmentObject.NumFields();

            for (int i = 1; i <= n; i++)
            {
                System.String name = MakeElementName(segmentObject, i);
                IType[]       reps = segmentObject.GetField(i);
                for (int j = 0; j < reps.Length; j++)
                {
                    System.Xml.XmlElement newNode = segmentElement.OwnerDocument.CreateElement(name);
                    bool componentHasValue        = Encode(reps[j], newNode);
                    if (componentHasValue)
                    {
                        try
                        {
                            segmentElement.AppendChild(newNode);
                        }
                        catch (System.Exception e)
                        {
                            throw new HL7Exception(
                                      "DOMException encoding Segment: ",
                                      HL7Exception.APPLICATION_INTERNAL_ERROR,
                                      e);
                        }
                        hasValue = true;
                    }
                }
            }
            return(hasValue);
        }
Exemple #20
0
        /// <summary>
        ///
        /// </summary>
        public Database()
        {
            //which database
            //db_type = Form1.config.config_xml.DocumentElement["database_type"].InnerXml;

            if (!Form1.config.Get_xml_config("database_type", ref db_type))
            {
                System.Xml.XmlElement database_type = Form1.config.config_xml.CreateElement("database_type");
                database_type.InnerXml = "xml";
                System.Xml.XmlElement root = Form1.config.config_xml.DocumentElement;
                root.AppendChild(database_type);
                Form1.config.Save_config_file();
            }
            Form1.config.Get_xml_config("database_type", ref db_type);
            if (db_type == "flat")
            {
                db = new Db_text();
            }
            else if (db_type == "xml")
            {
                db = new Db_xml();
            }
            else
            {
                string log_output;
                log_output = "error: database type " + db_type + " unknown";
                Form1.logWindow.Write_to_log(ref log_output);
                return;
            }

            data = new DataSet();
        }
Exemple #21
0
        public override System.Xml.XmlDocument ToXml()
        {
            System.Xml.XmlDocument xmlDoc = base.ToXml();

            System.Xml.XmlElement xmlTypeEl = xmlDoc.CreateElement(XmlPropType);
            System.Xml.XmlNode    xmlType   = xmlDoc.CreateNode(System.Xml.XmlNodeType.Text, XmlPropType, String.Empty);
            xmlType.Value = this.GetType().ToString();
            xmlTypeEl.AppendChild(xmlType);

            System.Xml.XmlElement xmlURLEl = xmlDoc.CreateElement(XmlPropURL);
            System.Xml.XmlNode    xmlURL   = xmlDoc.CreateNode(System.Xml.XmlNodeType.Text, XmlPropURL, String.Empty);
            xmlURL.Value = URL;
            xmlURLEl.AppendChild(xmlURL);

            System.Xml.XmlElement xmlUsernameEl = xmlDoc.CreateElement(XmlPropUser);
            System.Xml.XmlNode    xmlUsername   = xmlDoc.CreateNode(System.Xml.XmlNodeType.Text, XmlPropUser, String.Empty);
            xmlUsername.Value = Username;
            xmlUsernameEl.AppendChild(xmlUsername);

            System.Xml.XmlElement xmlPasswordEl = xmlDoc.CreateElement(XmlPropPass);
            System.Xml.XmlNode    xmlPassword   = xmlDoc.CreateNode(System.Xml.XmlNodeType.Text, XmlPropPass, String.Empty);
            xmlPassword.Value = Password;
            xmlPasswordEl.AppendChild(xmlPassword);

            xmlDoc.ChildNodes[0].AppendChild(xmlTypeEl);
            xmlDoc.ChildNodes[0].AppendChild(xmlURLEl);
            xmlDoc.ChildNodes[0].AppendChild(xmlUsernameEl);
            xmlDoc.ChildNodes[0].AppendChild(xmlPasswordEl);

            return(xmlDoc);
        }
        public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc)
        {
            string connectionString = string.Empty;
            string tableName        = string.Empty;
            string projectPath      = string.Empty;
            string viewName         = string.Empty;

            if (dashboardHelper.View == null)
            {
                connectionString = dashboardHelper.Database.ConnectionString;
                tableName        = dashboardHelper.TableName;
            }
            else
            {
                projectPath = dashboardHelper.View.Project.FilePath;
                viewName    = dashboardHelper.View.Name;
            }
            string          dataKey   = cbxDataKey.SelectedItem.ToString();
            string          shapeKey  = cbxShapeKey.SelectedItem.ToString();
            string          value     = cbxValue.SelectedItem.ToString();
            SolidColorBrush dotColor  = (SolidColorBrush)rctDotColor.Fill;
            string          xmlString = "<shapeFile>" + shapeFilePath + "</shapeFile><dotColor>" + dotColor.Color.ToString() + "</dotColor><dotValue>" + txtDotValue.Text + "</dotValue><dataKey>" + dataKey + "</dataKey><shapeKey>" + shapeKey + "</shapeKey><value>" + value + "</value>";

            System.Xml.XmlElement element = doc.CreateElement("dataLayer");
            element.InnerXml = xmlString;
            element.AppendChild(dashboardHelper.Serialize(doc));

            System.Xml.XmlAttribute type = doc.CreateAttribute("layerType");
            type.Value = "EpiDashboard.Mapping.DotDensityKmlLayerProperties";
            element.Attributes.Append(type);

            return(element);
        }
Exemple #23
0
        private void XmlRegion(System.Xml.XmlNode parent, int dice, string name, UWP uwp)
        {
            System.Xml.XmlElement region  = parent.OwnerDocument.CreateElement("Region");
            System.Xml.XmlElement nameEle = parent.OwnerDocument.CreateElement("name");
            nameEle.InnerText = name;
            region.AppendChild(nameEle);

            if (dice == 1)
            {
                XmlCritter(region, 1);
                XmlCritter(region, 2);
                XmlCritter(region, 3);
                XmlCritter(region, 4);
                XmlCritter(region, 5);
                XmlCritter(region, 6);
            }
            else
            {
                XmlCritter(region, 2);
                XmlCritter(region, 3);
                XmlCritter(region, 4);
                XmlCritter(region, 5);
                XmlCritter(region, 6);
                XmlCritter(region, 7);
                XmlCritter(region, 8);
                XmlCritter(region, 9);
                XmlCritter(region, 10);
                XmlCritter(region, 11);
                XmlCritter(region, 12);
            }
            parent.AppendChild(region);
        }
        public override System.Xml.XmlDocument XmlSerialize()
        {
            System.Xml.XmlDocument document = base.XmlSerialize();

            System.Xml.XmlNode propertiesNode = document.ChildNodes[1].ChildNodes[0];


            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "ServiceId", serviceId.ToString());

            //CommonFunctions.XmlDocumentAppendPropertyNode (document, propertiesNode, "DefinitionServiceId", definitionServiceId.ToString ());

            //CommonFunctions.XmlDocumentAppendPropertyNode (document, propertiesNode, "DefinitionServiceName", application.CoreObjectGetNameById ("Service", definitionServiceId));

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "Enabled", Enabled.ToString());


            // TODO: UPDATE V2, ADD SERVICE DEFINITION AS CHILD PROPERTY


            System.Xml.XmlElement definitionServicePropertyNode = CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "DefinitionService", String.Empty);

            definitionServicePropertyNode.AppendChild(document.ImportNode(DefinitionService.XmlSerialize().ChildNodes[1], true));


            return(document);
        }
Exemple #25
0
        /// <summary>
        /// Encodes a Composite in XML by looping through it's components, creating new children for each
        /// of them (with the appropriate names) and populating them by calling encode(Type, Element)
        /// using these children.  Returns true if at least one component contains a value.
        /// </summary>
        ///
        /// <exception cref="DataTypeException">    Thrown when a Data Type error condition occurs. </exception>
        ///
        /// <param name="datatypeObject">   The datatype object. </param>
        /// <param name="datatypeElement">  Element describing the datatype. </param>
        ///
        /// <returns>   true if it succeeds, false if it fails. </returns>

        private bool EncodeComposite(IComposite datatypeObject, System.Xml.XmlElement datatypeElement)
        {
            IType[] components = datatypeObject.Components;
            bool    hasValue   = false;

            for (int i = 0; i < components.Length; i++)
            {
                System.String         name    = MakeElementName(datatypeObject, i + 1);
                System.Xml.XmlElement newNode = datatypeElement.OwnerDocument.CreateElement(name);
                bool componentHasValue        = Encode(components[i], newNode);
                if (componentHasValue)
                {
                    try
                    {
                        datatypeElement.AppendChild(newNode);
                    }
                    catch (System.Exception e)
                    {
                        throw new DataTypeException("DOMException encoding Composite: ", e);
                    }
                    hasValue = true;
                }
            }
            return(hasValue);
        }
Exemple #26
0
        /// <summary>
        /// Creates an xml Element to be added to a Project xml
        /// </summary>
        /// <param name="contentName">The name of the artifact for which to create a "Content" node</param>
        /// <param name="origXMLDoc">the document that the element will be added to, not by this method</param>
        /// <returns>XMLNode of name "Content"</returns>
        private System.Xml.XmlElement GetProjectContentNode(string contentName, System.Xml.XmlDocument origXMLDoc)
        {
            System.Xml.XmlElement   contentNode  = origXMLDoc.CreateElement("Content");
            System.Xml.XmlElement   subTypeNode  = origXMLDoc.CreateElement("SubType");
            System.Xml.XmlElement   excludedNode = origXMLDoc.CreateElement("Excluded");
            System.Xml.XmlAttribute includeAttr  = origXMLDoc.CreateAttribute("Include");

            subTypeNode.InnerText = "Content";
            includeAttr.Value     = contentName;

            contentNode.Attributes.Append(includeAttr);
            contentNode.AppendChild(subTypeNode);
            contentNode.AppendChild(excludedNode);

            return(contentNode);
        }
Exemple #27
0
        /// <summary>
        /// Write registry to file.
        /// </summary>
        public void write()
        {
            try
            {
                lock (_mutex)
                {
                    System.Xml.XmlDocument doc  = new System.Xml.XmlDocument();
                    System.Xml.XmlElement  root = doc.CreateElement("registry");
                    doc.AppendChild(root);

                    foreach (string section in _sections.Keys)
                    {
                        Section hash = this.getSectionHash(section);
                        System.Xml.XmlElement element = doc.CreateElement(section);
                        root.AppendChild(element);
                        foreach (string key in hash.Keys)
                        {
                            string value = hash[key].ToString();
                            System.Xml.XmlElement child = doc.CreateElement(key);
                            child.InnerText = value;
                            element.AppendChild(child);
                        }
                    }

                    doc.Save(this._file());
                }
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error {0}: {1}", 2112056395, e.Message);
            }
        }
Exemple #28
0
        /// <summary>
        /// Write out settings for the GIS dataset
        /// </summary>
        /// <param name="oDatasetElement"></param>
        /// <param name="strDestFolder"></param>
        /// <param name="bDefaultResolution"></param>
        /// <returns></returns>
        internal override ExtractSaveResult Save(System.Xml.XmlElement oDatasetElement, string strDestFolder, DownloadSettings.DownloadCoordinateSystem eCS)
        {
            ExtractSaveResult result = base.Save(oDatasetElement, strDestFolder, eCS);

            System.Xml.XmlAttribute oPathAttr = oDatasetElement.OwnerDocument.CreateAttribute("file");
            if (cbOptions.SelectedIndex == SAVE_AS_MAP)
            {
                oPathAttr.Value = System.IO.Path.Combine(strDestFolder, System.IO.Path.ChangeExtension(Utility.FileSystem.SanitizeFilename(tbFilename.Text), MAP_EXT));
            }
            else if (cbOptions.SelectedIndex == SAVE_AS_SHP_IMPORT || cbOptions.SelectedIndex == SAVE_AS_SHP_NOIMPORT)
            {
                // Shape file uses a namespace name, not a file name (produces oodles of files)
                oPathAttr.Value = System.IO.Path.Combine(strDestFolder, System.IO.Path.GetFileNameWithoutExtension(Utility.FileSystem.SanitizeFilename(tbFilename.Text)));
            }
            else if (cbOptions.SelectedIndex == SAVE_AS_TAB_IMPORT || cbOptions.SelectedIndex == SAVE_AS_TAB_NOIMPORT)
            {
                oPathAttr.Value = System.IO.Path.Combine(strDestFolder, System.IO.Path.ChangeExtension(Utility.FileSystem.SanitizeFilename(tbFilename.Text), TAB_EXT));
            }
            oDatasetElement.Attributes.Append(oPathAttr);

            System.Xml.XmlAttribute oGroupAttribute = oDatasetElement.OwnerDocument.CreateAttribute("group");
            oGroupAttribute.Value = Utility.FileSystem.SanitizeFilename(tbGroupName.Text);
            oDatasetElement.Attributes.Append(oGroupAttribute);

            System.Xml.XmlElement         oDownloadElement = oDatasetElement.OwnerDocument.CreateElement("download_options");
            Options.GIS.OMDownloadOptions eOption          = (Options.GIS.OMDownloadOptions)cbOptions.SelectedIndex;
            oDownloadElement.InnerXml = eOption.ToString();
            oDatasetElement.AppendChild(oDownloadElement);

            return(result);
        }
        //--

        public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc)
        {
            string connectionString = string.Empty;
            string tableName        = string.Empty;
            string projectPath      = string.Empty;
            string viewName         = string.Empty;

            if (dashboardHelper.View == null)
            {
                connectionString = dashboardHelper.Database.ConnectionString;
                tableName        = dashboardHelper.TableName;
            }
            else
            {
                projectPath = dashboardHelper.View.Project.FilePath;
                viewName    = dashboardHelper.View.Name;
            }
            string          latitude    = cbxLatitude.SelectedItem.ToString();
            string          longitude   = cbxLongitude.SelectedItem.ToString();
            SolidColorBrush color       = (SolidColorBrush)rctColor.Fill;
            string          style       = cbxStyle.SelectedItem.ToString();
            string          description = txtDescription.Text;
            string          xmlString   = "<description>" + description + "</description><color>" + color.Color.ToString() + "</color><style>" + style + "</style><latitude>" + latitude + "</latitude><longitude>" + longitude + "</longitude>";

            System.Xml.XmlElement element = doc.CreateElement("dataLayer");
            element.InnerXml = xmlString;
            element.AppendChild(dashboardHelper.Serialize(doc));

            System.Xml.XmlAttribute type = doc.CreateAttribute("layerType");
            type.Value = "EpiDashboard.Mapping.PointLayerProperties";
            element.Attributes.Append(type);

            return(element);
        }
Exemple #30
0
        private void MyXml(CLAS.FileAccountRow r, System.Xml.XmlDocument xd)
        {
            System.Xml.XmlElement xe = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@type='account' and @id=" + r.FileAccountId.ToString() + "]");
            if (xe == null)
            {
                xe = xd.CreateElement("toc");
                xe.SetAttribute("type", "account");
                xe.SetAttribute("supertype", "fileaccount");
            }
            xe.SetAttribute("id", r.FileAccountId.ToString());
            xe.SetAttribute("titlee", r["AccountTypeCode"].ToString() + " (" + r["DARSAccountType"].ToString() + ")");
            xe.SetAttribute("titlef", r["AccountTypeCode"].ToString() + " (" + r["DARSAccountType"].ToString() + ")");

            if (r.ActiveWithJustice)
            {
                xe.SetAttribute("tooltipe", "Assigned");
                xe.SetAttribute("strikeout", "false");
            }
            else
            {
                xe.SetAttribute("tooltipe", "Not Assigned");
                xe.SetAttribute("strikeout", "true");
            }


            if (xe.ParentNode == null)
            {
                System.Xml.XmlElement xes = EFileBE.XmlAddFld(xd, "account", "Accounts", "Comptes", 220);
                xes.AppendChild(xe);
            }
        }