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": #region Properties foreach (System.Xml.XmlNode currentPropertyNode in currentNode.ChildNodes) { switch (currentPropertyNode.Attributes["Name"].Value) { case "ScheduleTypeInt32": ScheduleType = (Enumerations.PopulationActivityScheduleType)Convert.ToInt32(currentPropertyNode.InnerText); break; case "ScheduleValue": ScheduleValue = Convert.ToInt32(currentPropertyNode.InnerText); break; case "ScheduleQualifierInt32": ScheduleQualifier = (Core.Enumerations.DateQualifier)Convert.ToInt32(currentPropertyNode.InnerText); break; case "AnchorDateInt32": AnchorDate = (Enumerations.PopulationActivityEventAnchorDate)Convert.ToInt32(currentPropertyNode.InnerText); break; case "Reoccurring": Reoccurring = Convert.ToBoolean(currentPropertyNode.InnerText); break; case "PerformActionDateTypeInt32": PerformActionDateType = (Enumerations.PopulationActivityPerformActionDateType)Convert.ToInt32(currentPropertyNode.InnerText); 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); }
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); }