/*====================================================*/ protected int SaveHistory(cDataObject aGranteeProject, int aUserID) { /*Note: The GranteeProject data object passed into this method is not "this". It * is a data object containing the data currently saved in the database. This data * will be written to the history table before the updates in the current GranteeProject * object are saved to the database*/ cDataObject aGPHistory; aGPHistory = this.DataObjectFactory.CreateNewDataObjectFromKey("GranteeProjectHistory"); aGPHistory["GranteeProjectID"] = aGranteeProject["GranteeProjectID"]; aGPHistory["WfProjectID"] = aGranteeProject["WfProjectID"]; aGPHistory["WfProjectOutcomeID"] = aGranteeProject["WfProjectOutcomeID"]; aGPHistory["PrimaryPersonID"] = aGranteeProject["PrimaryPersonID"]; aGPHistory["PrimaryOrganizationID"] = aGranteeProject["PrimaryOrganizationID"]; aGPHistory["OtherOrganization"] = aGranteeProject["OtherOrganization"]; aGPHistory["PrimaryAddressID"] = aGranteeProject["PrimaryAddressID"]; aGPHistory["GranteeID"] = aGranteeProject["GranteeID"]; aGPHistory["GrantTitle"] = aGranteeProject["GrantTitle"]; aGPHistory["ShortTitle"] = aGranteeProject["ShortTitle"]; aGPHistory["CreateDate"] = System.DateTime.Now; aGPHistory["EntityTypeID"] = aGranteeProject.GetRelatedPropertyDataObjectList("Grantee")[0]["EntityTypeID"]; if (aUserID != -1) //A value of -1 indicates that the User ID is unknown. { aGPHistory["CreateUser"] = aUserID; } aGPHistory.SaveData(); return(aGPHistory.GetPropertyInt("GranteeProjectHistoryID")); }
public void Notify_DataModified_HHMI(cDataObjectFactory aDataObjectFactory) { cWfTaskAssignment aApplWfTA = this; //find the applicant WfTaskAssignment int aRoleID = this.GetPropertyInt("WfTaskRoleID", 0); if (aRoleID != 1) { cDataObject aGP = this.GetRelatedPropertyDataObject("GranteeProject"); cDataObjectList aDOL; aDOL = aGP.GetRelatedPropertyDataObjectList("ApplWfTaskAssignments"); foreach (cDataObject aDO in aDOL) { if (aDO.GetRelatedPropertyInt("WfTask.WfTaskTypeID", 0) == 1) { aApplWfTA = (cWfTaskAssignment) aDO; break; } } } cDataObjectList aWfProjectPDFList = aApplWfTA.GetRelatedPropertyDataObjectList("GranteeProject.WfProjectPDF"); foreach (cDataObject aWfProjectPDF in aWfProjectPDFList) { if (aWfProjectPDF.GetPropertyInt("PDFGenerationID", 0) == 1) { string aReportOutputDefinitionID = aWfProjectPDF.GetRelatedPropertyString("FinalPDFReportKeyLink.ReportOutputDefinitionID"); cDataObject aReportOutputDO = aDataObjectFactory.GetDataObjectListWithFilter("ReportOutput", "DefinitionID", aReportOutputDefinitionID, "EntityID", aApplWfTA.GetPropertyString("WfTaskAssignmentID"))[0]; if (aReportOutputDO != null) { if (aRoleID != 1 && aWfProjectPDF.GetPropertyInt("ReportOutputDefinitionTypeID", 1) == 1) continue; //skip applicant pdf when make changes to third party data //delete existing pdf aDataObjectFactory.DeleteData(aReportOutputDO); } } } }
/*====================================================*/ public void ValidateNavigationForReopened() { cDataObject aWfTaskAssignment = WebSession.DataObjectFactory.GetDataObjectFromPrimaryKey("WfTaskAssignment", WfTaskAssignmentID); if (aWfTaskAssignment.GetPropertyInt("WfTaskStatusID") == 4) { //Check to see if there is an active reopen request. If so, cDataObject aReopenRequest = aWfTaskAssignment.GetRelatedPropertyDataObject("ActiveRequestToReopenThis"); if (aReopenRequest != null) { //Check to see if there are reopen sections. If so, cDataObjectList aReopenSectionList = aReopenRequest.GetRelatedPropertyDataObjectList("WftaReopenSections"); if (aReopenSectionList.Count > 0) { ModuleUser.MasterNavElement.NavElement_FirstLevel_ValidateForReopened(aReopenSectionList); } } } }
/*----------------------------------------------------*/ public void GenerateAutomaticRequestsConflicts(XmlNodeList aRCTypeNodeList) { //In this method, the string "RC" within a variable name refers to "Request/Conflict" (e.g., aRCTypeNodeList) int aWfTaskID = GetRelatedPropertyDataObject("WfProjectTask").GetPropertyInt("WfTaskID"); //Delete all existing requests and/or conflicts for this stage XmlNode aRCDONode; XmlNode aFiltersNode; XmlNode aArgumentNode; XmlNode aRelatedPropertyNode; cXMLDoc aXMLDoc = DataObjectFactory.CreateDataObjectNode("WfTaskAssignmentRequestConflict", out aRCDONode, out aFiltersNode); aArgumentNode = DataObjectFactory.CreateArgumentNode(aXMLDoc, "Data", "WfTaskID", aWfTaskID.ToString()); aRelatedPropertyNode = DataObjectFactory.CreateArgumentRelatedPropertyNode(aXMLDoc, "WfTaskAssignment", aArgumentNode); aFiltersNode.AppendChild(aArgumentNode); aArgumentNode = DataObjectFactory.CreateArgumentNode(aXMLDoc, "Data", "Automatic", "True"); aFiltersNode.AppendChild(aArgumentNode); cDataObjectList aRCDOList = DataObjectFactory.GetDataObjectList(aRCDONode); DataObjectFactory.DeleteData(aRCDOList); //Get DOList of all review assignment WFTAs for request/conflict stage XmlNode aWFTADONode; aXMLDoc = DataObjectFactory.CreateDataObjectNode("WfTaskAssignment", out aWFTADONode, out aFiltersNode); aArgumentNode = DataObjectFactory.CreateArgumentNode(aXMLDoc, "Data", "WfTaskID", aWfTaskID.ToString()); aFiltersNode.AppendChild(aArgumentNode); cDataObjectList aWFTADOList = DataObjectFactory.GetDataObjectList(aWFTADONode); int aIndex; String aRevFullKey; String aRevRelatedKey; String aRevPropertyKey; cDataObjectList aRevDOList; String aAppFullKey; String aAppRelatedKey; String aAppPropertyKey; cDataObjectList aAppDOList; XmlNode aReviewerNode; XmlNodeList aRevFiltersNodeList; XmlNode aApplicantNode; XmlNodeList aAppFiltersNodeList; int aRCID = 0; int i; //foreach(cDataObject aWFTADO in aWFTADOList) { for (i = 0; i < aWFTADOList.Count; i++) { cDataObject aWFTADO = aWFTADOList[i]; Debug.WriteLine("Checking " + i.ToString() + " of " + aWFTADOList.Count.ToString()); bool aRC = false; foreach (XmlNode aRCTypeNode in aRCTypeNodeList) { //Get reviewer property data object list aReviewerNode = aRCTypeNode.SelectSingleNode("Reviewer"); aRevFiltersNodeList = aReviewerNode.SelectNodes("Filters/Argument"); aRevFullKey = cXMLDoc.AttributeToString(aReviewerNode, "PropertyKey"); aIndex = aRevFullKey.LastIndexOf("."); if (aIndex == -1) { aRevDOList = this.DataObjectList; aRevPropertyKey = aRevFullKey; } else { aRevRelatedKey = aRevFullKey.Substring(0, aIndex); aRevDOList = aWFTADO.GetRelatedPropertyDataObjectList(aRevRelatedKey); aRevPropertyKey = aRevFullKey.Substring(aIndex + 1); } //Get applicant property data object list aApplicantNode = aRCTypeNode.SelectSingleNode("Applicant"); aAppFiltersNodeList = aApplicantNode.SelectNodes("Filters/Argument"); aAppFullKey = cXMLDoc.AttributeToString(aApplicantNode, "PropertyKey"); aIndex = aAppFullKey.LastIndexOf("."); if (aIndex == -1) { aAppDOList = this.DataObjectList; aAppPropertyKey = aAppFullKey; } else { aAppRelatedKey = aAppFullKey.Substring(0, aIndex); aAppDOList = aWFTADO.GetRelatedPropertyDataObjectList(aAppRelatedKey); aAppPropertyKey = aAppFullKey.Substring(aIndex + 1); } //Loop through both lists; return true if any values are equal foreach (cDataObject aRevDO in aRevDOList) { if (aRevDO.MeetsFilterCriteria(aRevFiltersNodeList)) { foreach (cDataObject aAppDO in aAppDOList) { if (aAppDO.MeetsFilterCriteria(aAppFiltersNodeList)) { if (aRevDO.GetPropertyString(aRevPropertyKey) == aAppDO.GetPropertyString(aAppPropertyKey)) { aRC = true; aRCID = Convert.ToInt32(cXMLDoc.AttributeToString(aRCTypeNode, "ID")); break; } } } //foreach(cDataObject aAppDO in aAppDOList) } if (aRC) { break; } } //foreach(cDataObject aRevDO in aRevDOList) if (aRC) { break; } } //foreach(XmlNode aRCTypeNode in aRCTypeNodeList) if (aRC) { //Get request/conflict definition to find out whether this is a request or a conflict cDataObject aRCDefDO = DataObjectFactory.GetDataObjectFromPrimaryKey("Conflict", aRCID.ToString()); int aRequestConflictID = aRCDefDO.GetPropertyInt("RequestConflictID"); //Write request/conflict row cDataObject aRCDO; aRCDO = DataObjectFactory.CreateNewDataObjectFromKey("WfTaskAssignmentRequestConflict"); aRCDO["ConflictID"] = aRCID; aRCDO["WfTaskAssignmentID"] = aWFTADO.GetPropertyInt("WfTaskAssignmentID"); aRCDO["RequestConflictID"] = aRequestConflictID; aRCDO["Automatic"] = true; DataObjectFactory.SaveDataObject(aRCDO); } } //foreach(cDataObject aWFTADO in aWFTADOList) }