/*-----------------------------------------------------*/ public cDataObjectList Person_Updated_WorkgroupTaskList(XmlElement aDataObjectElement) { cXMLDoc aXmlDoc; XmlNode aDataObjectNode, aFiltersNode, aArgNode; cDataObjectList aWorkGroupList, aWorkGroupTaskListL; cDataObjectList aWFTAList = DataObjectFactory.CreateDataObjectList(aDataObjectElement); //This is the object that will be returned. aXmlDoc = DataObjectFactory.CreateDataObjectNode("WorkGroup", out aDataObjectNode, out aFiltersNode); aArgNode = aFiltersNode.AppendChild(DataObjectFactory.CreateArgumentNode(aXmlDoc, "Data", "PersonID", this.GetPropertyString("PersonID"))); aArgNode = aArgNode.AppendChild(DataObjectFactory.CreateArgumentRelatedPropertyNode(aXmlDoc, "WorkGroupMembers")); aWorkGroupList = DataObjectFactory.GetDataObjectList(aDataObjectNode); ArrayList wgArrayL = new ArrayList(); int wfALIdx = 0; foreach (cDataObject aWorkGroup in aWorkGroupList) { aWorkGroupTaskListL = DataObjectFactory.GetDataObjectListWithFilter("WorkGroupTaskList", "WorkGroupID", aWorkGroup.GetPropertyString("WorkGroupID")); if (aWorkGroupTaskListL.Count == 0) continue; foreach (cDataObject aWorkGroupTaskLst in aWorkGroupTaskListL) { cDataObjectList aCurWFTAList; aCurWFTAList = aWorkGroupTaskLst.GetRelatedPropertyDataObjectList("WfTaskAssignments"); if (aCurWFTAList.Count == 0) continue; foreach (cDataObject aCurWFTA in aCurWFTAList) { wfALIdx = wgArrayL.BinarySearch(aCurWFTA.GetPropertyInt("WfTaskAssignmentID")); if (wfALIdx >= 0) break; if (aCurWFTA.GetPropertyInt("WfTaskStatusID") == 1 && aCurWFTA.GetPropertyString("PersonID") == "") { aWFTAList.Add(aCurWFTA); wgArrayL.Insert(~wfALIdx, aCurWFTA.GetPropertyInt("WfTaskAssignmentID")); aCurWFTA.DataObjectList = aWFTAList; } } } } XmlElement aSortEl = (XmlElement)aDataObjectElement.SelectSingleNode("Sort"); if(aSortEl != null) { aWFTAList.SortEl = aSortEl; aWFTAList.Sort(); } return aWFTAList; }
/*====================================================*/ public cEmailArgsDataObjectBase(cDataObject aDataObject){ mBaseDataObjList = new cDataObjectList(aDataObject.DataObjectFactory); mBaseDataObjList.Add(aDataObject); ProcessEmailParamNode(mBaseDataObjList); }
/*====================================================*/ private void RenderOutputByGroupField(HtmlTextWriter aTxtWr) { XmlNode aSavedQueryDataObjectNode, aDataProviderInfoNode; XmlNodeList aDisplayPropertyNodeList; string aColHeader, aMsg, aGroupByField; cDataObjectList aDataObjectList, aGrpDOL, aNullGrpDOL; StringBuilder aTable = new StringBuilder(); Hashtable aGrpByHash = new Hashtable(); int aRowCount; aNullGrpDOL = null; aSavedQueryDataObjectNode = AdHocQueryDefXMLDoc.DocElement; aGroupByField = cXMLDoc.AttributeToString(aSavedQueryDataObjectNode, "GroupBy"); //Write column headers aDisplayPropertyNodeList = aSavedQueryDataObjectNode.SelectNodes("DisplayProperties/DisplayProperty"); aTable.Append("<table border='0' cellspacing='0' cellpadding='0'> " + "<tr bgColor='" + HeadBgColor + "' class='" + HeadClass + "'>"); foreach (XmlNode aDisplayPropertyNode in aDisplayPropertyNodeList) { aColHeader = cXMLDoc.AttributeToString(aDisplayPropertyNode, "ColumnHeader"); if (aColHeader == "") { aColHeader = cXMLDoc.AttributeToString(aDisplayPropertyNode, "PropertyKey"); } aTable.Append("<td>" + aColHeader + "</td>"); aTable.Append("<td width='10'> </td>"); } aTable.Append("</tr>"); //Get data from data object node try { aDataObjectList = CorePage.WebSession.DataObjectFactory.GetDataObjectList(aSavedQueryDataObjectNode); } catch (Exception aExc) { aMsg = "<br><b>ERROR</b><br><br>" + aExc.Message + "<br><br>"; aTxtWr.Write(aMsg); return; } aRowCount = aDataObjectList.Count; int i; //Write out data to table //foreach (cDataObject aDataObject in aDataObjectList) { for (i = 0; i < aDataObjectList.Count; i++) { cDataObject aDataObject = aDataObjectList[i]; foreach (XmlNode aDisplayPropertyNode in aDisplayPropertyNodeList) { String aPropertyKey; //aPropertyKey = cXMLDoc.AttributeToString(aDisplayPropertyNode, "PropertyKey").Replace(".", "_"); //PL 12/17/03 aPropertyKey = cXMLDoc.AttributeToString(aDisplayPropertyNode, "PropertyKey"); String aPropKeyVal = aDataObject.GetAliased_RelatedPropertyDefaultFormattedString(aPropertyKey); if (aGroupByField.Equals(aPropertyKey)) { if (aPropKeyVal == "") { if (aNullGrpDOL == null) { aNullGrpDOL = new cDataObjectList(aDataObject.DataObjectFactory); } aNullGrpDOL.Add(aDataObject); } else { if (aGrpByHash.Contains(aPropKeyVal)) { aGrpDOL = (cDataObjectList)aGrpByHash[aPropKeyVal]; aGrpDOL.Add(aDataObject); } else { aGrpDOL = new cDataObjectList(aDataObject.DataObjectFactory); aGrpDOL.Add(aDataObject); aGrpByHash.Add(aPropKeyVal, aGrpDOL); } } } } } //when the group by field is not in the selected field list if (aDataObjectList.Count > 0 && aGrpByHash.Count < 1 && aNullGrpDOL == null) { RenderOutput(aTxtWr); return; } foreach (DictionaryEntry aEntry in aGrpByHash) { //Printing the Group By Field aTable.Append("<tr bgColor='" + HeadBgColor + "' class='" + RowClass + "'>"); aTable.Append("<td colspan='" + (aDisplayPropertyNodeList.Count * 2) + "'> </td>"); aTable.Append("</tr>"); aTable.Append("<tr bgColor='" + HeadBgColor + "' class='" + RowClass + "'>"); aTable.Append("<td colspan='" + (aDisplayPropertyNodeList.Count * 2) + "'><B>" + aEntry.Key + "</B></td>"); //PL 12/17/03 aTable.Append("</tr>"); aDataObjectList = (cDataObjectList)aEntry.Value; WriteDataObjectList(aTable, aDataObjectList); } //Write out the rows that have no values for the Group By field if (aNullGrpDOL != null) { aTable.Append("<tr bgColor='" + HeadBgColor + "' class='" + RowClass + "'>"); aTable.Append("<td colspan='" + (aDisplayPropertyNodeList.Count * 2) + "'> </td>"); aTable.Append("</tr>"); WriteDataObjectList(aTable, aNullGrpDOL); aTable.Append("</table>"); } aTable.Append("<table border='0' cellspacing='0' cellpadding='0'> "); //Write out record count aMsg = "<br><br>Row Count: " + aRowCount; aTable.Append("<tr><td>" + aMsg + "</td></tr>"); //Write out SQL aDataProviderInfoNode = aSavedQueryDataObjectNode.SelectSingleNode("DataProviderInfo"); aMsg = "<br><br>SQL: " + aDataProviderInfoNode.InnerText; aTable.Append("<tr><td>" + aMsg + "</td></tr>"); aTable.Append("</table>"); aTxtWr.Write(aTable.ToString()); }