//Edit Group
        public void Edit(ClientDefinedRuleGroupVM clientDefinedRuleGroupVM)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            //ClientDefinedRuleLogicItems to XML
            XmlDocument clientDefinedRuleLogicItemDoc = LoadClientDefinedRuleLogicItems(clientDefinedRuleGroupVM);

            //ClientDefinedRuleResultItem to XML
            XmlDocument clientDefinedRuleResultItemDoc = LoadClientDefinedRuleResultItems(clientDefinedRuleGroupVM);

            //ClientDefinedRuleWorkflowTriggers to XML
            XmlDocument clientDefinedRuleWorkflowTriggerDoc = LoadClientDefinedRuleWorkflowTriggers(clientDefinedRuleGroupVM);

            db.spDesktopDataAdmin_UpdateClientDefinedBusinessRuleGroup_v1(
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.ClientDefinedRuleGroupId,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.ClientDefinedRuleGroupName,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.Category,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.EnabledFlag,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.EnabledDate,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.ExpiryDate,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.TripTypeId,
                System.Xml.Linq.XElement.Parse(clientDefinedRuleLogicItemDoc.OuterXml),
                System.Xml.Linq.XElement.Parse(clientDefinedRuleResultItemDoc.OuterXml),
                System.Xml.Linq.XElement.Parse(clientDefinedRuleWorkflowTriggerDoc.OuterXml),
                adminUserGuid
                );
        }
        //Load ClientDefinedRuleResultItems
        public XmlDocument LoadClientDefinedRuleResultItems(ClientDefinedRuleGroupVM clientDefinedRuleGroupVM)
        {
            XmlDocument    clientDefinedRuleResultItemDoc = new XmlDocument();
            XmlDeclaration clientDefinedRuleResultItemDec = clientDefinedRuleResultItemDoc.CreateXmlDeclaration("1.0", null, null);

            clientDefinedRuleResultItemDoc.AppendChild(clientDefinedRuleResultItemDec);
            XmlElement clientDefinedRuleResultItemRoot = clientDefinedRuleResultItemDoc.CreateElement("ClientDefinedRuleResultItems");

            clientDefinedRuleResultItemDoc.AppendChild(clientDefinedRuleResultItemRoot);

            if (clientDefinedRuleGroupVM.ClientDefinedRuleGroupResults != null)
            {
                foreach (ClientDefinedRuleGroupResult clientDefinedRuleGroupResult in clientDefinedRuleGroupVM.ClientDefinedRuleGroupResults)
                {
                    if (clientDefinedRuleGroupResult != null)
                    {
                        XmlElement xmlClientDefinedRuleResultItem = clientDefinedRuleResultItemDoc.CreateElement("ClientDefinedRuleResultItem");

                        XmlElement xmlClientDefinedRuleBusinessEntityId = clientDefinedRuleResultItemDoc.CreateElement("ClientDefinedRuleBusinessEntityId");
                        xmlClientDefinedRuleBusinessEntityId.InnerText = clientDefinedRuleGroupResult.ClientDefinedRuleResultItem.ClientDefinedRuleBusinessEntityId.ToString();
                        xmlClientDefinedRuleResultItem.AppendChild(xmlClientDefinedRuleBusinessEntityId);

                        XmlElement xmlClientDefinedRuleResultItemValue = clientDefinedRuleResultItemDoc.CreateElement("ClientDefinedRuleResultItemValue");
                        xmlClientDefinedRuleResultItemValue.InnerText = clientDefinedRuleGroupResult.ClientDefinedRuleResultItem.ClientDefinedRuleResultItemValue.ToString();
                        xmlClientDefinedRuleResultItem.AppendChild(xmlClientDefinedRuleResultItemValue);

                        clientDefinedRuleResultItemRoot.AppendChild(xmlClientDefinedRuleResultItem);
                    }
                }
            }

            return(clientDefinedRuleResultItemDoc);
        }
        //Load ClientDefinedRuleWorkflowTriggers
        public XmlDocument LoadClientDefinedRuleWorkflowTriggers(ClientDefinedRuleGroupVM clientDefinedRuleGroupVM)
        {
            XmlDocument    clientDefinedRuleWorkflowTriggerDoc = new XmlDocument();
            XmlDeclaration clientDefinedRuleWorkflowTriggerDec = clientDefinedRuleWorkflowTriggerDoc.CreateXmlDeclaration("1.0", null, null);

            clientDefinedRuleWorkflowTriggerDoc.AppendChild(clientDefinedRuleWorkflowTriggerDec);
            XmlElement clientDefinedRuleWorkflowTriggerRoot = clientDefinedRuleWorkflowTriggerDoc.CreateElement("ClientDefinedRuleWorkflowTriggers");

            clientDefinedRuleWorkflowTriggerDoc.AppendChild(clientDefinedRuleWorkflowTriggerRoot);

            if (clientDefinedRuleGroupVM.ClientDefinedRuleGroupTriggers != null)
            {
                foreach (ClientDefinedRuleGroupTrigger clientDefinedRuleGroupTrigger in clientDefinedRuleGroupVM.ClientDefinedRuleGroupTriggers)
                {
                    if (clientDefinedRuleGroupTrigger != null)
                    {
                        XmlElement xmlClientDefinedRuleWorkflowTrigger = clientDefinedRuleWorkflowTriggerDoc.CreateElement("ClientDefinedRuleWorkflowTrigger");

                        XmlElement xmlClientDefinedRuleWorkflowTriggerStateId = clientDefinedRuleWorkflowTriggerDoc.CreateElement("ClientDefinedRuleWorkflowTriggerStateId");
                        xmlClientDefinedRuleWorkflowTriggerStateId.InnerText = clientDefinedRuleGroupTrigger.ClientDefinedRuleWorkflowTrigger.ClientDefinedRuleWorkflowTriggerStateId.ToString();
                        xmlClientDefinedRuleWorkflowTrigger.AppendChild(xmlClientDefinedRuleWorkflowTriggerStateId);

                        XmlElement xmlClientDefinedRuleWorkflowTriggerApplicationModeId = clientDefinedRuleWorkflowTriggerDoc.CreateElement("ClientDefinedRuleWorkflowTriggerApplicationModeId");
                        xmlClientDefinedRuleWorkflowTriggerApplicationModeId.InnerText = clientDefinedRuleGroupTrigger.ClientDefinedRuleWorkflowTrigger.ClientDefinedRuleWorkflowTriggerApplicationModeId.ToString();
                        xmlClientDefinedRuleWorkflowTrigger.AppendChild(xmlClientDefinedRuleWorkflowTriggerApplicationModeId);

                        clientDefinedRuleWorkflowTriggerRoot.AppendChild(xmlClientDefinedRuleWorkflowTrigger);
                    }
                }
            }

            return(clientDefinedRuleWorkflowTriggerDoc);
        }
Ejemplo n.º 4
0
        //Add Group
        public void Add(ClientDefinedRuleGroupVM clientDefinedRuleGroupVM)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            //ClientDefinedRuleLogicItems to XML
            XmlDocument clientDefinedRuleLogicItemDoc = LoadClientDefinedRuleLogicItems(clientDefinedRuleGroupVM);

            //ClientDefinedRuleResultItem to XML
            XmlDocument clientDefinedRuleResultItemDoc = LoadClientDefinedRuleResultItems(clientDefinedRuleGroupVM);

            //ClientDefinedRuleWorkflowTriggers to XML
            XmlDocument clientDefinedRuleWorkflowTriggerDoc = LoadClientDefinedRuleWorkflowTriggers(clientDefinedRuleGroupVM);

            db.spDesktopDataAdmin_InsertClientDefinedRuleGroup_v1(
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.ClientDefinedRuleGroupName,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.Category,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.EnabledFlag,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.EnabledDate,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.ExpiryDate,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.HierarchyType,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.HierarchyCode,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.TravelerTypeGuid,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.ClientSubUnitGuid,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.SourceSystemCode,
                clientDefinedRuleGroupVM.ClientDefinedRuleGroup.TripTypeId,
                System.Xml.Linq.XElement.Parse(clientDefinedRuleLogicItemDoc.OuterXml),
                System.Xml.Linq.XElement.Parse(clientDefinedRuleResultItemDoc.OuterXml),
                System.Xml.Linq.XElement.Parse(clientDefinedRuleWorkflowTriggerDoc.OuterXml),
                adminUserGuid
                );
        }