Esempio n. 1
0
        public override System.Xml.XmlDocument XmlSerialize()
        {
            System.Xml.XmlDocument document = base.XmlSerialize();

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


            #region Properties

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

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

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CareMeasureScaleName", CareMeasureScaleName);

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "Tag", Tag);

            #endregion


            #region Object Nodes

            document.LastChild.AppendChild(document.ImportNode(CareMeasureScale.XmlSerialize().LastChild, true));

            #endregion


            return(document);
        }
Esempio n. 2
0
        public override List <ImportExport.Result> XmlImport(System.Xml.XmlNode objectNode)
        {
            List <ImportExport.Result> response = base.XmlImport(objectNode);


            try {
                foreach (System.Xml.XmlNode currentNode in objectNode.ChildNodes)
                {
                    switch (currentNode.Name)
                    {
                    case "Properties":

                        foreach (System.Xml.XmlNode currentPropertyNode in currentNode.ChildNodes)
                        {
                            switch (currentPropertyNode.Attributes["Name"].InnerText)
                            {
                            case "Tag":

                                tag = currentPropertyNode.InnerText;

                                break;

                            default: break;
                            }
                        }

                        break;

                    case "CareMeasureScale":

                        careMeasureScaleId = application.CoreObjectGetIdByName("CareMeasureScale", currentNode.Attributes["Name"].InnerText);

                        if (careMeasureScaleId == 0)
                        {
                            // DOES NOT EXIST, CREATE NEW FROM IMPORT

                            CareMeasureScale careMeasureScale = new CareMeasureScale(application);

                            response.AddRange(careMeasureScale.XmlImport(currentNode));

                            careMeasureScaleId = application.CoreObjectGetIdByName("CareMeasureScale", currentNode.Attributes["Name"].InnerText);

                            if (careMeasureScaleId == 0)
                            {
                                throw new ApplicationException("Unable to import Care Measure Scale: " + currentNode.Attributes["Name"].InnerText + ".");
                            }
                        }

                        break;
                    } // switch (currentNode.Attributes["Name"].InnerText) {
                }     // foreach (System.Xml.XmlNode currentNode in objectNode.ChildNodes) {


                // DO NOT CALL THE SAVE FUNCTION, THIS IS A CHILD OBJECT THAT SHOULD BE SAVED THROUGH THE PARENT
            }

            catch (Exception importException) {
                response.Add(new ImportExport.Result(ObjectType, Name, importException));
            }

            return(response);
        }