private void ProcessRequest(XmlDocument RequestXMLObj, string useCase) { switch (useCase) { case "SaveCurrentSco": try { string strContentModuleId = string.Empty; string strLearnerId = string.Empty; ////string strClientId = string.Empty; if (LMSSession.IsInSession(ContentKeys.SESSION_ACTIVITYID)) { strContentModuleId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID)); } if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID)) { strLearnerId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID)); } ////if (LMSSession.IsInSession(Client.CLIENT_SESSION_ID)) //// strClientId = Convert.ToString(LMSSession.GetValue(Client.CLIENT_SESSION_ID)); ////if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnClientId.Value)) ////{ //// strClientId = EncryptionManager.Decrypt(hdnClientId.Value); ////} if (!string.IsNullOrEmpty(hdnContentModuleId.Value)) { strContentModuleId = EncryptionManager.Decrypt(hdnContentModuleId.Value); } if (!String.IsNullOrEmpty(strContentModuleId)) { bool flag = false; if (hdnContentModuleIdIsA.Value == String.Empty) { ContentModuleManager _CMManager = new ContentModuleManager(); ContentModule entContentModule = new ContentModule(); entContentModule.ID = strContentModuleId; ////entContentModule.ClientId = strClientId; entContentModule = _CMManager.Execute(entContentModule, ContentModule.Method.GetByIDCoursePlayer); flag = entContentModule.IsAssessment; hdnContentModuleIdIsA.Value = entContentModule.IsAssessment.ToString(); } else { flag = Convert.ToBoolean(hdnContentModuleIdIsA.Value); } if (flag) { SaveSuspendData(RequestXMLObj); } } else { RedirectToMainPage(); } } catch (Exception ex) { } SaveCurrentSco(RequestXMLObj); ////string xmlFromPost = Request["TARecords"]; break; } }
public static short GetTotalPages(string clientId, string courseId) { string cacheKey = "PageCount-" + clientId + "-" + courseId; short TotalNoOfPages = 0; if (HttpContext.Current.Cache[cacheKey] == null) { string rootSharedPath = "root content path"; ContentModule entContent = new ContentModule(); ContentModuleManager entContentModuleManager = new ContentModuleManager(); entContent.ID = courseId; entContent.ClientId = clientId; entContent = entContentModuleManager.Execute(entContent, ContentModule.Method.GetByIDCoursePlayer); string sContentFolderPath = rootSharedPath + entContent.ContentModuleURL.Replace("/", @"\\"); string IMSManifestPath; if (String.IsNullOrEmpty(entContent.ImanifestUrl)) { IMSManifestPath = sContentFolderPath + "\\\\imsmanifest.xml"; } else { IMSManifestPath = rootSharedPath + entContent.ImanifestUrl.Replace("/", @"\"); } XmlNamespaceManager nsmanager; XMLLib xLib = new XMLLib(); XmlDocument oIMSXMLObj = null; XmlNodeList ScoNodeList = null; if (!xLib.fOpenFreeXMLDoc(ref oIMSXMLObj, IMSManifestPath)) { return(0); } nsmanager = new XmlNamespaceManager(oIMSXMLObj.NameTable); nsmanager.AddNamespace("adlcp", "http://www.adlnet.org/xsd/adlcp_rootv1p2"); oIMSXMLObj = xLib.StripDocumentNamespace(oIMSXMLObj); xLib.NSManager = nsmanager; XmlNode lRsrcNode = null; if (oIMSXMLObj != null) { xLib.fCreateContext(oIMSXMLObj, "/manifest/organizations/organization//item", ref ScoNodeList); foreach (XmlNode lItemNode in ScoNodeList) { string lIdentifierref = xLib.fDirectGetValue(lItemNode, "@identifierref"); if (lIdentifierref != "") { if (xLib.fCreateFirstContext(oIMSXMLObj, "/manifest/resources/resource[@identifier='" + lIdentifierref + "']", ref lRsrcNode)) { TotalNoOfPages++; } } } } HttpContext.Current.Cache.Insert(cacheKey, TotalNoOfPages, new CacheDependency(IMSManifestPath)); } else { TotalNoOfPages = Convert.ToInt16(HttpContext.Current.Cache[cacheKey]); } return(TotalNoOfPages); }