private AnalyticsAssessment GetAnalyticsAssessment() { int assessmentId = Auth.AssessmentForUser(); AssessmentManager assessmentManager = new AssessmentManager(); StandardsManager standardsManager = new StandardsManager(); var assessment = assessmentManager.GetAnalyticsAssessmentDetail(assessmentId); return(assessment); }
protected override void ReadReferences(XmlElement rstrXml, out SecurityKeyIdentifierClause requestedAttachedReference, out SecurityKeyIdentifierClause requestedUnattachedReference) { XmlElement issuedTokenXml = null; requestedAttachedReference = null; requestedUnattachedReference = null; for (int i = 0; i < rstrXml.ChildNodes.Count; ++i) { XmlElement child = rstrXml.ChildNodes[i] as XmlElement; if (child != null) { if (child.LocalName == DriverDictionary.RequestedSecurityToken.Value && child.NamespaceURI == DriverDictionary.Namespace.Value) { issuedTokenXml = XmlHelper.GetChildElement(child); } else if (child.LocalName == DriverDictionary.RequestedAttachedReference.Value && child.NamespaceURI == DriverDictionary.Namespace.Value) { requestedAttachedReference = GetKeyIdentifierXmlReferenceClause(XmlHelper.GetChildElement(child)); } else if (child.LocalName == DriverDictionary.RequestedUnattachedReference.Value && child.NamespaceURI == DriverDictionary.Namespace.Value) { requestedUnattachedReference = GetKeyIdentifierXmlReferenceClause(XmlHelper.GetChildElement(child)); } } } try { if (issuedTokenXml != null) { if (requestedAttachedReference == null) { StandardsManager.TryCreateKeyIdentifierClauseFromTokenXml(issuedTokenXml, SecurityTokenReferenceStyle.Internal, out requestedAttachedReference); } if (requestedUnattachedReference == null) { StandardsManager.TryCreateKeyIdentifierClauseFromTokenXml(issuedTokenXml, SecurityTokenReferenceStyle.External, out requestedUnattachedReference); } } } catch (XmlException) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.Format(SR.TrustDriverIsUnableToCreatedNecessaryAttachedOrUnattachedReferences, issuedTokenXml.ToString()))); } }
/// <summary> /// /// </summary> /// <param name="userID"></param> /// <param name="stream"></param> public void ProcessAllAssessmentsForUser(int userID, MemoryStream stream) { DataTable dtAll = null; var sm = new StandardsManager(); // get all the assessment IDs that this user has access to var myAssessmentIDs = db.ASSESSMENT_CONTACTS.Where(x => x.UserId == userID).Select(y => y.Assessment_Id).ToList(); foreach (int assessmentID in myAssessmentIDs) { // ignore assessments that don't have the ACET standard if (!sm.GetACET(assessmentID)) { continue; } // get the values as a DataTable DataTable dt = BuildAssessment(assessmentID); // append the row into dtAll ..... if (dtAll == null) { dtAll = dt.Copy(); } else { if (dt.Rows.Count > 0) { dtAll.LoadDataRow(dt.Rows[0].ItemArray, true); } } } // Create an Excel document from the data that has been gathered var doc = new CSETtoExcelDocument(); doc.AddDataTable(dtAll); List <DataMap> list = new List <DataMap>(); doc.WriteExcelFile(stream, list); }