/*====================================================*/ protected static XmlNode Get_EventClassNode(cEventData aEventData) { cXMLDoc aClassNodeDoc; aClassNodeDoc = new cXMLDoc(); //check for ClassNodeXml null, and if it is, return a class node for the cEmailEvent if (aEventData.GetPropertyString("ClassNodeXml", "") == "") { aClassNodeDoc.LoadFromXML("<EventElement><Class Name='cEmailEvent' Assembly='EasyGrants' FullName='EasyGrants.Event.cEmailEvent'/></EventElement>"); return aClassNodeDoc.DocElement.SelectSingleNode("Class"); } if (!aClassNodeDoc.LoadFromXML(aEventData.GetPropertyString("ClassNodeXml"))) return null; return aClassNodeDoc.DocElement.SelectSingleNode("Class"); }
/*-----------------------------------------------------*/ public void HideInactiveLookupValues(XmlNode aControlNode, XmlNode aFilterNode, string aDefinitionKey, bool aHideInactiveItems) { XmlNode aOldFilters = null; XmlNode aNewFilters = null; String aBaseDataType = cXMLDoc.AttributeToString(aControlNode, "DataObjectDefinitionKey", aDefinitionKey); if (aHideInactiveItems && aBaseDataType != "") { XmlNode aBaseObjDefNode = WebSession.DataObjectFactory.DataDefinitionDoc.DocElement.SelectSingleNode("DataObjectDefinitions/Definition[@Key='" + aBaseDataType + "']"); XmlNode aPropKeyNode = cXMLDoc.FindNode(aBaseObjDefNode, "Properties/Property", "Key", "EndDate"); cDataObject aCodeTableDO = WebSession.DataObjectFactory.GetDataObjectListWithFilter("IDGen", "TableName", cXMLDoc.AttributeToString(aBaseObjDefNode, "RowSource", "IDGen"))[0]; bool aCodeTable = false; if (aCodeTableDO != null) { if (aCodeTableDO.GetPropertyValue("IsCodeTable") != System.DBNull.Value) { aCodeTable = aCodeTableDO.GetPropertyBool("IsCodeTable"); } } if (aPropKeyNode != null && aCodeTable) { cXMLDoc aXmlDoc = new cXMLDoc(); aXmlDoc.LoadFromXML(aControlNode.OuterXml); if (aFilterNode == null) { aFilterNode = aXmlDoc.XMLDocument.CreateNode(XmlNodeType.Element, "Filters", ""); aXmlDoc.DocElement.AppendChild(aFilterNode); aFilterNode.AppendChild(WebSession.DataObjectFactory.CreateGroupArgumentNode(aXmlDoc, "(", "")); } else { aOldFilters = aControlNode.SelectSingleNode("Filters"); aFilterNode = aXmlDoc.DocElement.SelectSingleNode("Filters"); aFilterNode.AppendChild(WebSession.DataObjectFactory.CreateGroupArgumentNode(aXmlDoc, "(")); } aFilterNode.AppendChild(WebSession.DataObjectFactory.CreateArgumentNode(aXmlDoc, "CurrentDateTime", "EndDate", "", "", "GreaterThan")); aFilterNode.AppendChild(WebSession.DataObjectFactory.CreateArgumentNode(aXmlDoc, "", "EndDate", "", "Or")); aFilterNode.AppendChild(WebSession.DataObjectFactory.CreateGroupArgumentNode(aXmlDoc, ")", "")); if (aOldFilters != null) { aControlNode.RemoveChild(aOldFilters); } aNewFilters = aControlNode.OwnerDocument.CreateNode(XmlNodeType.Element, "Filters", ""); aNewFilters.InnerXml = aFilterNode.InnerXml; aControlNode.AppendChild(aNewFilters); } } }
/*-----------------------------------------------------*/ public cXMLDoc CreateDataObjectNode(String aDefinitionKey, out XmlNode aDataObjectNode) { cXMLDoc aXmlDoc = new cXMLDoc(); aXmlDoc.LoadFromXML("<DataObject Key='Base' Updatable='True'></DataObject>"); //assign value to the output parameter aDataObjectNode = aXmlDoc.XMLDocument.FirstChild; //add DataObjectDefinitionKey to the node //obtain DataObjectDefinitionKey from a Relationship node in DataDefinition.xml aXmlDoc.AddAttribute(aDataObjectNode, "DataObjectDefinitionKey", aDefinitionKey); return(aXmlDoc); }
/*-----------------------------------------------------*/ public XmlNode BuildDataDefinitionNode_From_DataObjectNode(XmlNode aDataObjectNode) { cXMLDoc aXMLDoc; XmlElement aDataObjDefEl; XmlElement aClassEl; XmlElement aPropertiesEl; XmlNodeList aDisplayPropertiesList; XmlElement aPropertyEl; String aPropertyKey; String[] aKeys; String aChildDODKey; XmlNode aBaseDODNode; XmlNode aDODNode; XmlNode aRelationshipNode; XmlNode aDODPropertyNode; String aDataType; String aBaseDODKey; XmlNode aBasePrimaryKeyNode; String aBasePrimaryKey; int i; aXMLDoc = new cXMLDoc(); aXMLDoc.LoadFromXML("<DataObjectDefinitions></DataObjectDefinitions>"); //<DataObject Key='Base' Updatable='True'></DataObject> aDataObjDefEl = aXMLDoc.XMLDocument.CreateElement("Definition"); aDataObjDefEl.SetAttribute("Key", "QueryTool"); aDataObjDefEl.SetAttribute("DataSourceKey", "EGDatabase"); aDataObjDefEl.SetAttribute("RowSourceType", "sql"); //Get row source from data definition document aBaseDODKey = cXMLDoc.AttributeToString(aDataObjectNode, "BaseDODKey"); aBaseDODNode = DataDefinitionDoc.DocElement.SelectSingleNode("DataObjectDefinitions/Definition[@Key='" + aBaseDODKey + "']"); aDataObjDefEl.SetAttribute("RowSource", cXMLDoc.AttributeToString(aBaseDODNode, "RowSource")); aBasePrimaryKeyNode = aBaseDODNode.SelectSingleNode("Properties/Property[@IsPrimaryKey = 'True']"); aBasePrimaryKey = cXMLDoc.AttributeToString(aBasePrimaryKeyNode, "Key"); aClassEl = aXMLDoc.XMLDocument.CreateElement("Class"); aClassEl.SetAttribute("Name", "cDataObject"); aClassEl.SetAttribute("Assembly", "Core"); aClassEl.SetAttribute("FullName", "Core.DataAccess.cDataObject"); aDataObjDefEl.AppendChild(aClassEl); aPropertiesEl = aXMLDoc.XMLDocument.CreateElement("Properties"); aDataObjDefEl.AppendChild(aPropertiesEl); aDisplayPropertiesList = aDataObjectNode.SelectNodes("DisplayProperties/DisplayProperty"); foreach (XmlNode aDisplayPropertyNode in aDisplayPropertiesList) { aPropertyEl = aXMLDoc.XMLDocument.CreateElement("Property"); aPropertyKey = cXMLDoc.AttributeToString(aDisplayPropertyNode, "PropertyKey"); aKeys = aPropertyKey.Split(new Char[] { '.' }); //aPropertyKey = cDataProvider.FlatDataObjectPropertyKey(aPropertyKey); aPropertyKey = cDataObjectFactory.Alias_DisplayPropertyKey(aDataObjectNode, aPropertyKey); aDODNode = aBaseDODNode; for (i = 0; i < aKeys.Length - 1; i++) { aRelationshipNode = aDODNode.SelectSingleNode("Properties/Property[@Key='" + aKeys[i] + "']/Relationship"); aChildDODKey = cXMLDoc.AttributeToString(aRelationshipNode, "ChildDefinitionKey"); aDODNode = DataDefinitionDoc.DocElement.SelectSingleNode("DataObjectDefinitions/Definition[@Key='" + aChildDODKey + "']"); } aDODPropertyNode = aDODNode.SelectSingleNode("Properties/Property[@Key='" + aKeys[aKeys.Length - 1] + "']"); aDataType = cXMLDoc.AttributeToString(aDODPropertyNode, "DataType"); aPropertyEl.SetAttribute("Key", aPropertyKey); aPropertyEl.SetAttribute("DataType", aDataType); aPropertyEl.SetAttribute("ColumnSource", aPropertyKey); aPropertiesEl.AppendChild(aPropertyEl); } return((XmlNode)aDataObjDefEl); }
private cXMLDoc BuildOutcomeConfigFromDB(String aName) { cDataObjectList aOutcomeList, aList; String aRelatedProperty; StringBuilder aXML = new StringBuilder(); cXMLDoc aDoc = new cXMLDoc(); aXML.Append("<?xml version='1.0' encoding='utf-8' ?>"); aOutcomeList = this.WebSession.DataObjectFactory.GetDataObjectListWithFilter("ConfigureModuleOutcome", "Name", aName); if (aOutcomeList.Count > 0) { aXML.Append("<EasyGrants><Outcomes ProgramKey='"); aXML.Append(aOutcomeList[0].GetPropertyString("ProgramKey")); aXML.Append("' DefaultOutcomeKey='"); aXML.Append(aOutcomeList[0].GetPropertyString("DefaultOutcomeKey")); aXML.Append("' DefaultOutcomeDescription='"); aXML.Append(aOutcomeList[0].GetPropertyString("DefaultOutcomeDescription")); aXML.Append("'>"); aOutcomeList = this.WebSession.DataObjectFactory.GetDataObjectListWithFilter("ConfigureOutcome", "ConfigureModuleOutcomeID", aOutcomeList[0].GetPropertyString("ConfigureModuleOutcomeID")); foreach (cDataObject aOutcome in aOutcomeList) { aXML.Append("<Outcome OutcomeKey='"); aXML.Append(aOutcome.GetPropertyString("OutcomeKey")); aXML.Append("' OutcomeDescription='"); aXML.Append(aOutcome.GetPropertyString("OutcomeDescription")); aXML.Append("' DataObjectKey='"); aXML.Append(aOutcome.GetPropertyString("DataObjectKey")); aXML.Append("' WfTaskAssignmentFilterKey='"); aXML.Append(aOutcome.GetPropertyString("TaskAssignmentFilterKey")); aXML.Append("'><Filters>"); aList = this.WebSession.DataObjectFactory.GetDataObjectListWithFilter("ConfigureOutcomeFilter", "ConfigureOutcomeID", aOutcome.GetPropertyString("ConfigureOutcomeID")); foreach (cDataObject aFilter in aList) { aXML.Append("<Argument Type='"); aXML.Append(aFilter.GetPropertyString("Type")); aXML.Append("' TypeKey='"); aXML.Append(aFilter.GetPropertyString("TypeKey")); aXML.Append("' PropertyKey='"); aXML.Append(aFilter.GetPropertyString("PropertyKey")); aXML.Append("' Value='"); aXML.Append(aFilter.GetPropertyString("PropertyValue")); aXML.Append("' Bool='"); aXML.Append(aFilter.GetPropertyString("Bool")); aXML.Append("'>"); aRelatedProperty = aFilter.GetPropertyString("RelatedPropertyKey"); if (aRelatedProperty != "") { aXML.Append("<RelatedProperty PropertyKey='"); aXML.Append(aRelatedProperty); aXML.Append("'/>"); } aXML.Append("</Argument>"); } aXML.Append("</Filters><Tasks>"); aList = this.WebSession.DataObjectFactory.GetDataObjectListWithFilter("ConfigureOutcomeTask", "ConfigureOutcomeID", aOutcome.GetPropertyString("ConfigureOutcomeID")); foreach (cDataObject aTask in aList) { aXML.Append("<Task TaskKey='"); aXML.Append(aTask.GetPropertyString("TaskKey")); aXML.Append("' Description='"); aXML.Append(aTask.GetPropertyString("Description")); aXML.Append("' Status='"); aXML.Append(aTask.GetPropertyString("Status")); aXML.Append("' Outcome='"); aXML.Append(aTask.GetPropertyString("Outcome")); aXML.Append("' RoleID='"); aXML.Append(aTask.GetPropertyString("RoleID")); aXML.Append("' NoPersonID='"); aXML.Append(aTask.GetPropertyString("NoPersonID")); aXML.Append("'/>"); } aXML.Append("</Tasks><Events>"); aList = this.WebSession.DataObjectFactory.GetDataObjectListWithFilter("ConfigureOutcomeEvent", "ConfigureOutcomeID", aOutcome.GetPropertyString("ConfigureOutcomeID")); foreach (cDataObject aEvent in aList) { aXML.Append("<Event EventKey='"); aXML.Append(aEvent.GetPropertyString("EventKey")); aXML.Append("' Description='"); aXML.Append(aEvent.GetPropertyString("Description")); aXML.Append("'/>"); } aXML.Append("</Events></Outcome>"); } aXML.Append("</Outcomes></EasyGrants>"); aDoc.LoadFromXML(aXML.ToString()); } return(aDoc); }