public override List <ImportExport.Result> XmlImport(System.Xml.XmlNode objectNode)
        {
            List <ImportExport.Result> response = base.XmlImport(objectNode);

            MedicalServices.Service service = null;

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

                        #region Dependencies

                        foreach (System.Xml.XmlNode currentDependencyNode in currentNode.ChildNodes)
                        {
                            switch (currentDependencyNode.Name)
                            {
                            case "ServiceSet":

                                service = application.MedicalServiceGet(currentNode.Attributes["Name"].Value);

                                if (service == null)
                                {
                                    MedicalServices.ServiceSet serviceSet = new MedicalServices.ServiceSet(application);

                                    response.AddRange(serviceSet.XmlImport(currentNode));
                                }

                                break;

                            case "ServiceSingleton":

                                service = application.MedicalServiceGet(currentNode.Attributes["Name"].Value);

                                if (service == null)
                                {
                                    MedicalServices.ServiceSingleton serviceSingleton = new MedicalServices.ServiceSingleton(application);

                                    response.AddRange(serviceSingleton.XmlImport(currentNode));
                                }

                                break;

                            case "AuthorizedService":

                                Core.AuthorizedServices.AuthorizedService authorizedService = application.AuthorizedServiceGet(currentNode.Attributes["Name"].Value);

                                if (authorizedService == null)
                                {
                                    authorizedService = new AuthorizedServices.AuthorizedService(application);

                                    response.AddRange(authorizedService.XmlImport(currentDependencyNode));
                                }

                                break;

                            case "Metric":

                                Core.Metrics.Metric metric = application.MetricGet(currentNode.Attributes["Name"].Value);

                                if (metric == null)
                                {
                                    metric = new Metrics.Metric(application);

                                    response.AddRange(metric.XmlImport(currentDependencyNode));
                                }

                                break;

                            case "ProblemStatement":

                                // TODO:

                                break;
                            }
                        }

                        #endregion

                        break;

                    case "Properties":

                        #region Properties

                        foreach (System.Xml.XmlNode currentPropertyNode in currentNode.ChildNodes)
                        {
                            switch (currentPropertyNode.Attributes["Name"].Value)
                            {
                            case "EventTypeInt32": EventType = (Enumerations.PopulationTriggerEventType)Convert.ToInt32(currentPropertyNode.InnerText); break;

                            case "MetricTypeInt32": MetricType = (Metrics.Enumerations.MetricType)Convert.ToInt32(currentPropertyNode.InnerText); break;

                            case "MetricMinimum": MetricMinimum = Convert.ToDecimal(currentPropertyNode.InnerText); break;

                            case "MetricMaximum": MetricMaximum = Convert.ToDecimal(currentPropertyNode.InnerText); break;

                            case "AuthorizedServiceName": authorizedServiceId = application.AuthorizedServiceGetIdByName(currentPropertyNode.InnerText); break;

                            case "ServiceName": serviceId = application.CoreObjectGetIdByName("Service", currentPropertyNode.InnerText); break;

                            case "MetricName": metricId = application.MetricGetIdByName(currentPropertyNode.InnerText); break;

                            case "ProblemStatementName": /* TODO */ break;
                            }
                        }

                        #endregion

                        break;

                    case "Action":

                        action = new Action.Action(application);

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

                        break;
                    } // switch (currentNode.Name) {
                }     // foreach (System.Xml.XmlNode currentNode in objectNode.ChildNodes) {

                // SAVE IS PERFORMED BY PARENT OBJECT
            }

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

            return(response);
        }
Пример #2
0
        public override List <ImportExport.Result> XmlImport(System.Xml.XmlNode objectNode)
        {
            List <ImportExport.Result> response = base.XmlImport(objectNode);

            MedicalServices.Service service = null;

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

                        #region Properties

                        foreach (System.Xml.XmlNode currentPropertyNode in currentNode.ChildNodes)
                        {
                            switch (currentPropertyNode.Attributes["Name"].Value)
                            {
                            case "EventTypeInt32": EventType = (Enumerations.ConditionCriteriaEventType)Convert.ToInt32(currentPropertyNode.InnerText); break;
                            }
                        }

                        #endregion

                        break;

                    case "ServiceSet":

                        service = application.MedicalServiceGet(currentNode.Attributes["Name"].Value);

                        if (service == null)
                        {
                            MedicalServices.ServiceSet serviceSet = new MedicalServices.ServiceSet(application);

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

                            service = serviceSet;
                        }

                        if (service != null)
                        {
                            serviceId = service.Id;
                        }

                        break;

                    case "ServiceSingleton":

                        service = application.MedicalServiceGet(currentNode.Attributes["Name"].Value);

                        if (service == null)
                        {
                            MedicalServices.ServiceSingleton serviceSingleton = new MedicalServices.ServiceSingleton(application);

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

                            service = serviceSingleton;
                        }

                        if (service != null)
                        {
                            serviceId = service.Id;
                        }

                        break;
                    } // switch (currentNode.Name) {
                }     // foreach (System.Xml.XmlNode currentNode in objectNode.ChildNodes) {

                // SAVE IS PERFORMED BY PARENT OBJECT
            }

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

            return(response);
        }