Exemple #1
0
        public PopulationTriggerEvent(Application applicationReference, Mercury.Server.Application.PopulationTriggerEvent serverObject)
        {
            BaseConstructor(applicationReference, serverObject);


            populationId = serverObject.PopulationId;

            eventType = serverObject.EventType;

            serviceId = serverObject.ServiceId;

            metricType = serverObject.MetricType;

            metricId = serverObject.MetricId;

            metricMinimum = serverObject.MetricMinimum;

            metricMaximum = serverObject.MetricMaximum;

            authorizedServiceId = serverObject.AuthorizedServiceId;

            problemStatementId = serverObject.ProblemStatementId;

            action = new Mercury.Client.Core.Action.Action(application, serverObject.Action);

            createAccountInfo = serverObject.CreateAccountInfo;

            modifiedAccountInfo = serverObject.ModifiedAccountInfo;

            return;
        }
        override public void MapDataFields(System.Data.DataRow currentRow)
        {
            base.MapDataFields(currentRow);


            populationId = (Int64)currentRow["PopulationId"];

            eventType = (Mercury.Server.Core.Population.Enumerations.PopulationTriggerEventType)(Int32) currentRow ["TriggerEventType"];

            serviceId = base.IdFromSql(currentRow, "ServiceId");

            metricType = (Mercury.Server.Core.Metrics.Enumerations.MetricType)(Int32) currentRow ["MetricType"];

            metricId = base.IdFromSql(currentRow, "MetricId");

            metricMinimum = (Decimal)currentRow["MetricMinimum"];

            metricMaximum = (Decimal)currentRow["MetricMaximum"];

            authorizedServiceId = base.IdFromSql(currentRow, "AuthorizedServiceId");

            problemStatementId = base.IdFromSql(currentRow, "ProblemStatementId");


            action = new Mercury.Server.Core.Action.Action(base.application);

            action.MapDataFields(String.Empty, currentRow);

            return;
        }
        public IDecisionNode BuildTreeFromDocument(IXmlFileController reader, Core.Action.Action action, string myName)
        {
            // ReSharper disable once JoinNullCheckWithUsage
            if (reader == null)
            {
                throw new RnpcParameterException("Objects FileController has not been properly initialized.");
            }

            _reader        = reader;
            _characterName = myName;
            _currentAction = action;

            string treeName = $"{action.ActionType}-{action.Intent}-{action.EventName}";

            var element = GetXmlElementForAction(treeName);

            var defaultreaction = string.Empty;

            if (element?.Attributes["defaultreaction"] != null)
            {
                defaultreaction = element.Attributes["defaultreaction"].Value;
            }

            var rootNode = InitializeNodeWithXmlElement(element?.FirstChild, null, defaultreaction);

            return(rootNode);
        }
Exemple #4
0
        public PopulationActivityEvent(Application applicationReference, Mercury.Server.Application.PopulationActivityEvent serverEvent)
        {
            BaseConstructor(applicationReference, serverEvent);


            populationId = serverEvent.PopulationId;

            scheduleType = serverEvent.ScheduleType;

            scheduleValue = serverEvent.ScheduleValue;

            scheduleQualifier = serverEvent.ScheduleQualifier;


            anchorDate = serverEvent.AnchorDate;

            reoccurring = serverEvent.Reoccurring;

            performActionDateType = serverEvent.PerformActionDateType;


            action = new Mercury.Client.Core.Action.Action(applicationReference, serverEvent.Action);

            return;
        }
        override public void MapDataFields(System.Data.DataRow currentRow)
        {
            base.MapDataFields(currentRow);


            populationId = (Int64)currentRow["PopulationId"];

            scheduleType = (Mercury.Server.Core.Population.Enumerations.PopulationActivityScheduleType)(Int32) currentRow["ScheduleType"];

            scheduleValue = (Int32)currentRow["ScheduleValue"];

            scheduleQualifier = (Mercury.Server.Core.Enumerations.DateQualifier)(Int32) currentRow["ScheduleQualifier"];

            anchorDate = (Mercury.Server.Core.Population.Enumerations.PopulationActivityEventAnchorDate)(Int32) currentRow ["AnchorDate"];

            Reoccurring = (Boolean)currentRow["IsReoccurring"];

            performActionDateType = (Mercury.Server.Core.Population.Enumerations.PopulationActivityPerformActionDateType)(Int32) currentRow["PerformActionDateType"];

            action = new Mercury.Server.Core.Action.Action(base.application);

            action.MapDataFields(String.Empty, currentRow);


            return;
        }
        public PopulationTriggerEvent(Application applicationReference)
        {
            ObjectConstructor(applicationReference);

            action = new Mercury.Server.Core.Action.Action(applicationReference);

            return;
        }
        protected void ObjectConstructor(Application applicationReference)
        {
            BaseConstructor(applicationReference);

            action = new Mercury.Server.Core.Action.Action(applicationReference);

            return;
        }
Exemple #8
0
        override protected void BaseConstructor(Application applicationReference)
        {
            base.BaseConstructor(applicationReference);

            action = new Action.Action(applicationReference);

            return;
        }
        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);
        }
Exemple #10
0
        protected void ObjectConstructor(Application application, Int64 forOwnerId, Enumerations.ActionThresholdType forThresholdType)
        {
            BaseConstructor(application);

            ownerObjectId = forOwnerId;

            thresholdType = forThresholdType;

            action = new Mercury.Server.Core.Action.Action(application);

            return;
        }
Exemple #11
0
        public void BaseConstructor(Application applicationReference, Mercury.Server.Application.Activity serverObject)
        {
            BaseConstructor(applicationReference, ((Server.Application.CoreObject)serverObject));


            activityType = serverObject.ActivityType;

            initialAnchorDate = serverObject.InitialAnchorDate;

            anchorDate = serverObject.AnchorDate;

            scheduleType = serverObject.ScheduleType;

            scheduleValue = serverObject.ScheduleValue;

            scheduleQualifier = serverObject.ScheduleQualifier;

            constraintValue = serverObject.ConstraintValue;

            constraintQualifier = serverObject.ConstraintQualifier;

            reoccurring = serverObject.Reoccurring;

            performActionDate = serverObject.PerformActionDate;


            action = null;

            if (serverObject.Action != null)
            {
                action = new Action.Action(applicationReference, serverObject.Action);
            }


            foreach (Server.Application.ActivityThreshold currentServerThreshold in serverObject.Thresholds)
            {
                ActivityThreshold activityThreshold = new ActivityThreshold(applicationReference, currentServerThreshold);

                thresholds.Add(activityThreshold);
            }

            return;
        }
        //public override List<Services.Responses.ConfigurationImportResponse> XmlImport (System.Xml.XmlNode objectNode) {

        //    List<Services.Responses.ConfigurationImportResponse> response = new List<Mercury.Server.Services.Responses.ConfigurationImportResponse> ();

        //    Services.Responses.ConfigurationImportResponse importResponse = new Mercury.Server.Services.Responses.ConfigurationImportResponse ();


        //    importResponse.ObjectType = objectNode.Name;

        //    importResponse.ObjectName = "TriggerEvent";

        //    importResponse.Success = true;


        //    if (importResponse.ObjectType == "TriggerEvent") {

        //        try {

        //            #region Trigger Properties

        //            foreach (System.Xml.XmlNode currentProperty in objectNode.ChildNodes[0]) {

        //                String propertyName = currentProperty.Attributes["Name"].InnerText;

        //                switch (propertyName) {

        //                    case "EventType": eventType = (Mercury.Server.Core.Population.Enumerations.TriggerEventType) Convert.ToInt32 (currentProperty.InnerText); break;

        //                    case "MetricType": metricType = (Mercury.Server.Core.Metrics.Enumerations.MetricType) Convert.ToInt32 (currentProperty.InnerText); break;

        //                    case "MetricMinimum": metricMinimum = Convert.ToDecimal (currentProperty.InnerText); break;

        //                    case "MetricMaximum": metricMaximum = Convert.ToDecimal (currentProperty.InnerText); break;

        //                    case "ProblemStatementId": problemStatementId = Convert.ToInt64 (currentProperty.InnerText); break;

        //                    case "Service":

        //                        #region Service

        //                        if (currentProperty.ChildNodes.Count > 0) {

        //                            System.Xml.XmlNode serviceNode = currentProperty.ChildNodes[0];

        //                            String serviceName = serviceNode.Attributes["Name"].InnerText;

        //                            Core.MedicalServices.Service medicalService = base.application.MedicalServiceGet (serviceName);

        //                            if (medicalService != null) {

        //                                serviceId = medicalService.ServiceId;

        //                            }

        //                            else {

        //                                Core.MedicalServices.Enumerations.MedicalServiceType serviceType = (Mercury.Server.Core.MedicalServices.Enumerations.MedicalServiceType) Convert.ToInt32 (serviceNode.Attributes["ServiceType"].InnerText);

        //                                switch (serviceType) {

        //                                    case Mercury.Server.Core.MedicalServices.Enumerations.MedicalServiceType.Singleton:

        //                                        Core.MedicalServices.ServiceSingleton singleton = new Core.MedicalServices.ServiceSingleton (base.application);

        //                                        response.AddRange (singleton.XmlImport (serviceNode));

        //                                        serviceId = singleton.ServiceId;

        //                                        break;

        //                                    case Mercury.Server.Core.MedicalServices.Enumerations.MedicalServiceType.Set:

        //                                        Core.MedicalServices.ServiceSet serviceSet = new Core.MedicalServices.ServiceSet (base.application);

        //                                        response.AddRange (serviceSet.XmlImport (serviceNode));

        //                                        serviceId = serviceSet.ServiceId;

        //                                        break;

        //                                }

        //                            }

        //                            if ((currentProperty.Attributes["Name"].InnerText == "Service") && (serviceId == 0)) { throw new ApplicationException ("Unable to load Service."); }

        //                        }

        //                        #endregion

        //                        break;

        //                    case "Metric":

        //                        #region Metric

        //                        if (currentProperty.ChildNodes.Count > 0) {

        //                            System.Xml.XmlNode metricNode = currentProperty.ChildNodes[0];

        //                            String metricName = metricNode.Attributes["Name"].InnerText;

        //                            Core.Metrics.Metric metric = base.application.MetricGet (metricName);

        //                            if (metric != null) {

        //                                metricId = metric.MetricId;

        //                            }

        //                            else {

        //                                metric = new Mercury.Server.Core.Metrics.Metric (base.application);

        //                                response.AddRange (metric.XmlImport (metricNode));

        //                                metricId = metric.MetricId;

        //                            }

        //                            if (metricId == 0) { throw new ApplicationException ("Unable to import Metric."); }

        //                        }

        //                        #endregion

        //                        break;

        //                    case "AuthorizedService":

        //                        #region AuthorizedService

        //                        if (currentProperty.ChildNodes.Count > 0) {

        //                            System.Xml.XmlNode authorizedServiceNode = currentProperty.ChildNodes[0];

        //                            String authorizedServiceName = authorizedServiceNode.Attributes["Name"].InnerText;

        //                            Core.AuthorizedServices.AuthorizedService authorizedService = base.application.AuthorizedServiceGet (authorizedServiceId);

        //                            if (authorizedService != null) {

        //                                authorizedServiceId = authorizedService.AuthorizedServiceId;

        //                            }

        //                            else {

        //                                authorizedService = new Mercury.Server.Core.AuthorizedServices.AuthorizedService (base.application);

        //                                response.AddRange (authorizedService.XmlImport (authorizedServiceNode));

        //                                authorizedServiceId = authorizedService.AuthorizedServiceId;

        //                            }

        //                            if (authorizedServiceId == 0) { throw new ApplicationException ("Unable to import Authorized Service."); }

        //                        }

        //                        #endregion

        //                        break;

        //                    case "Action":

        //                        #region Action

        //                        if (currentProperty.ChildNodes.Count > 0) {

        //                            System.Xml.XmlNode actionNode = currentProperty.ChildNodes[0];

        //                            Int32 actionId = Convert.ToInt32 (actionNode.Attributes["ActionId"].InnerText);

        //                            String actionName = actionNode.Attributes["Name"].InnerText;

        //                            if (actionId != 0) {

        //                                action = new Mercury.Server.Core.Action.Action (base.application, actionId, actionName);

        //                                response.AddRange (action.XmlImport (actionNode));

        //                            }

        //                        }

        //                        #endregion

        //                        break;

        //                }

        //            }

        //            #endregion


        //            if (!importResponse.Success) { importResponse.SetException (base.application.LastException); }

        //        }

        //        catch (Exception importException) {

        //            importResponse.SetException (importException);

        //        }


        //    }

        //    else { importResponse.SetException (new ApplicationException ("Invalid Object Type Parsed as Population.")); }


        //    response.Add (importResponse);

        //    return response;

        //}

        //#endregion


        #region Validation Functions

        public override Dictionary <String, String> Validate()
        {
            Dictionary <String, String> validationResponse = new Dictionary <String, String> ();


            if (action == null)
            {
                action = new Mercury.Server.Core.Action.Action(application);
            }

            switch (eventType)
            {
            case Mercury.Server.Core.Population.Enumerations.PopulationTriggerEventType.Metric:

                if (metricMinimum > metricMaximum)
                {
                    validationResponse.Add("Metric Value Range", "Minimum (Floor) is greater than Maximum (Ceiling).");
                }

                break;
            }

            if ((problemStatementId == 0) && (action.Id == 0))
            {
                validationResponse.Add("Problem Statement or Action", "Triggers Requires a Problem Statement or Action.");
            }

            else if (action.Id != 0)
            {
                Dictionary <String, String> actionValidation = action.Validate();

                foreach (String currentKey in actionValidation.Keys)
                {
                    if (!validationResponse.ContainsKey(currentKey))
                    {
                        validationResponse.Add(currentKey, actionValidation[currentKey]);
                    }
                }
            }

            return(validationResponse);
        }
Exemple #13
0
        public ActivityThreshold(Application applicationReference, Mercury.Server.Application.ActivityThreshold serverObject)
        {
            BaseConstructor(applicationReference, serverObject);


            relativeDateValue = serverObject.RelativeDateValue;

            relativeDateQualifier = serverObject.RelativeDateQualifier;

            status = serverObject.Status;


            if (serverObject.Action != null)
            {
                action = new Action.Action(applicationReference, serverObject.Action);
            }


            return;
        }
Exemple #14
0
        override public void MapDataFields(System.Data.DataRow currentRow)
        {
            base.MapDataFields(currentRow);

            populationServiceEventId = (Int64)currentRow["PopulationServiceEventId"];

            populationId = (Int64)currentRow["PopulationId"];

            relativeDateValue = (Int32)currentRow["RelativeDateValue"];

            relativeDateQualifier = (Mercury.Server.Core.Enumerations.DateQualifier)(Int32) currentRow["RelativeDateQualifier"];

            status = (Mercury.Server.Core.Population.Enumerations.PopulationServiceEventStatus)(Int32) currentRow["Status"];

            action = new Mercury.Server.Core.Action.Action(base.application);

            action.MapDataFields(String.Empty, currentRow);

            return;
        }
Exemple #15
0
        override public void MapDataFields(System.Data.DataRow currentRow)
        {
            base.MapDataFields(currentRow);


            relativeDateValue = (Int32)currentRow["RelativeDateValue"];

            relativeDateQualifier = (Mercury.Server.Core.Enumerations.DateQualifier)(Int32) currentRow["RelativeDateQualifier"];

            status = (Enumerations.ActivityStatus)(Int32) currentRow["Status"];


            if (!(currentRow["ActionId"] is DBNull))
            {
                action = new Mercury.Server.Core.Action.Action(base.application);

                action.MapDataFields(String.Empty, currentRow);
            }

            return;
        }
Exemple #16
0
        override public void MapDataFields(System.Data.DataRow currentRow)
        {
            if (thresholdType == Mercury.Server.Core.Action.Enumerations.ActionThresholdType.NotSpecified)
            {
                throw new ApplicationException("Invalid Threshold Type Specified.");
            }

            base.MapDataFields(currentRow);


            id = (Int64)currentRow[thresholdType.ToString() + "ThresholdId"];

            relativeDateValue = (Int32)currentRow["RelativeDateValue"];

            relativeDateQualifier = (Mercury.Server.Core.Enumerations.DateQualifier)(Int32) currentRow["RelativeDateQualifier"];

            status = (Enumerations.ActionThresholdStatus)(Int32) currentRow["Status"];

            action = new Mercury.Server.Core.Action.Action(base.application);

            action.MapDataFields(String.Empty, currentRow);

            return;
        }
        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);
        }