public string GetRegistrationDetails(string requestParam) { string RetVal; string[] Params; string DbNId, UserNId, RegistrationId, DFDOrMFDId, LanguageCode; bool IsMetadata; RegistryInterfaceType RegistryInterfaceRequest, RegistryInterfaceResponse; RegistrationType Registration; Registry.RegistryService Service; XmlDocument Request; XmlElement Element; SDMXObjectModel.Registry.QueryableDataSourceType QueryableDataSource = null; string SimpleDataSource = string.Empty; string DataUrl = string.Empty; string WADLUrl = string.Empty; string WSDLUrl = string.Empty; string SimpleDataFileUrl = string.Empty; bool IsRest = false; bool IsSoap = false; RetVal = string.Empty; DbNId = string.Empty; UserNId = string.Empty; RegistrationId = string.Empty; DFDOrMFDId = string.Empty; LanguageCode = string.Empty; IsMetadata = false; RegistryInterfaceRequest = null; RegistryInterfaceResponse = null; Registration = null; Service = null; Request = new XmlDocument(); Element = null; try { Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter); DbNId = Params[0].ToString().Trim(); UserNId = Params[1].ToString().Trim(); RegistrationId = Params[2].ToString().Trim(); LanguageCode = Params[3].ToString().Trim(); RegistryInterfaceRequest = new RegistryInterfaceType(); RegistryInterfaceRequest.Header = Global.Get_Appropriate_Header(); RegistryInterfaceRequest.Footer = null; RegistryInterfaceRequest.Item = new SDMXObjectModel.Registry.QueryRegistrationRequestType(); ((SDMXObjectModel.Registry.QueryRegistrationRequestType)RegistryInterfaceRequest.Item).Item = new DataProviderReferenceType(); ((DataProviderReferenceType)((SDMXObjectModel.Registry.QueryRegistrationRequestType)RegistryInterfaceRequest.Item).Item).Items = new List<object>(); ((DataProviderReferenceType)((SDMXObjectModel.Registry.QueryRegistrationRequestType)RegistryInterfaceRequest.Item).Item).Items.Add(new DataProviderRefType (DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Prefix + UserNId, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.AgencyId, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Id, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Version)); Service = new Registry.RegistryService(); Service.Url = HttpContext.Current.Request.Url.OriginalString.Substring(0, HttpContext.Current.Request.Url.OriginalString.IndexOf("libraries")) + Constants.FolderName.SDMX.RegistryServicePath; Service.Url += "?p=" + DbNId.ToString(); Request = Serializer.SerializeToXmlDocument(typeof(RegistryInterfaceType), RegistryInterfaceRequest); Element = Request.DocumentElement; string languageNid = Global.GetLangNidFromlangCode(LanguageCode); Service.QueryRegistration(ref Element, languageNid); RegistryInterfaceResponse = (RegistryInterfaceType)Deserializer.LoadFromText(typeof(RegistryInterfaceType), Element.OuterXml); foreach (QueryResultType QueryResult in ((SDMXObjectModel.Registry.QueryRegistrationResponseType)RegistryInterfaceResponse.Item).QueryResult) { if (QueryResult.Item.Registration.id == RegistrationId) { Registration = QueryResult.Item.Registration; break; } } DFDOrMFDId = ((ProvisionAgreementRefType)(Registration.ProvisionAgreement.Items[0])).id.Replace(DevInfo.Lib.DI_LibSDMX.Constants.PA.Prefix + UserNId + "_", ""); if (Registration.Datasource != null && Registration.Datasource.Count > 0 && Registration.Datasource.Count < 3) { if (Registration.Datasource.Count == 1) { if (Registration.Datasource[0] is SDMXObjectModel.Registry.QueryableDataSourceType) { QueryableDataSource = (SDMXObjectModel.Registry.QueryableDataSourceType)Registration.Datasource[0]; } else if (Registration.Datasource[0] is string) { SimpleDataSource = (string)Registration.Datasource[0]; } } else if (Registration.Datasource.Count == 2) { if (Registration.Datasource[0] is SDMXObjectModel.Registry.QueryableDataSourceType) { QueryableDataSource = (SDMXObjectModel.Registry.QueryableDataSourceType)Registration.Datasource[0]; if (Registration.Datasource[1] is string) { SimpleDataSource = (string)Registration.Datasource[1]; } } else if (Registration.Datasource[0] is string) { SimpleDataSource = (string)Registration.Datasource[0]; if (Registration.Datasource[1] is SDMXObjectModel.Registry.QueryableDataSourceType) { QueryableDataSource = (SDMXObjectModel.Registry.QueryableDataSourceType)Registration.Datasource[1]; } } } } if (!string.IsNullOrEmpty(SimpleDataSource)) { SimpleDataFileUrl = SimpleDataSource; } if (QueryableDataSource != null) { DataUrl = QueryableDataSource.DataURL; WADLUrl = QueryableDataSource.WADLURL; WSDLUrl = QueryableDataSource.WSDLURL; IsRest = QueryableDataSource.isRESTDatasource; IsSoap = QueryableDataSource.isWebServiceDatasource; } RetVal = Registration.id + Constants.Delimiters.ParamDelimiter + DataUrl + Constants.Delimiters.ParamDelimiter + IsRest.ToString() + Constants.Delimiters.ParamDelimiter + WADLUrl + Constants.Delimiters.ParamDelimiter + IsSoap.ToString() + Constants.Delimiters.ParamDelimiter + WSDLUrl + Constants.Delimiters.ParamDelimiter + SimpleDataFileUrl; if (DFDOrMFDId == DevInfo.Lib.DI_LibSDMX.Constants.DFD.Id) { IsMetadata = false; } else { IsMetadata = true; } RetVal += Constants.Delimiters.ParamDelimiter + IsMetadata; RetVal += Constants.Delimiters.ParamDelimiter + DFDOrMFDId; } catch (Exception ex) { RetVal = ex.Message; Global.CreateExceptionString(ex, null); } finally { } return RetVal; }
public string GetDataForGenerateApiCall(string requestParam) { string RetVal; string[] Params; int DBNId; string SelectedFunction; string Id; string AgencyId; string Version; string UserIdAndType; string UploadedHeaderFileWPath, UploadedHeaderFolderPath; Registry.RegistryService Service; SDMXObjectModel.Message.StructureHeaderType Header; SDMXApi_2_0.Message.HeaderType Header_2_0; XmlDocument Query; XmlElement Element; XmlDocument Response; XmlDocument UploadedHeaderXml; string agencyId; List<bool> isSOAPMailIds; List<string> notificationMailIds; List<bool> isSOAPHTTPs; List<string> notificationHTTPs; DateTime startDate; DateTime endDate; string eventSelector; Dictionary<string, string> dictCategories; string mfdId; string CategoriesGIDAndSchemeIds; string CategoryGID; string CategorySchemeId; string DFDOrMFDId; string WebServiceURL; bool IsREST; string WADLURL; bool IsSOAP; string WSDLURL; string FileURL; string RequestURL; string ResponseURL; string preferredLangNid; string[] DBDetails; string checkIfSDMXDB; RetVal = string.Empty; Params = null; DBNId = -1; SelectedFunction = string.Empty; Id = string.Empty; AgencyId = string.Empty; Version = string.Empty; UserIdAndType = string.Empty; Service = new Registry.RegistryService(); Service.Url = HttpContext.Current.Request.Url.OriginalString.Substring(0, HttpContext.Current.Request.Url.OriginalString.IndexOf("libraries")) + Constants.FolderName.SDMX.RegistryServicePath; Query = new XmlDocument(); Response = new XmlDocument(); Element = null; agencyId = string.Empty; isSOAPMailIds = new List<bool>(); notificationMailIds = new List<string>(); isSOAPHTTPs = new List<bool>(); notificationHTTPs = new List<string>(); startDate = new DateTime(); endDate = new DateTime(); eventSelector = string.Empty; dictCategories = new Dictionary<string, string>(); mfdId = string.Empty; CategoriesGIDAndSchemeIds = string.Empty; CategoryGID = string.Empty; CategorySchemeId = string.Empty; DFDOrMFDId = string.Empty; WebServiceURL = string.Empty; IsREST = false; WADLURL = string.Empty; IsSOAP = false; WSDLURL = string.Empty; FileURL = string.Empty; RequestURL = string.Empty; ResponseURL = string.Empty; preferredLangNid = string.Empty; DBDetails = null; checkIfSDMXDB = string.Empty; Header = new SDMXObjectModel.Message.StructureHeaderType(); Header_2_0 = new SDMXApi_2_0.Message.HeaderType(); UploadedHeaderXml = new XmlDocument(); UploadedHeaderFolderPath = Server.MapPath("../../stock/data"); try { Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter); DBNId = Convert.ToInt32(Params[0].ToString().Trim()); SelectedFunction = Params[1].ToString().Trim(); DBDetails = Global.GetDbConnectionDetails(Convert.ToString(DBNId)); checkIfSDMXDB = DBDetails[4].ToString(); UploadedHeaderFileWPath = UploadedHeaderFolderPath + "/" + DBNId + "/" + "sdmx" + "/" + DevInfo.Lib.DI_LibSDMX.Constants.Header.FileName; if (File.Exists(UploadedHeaderFileWPath)) { UploadedHeaderXml.Load(UploadedHeaderFileWPath); if (checkIfSDMXDB == "true") { SDMXApi_2_0.Message.StructureType UploadedDSDStructure = new SDMXApi_2_0.Message.StructureType(); UploadedDSDStructure = (SDMXApi_2_0.Message.StructureType)SDMXApi_2_0.Deserializer.LoadFromXmlDocument(typeof(SDMXApi_2_0.Message.StructureType), UploadedHeaderXml); Header_2_0 = UploadedDSDStructure.Header; } else { SDMXObjectModel.Message.StructureType UploadedDSDStructure = new SDMXObjectModel.Message.StructureType(); UploadedDSDStructure = (SDMXObjectModel.Message.StructureType)SDMXObjectModel.Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), UploadedHeaderXml); Header = UploadedDSDStructure.Header; } } if ((SelectedFunction == "QuerySubscription") || (SelectedFunction == "QueryRegistration")) { UserIdAndType = Params[2].ToString().Trim(); } else if (SelectedFunction == "SubmitSubscription") { UserIdAndType = Params[2].ToString().Trim(); if (Params[3].ToString().Trim() == "0") { isSOAPMailIds = new List<bool>(); isSOAPMailIds.Add(false); isSOAPHTTPs = new List<bool>(); isSOAPHTTPs.Add(false); } else { isSOAPMailIds = new List<bool>(); isSOAPMailIds.Add(true); isSOAPHTTPs = new List<bool>(); isSOAPHTTPs.Add(true); } notificationMailIds = new List<string>(); notificationMailIds.Add(Params[4].ToString().Trim()); notificationHTTPs = new List<string>(); notificationHTTPs.Add(Params[5].ToString().Trim()); startDate = DateTime.ParseExact(Params[6].ToString().Trim(), "dd-MM-yyyy", null); endDate = DateTime.ParseExact(Params[7].ToString().Trim(), "dd-MM-yyyy", null); eventSelector = Params[8].ToString().Trim(); CategoriesGIDAndSchemeIds = Params[9].ToString().Trim(); dictCategories = new Dictionary<string, string>(); if (eventSelector == "Data Registration") { foreach (string CategoryGIDAndSchemeId in Global.SplitString(CategoriesGIDAndSchemeIds, ",")) { CategoryGID = CategoryGIDAndSchemeId.Split('|')[0]; CategorySchemeId = CategoryGIDAndSchemeId.Split('|')[1]; dictCategories.Add(CategoryGID, CategorySchemeId); } } agencyId = Global.Get_AgencyId_From_DFD(DBNId.ToString()); mfdId = Params[10].ToString().Trim(); preferredLangNid = Params[11].ToString().Trim(); } else if (SelectedFunction == "SubmitRegistration") { UserIdAndType = Params[2].ToString().Trim(); agencyId = Global.Get_AgencyId_From_DFD(DBNId.ToString()); DFDOrMFDId = Params[3].ToString().Trim(); FileURL = Params[4].ToString().Trim(); } else { Id = Params[2].ToString().Trim(); AgencyId = Params[3].ToString().Trim(); Version = Params[4].ToString().Trim(); } Service.Url += "?p=" + DBNId.ToString(); RetVal = Service.Url; RetVal += Constants.Delimiters.ParamDelimiter + SelectedFunction; switch (SelectedFunction) { case "GetDataflow": Query = GetQueryXmlDocumentOnTypeBasis(0, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetDataflow(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetMetadataflow": Query = GetQueryXmlDocumentOnTypeBasis(1, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetMetadataflow(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetDataStructure": Query = GetQueryXmlDocumentOnTypeBasis(2, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetDataStructure(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetMetadataStructure": Query = GetQueryXmlDocumentOnTypeBasis(3, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetMetadataStructure(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetCategoryScheme": Query = GetQueryXmlDocumentOnTypeBasis(4, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetCategoryScheme(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetCategorisation": Query = GetQueryXmlDocumentOnTypeBasis(5, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetCategorisation(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetConceptScheme": Query = GetQueryXmlDocumentOnTypeBasis(6, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetConceptScheme(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetCodelist": Query = GetQueryXmlDocumentOnTypeBasis(7, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetCodelist(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetOrganisationScheme": Query = GetQueryXmlDocumentOnTypeBasis(8, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetOrganisationScheme(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetProvisionAgreement": Query = GetQueryXmlDocumentOnTypeBasis(9, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetProvisionAgreement(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetConstraint": Query = GetQueryXmlDocumentOnTypeBasis(10, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetConstraint(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetStructures": Query = GetQueryXmlDocumentOnTypeBasis(11, Id, AgencyId, Version, string.Empty); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.GetStructures(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "QuerySubscription": Query = GetQueryXmlDocumentOnTypeBasis(12, Id, AgencyId, Version, UserIdAndType); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.QuerySubscription(ref Element); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "QueryRegistration": Query = GetQueryXmlDocumentOnTypeBasis(13, Id, AgencyId, Version, UserIdAndType); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.QueryRegistration(ref Element,preferredLangNid); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "SubmitSubscription": Query = GetQueryXmlDocumentForSubmitSubscription(ActionType.Append, UserIdAndType, agencyId, isSOAPMailIds, notificationMailIds, isSOAPHTTPs, notificationHTTPs, startDate, endDate, eventSelector, dictCategories, mfdId, string.Empty,Header); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.SubmitSubscription(ref Element, preferredLangNid);//language code Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "SubmitRegistration": Query = GetQueryXmlDocumentForSubmitRegistration(UserIdAndType, agencyId, DFDOrMFDId, WebServiceURL, IsREST, WADLURL, IsSOAP, WSDLURL, FileURL); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Query); Element = Query.DocumentElement; Service.SubmitRegistration(ref Element, string.Empty, preferredLangNid); Response.LoadXml(Element.OuterXml); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); RequestURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Query)); ResponseURL = SaveContentTemporarilyandDeleteOtherFiles(this.Get_Formatted_XML(Response)); RetVal += Constants.Delimiters.ParamDelimiter + RequestURL; RetVal += Constants.Delimiters.ParamDelimiter + ResponseURL; break; case "GetGenericData": break; case "GetGenericTimeSeriesData": break; case "GetStructureSpecificData": break; case "GetStructureSpecificTimeSeriesData": break; case "GetGenericMetadata": break; case "GetStructureSpecificMetadata": break; case "SubmitStructure": break; case "GetReportingTaxonomy": break; case "GetStructureSet": break; case "GetProcess": break; case "GetHierarchicalCodelist": break; case "GetDataSchema": break; case "GetMetadataSchema": break; default: break; } } catch (SoapException SOAPex) { Response.LoadXml(SOAPex.Detail.InnerText); RetVal += Constants.Delimiters.ParamDelimiter + this.Get_Formatted_XML(Response); Global.CreateExceptionString(SOAPex, null); } catch (Exception ex) { RetVal += "false" + Constants.Delimiters.ParamDelimiter + ex.Message; Global.CreateExceptionString(ex, null); } finally { } return RetVal; }
private string GetRegistrationsSummaryHTML(string DbNId, string UserNId, string LanguageCode, int StartIndex, int NumberPagingRows) { string RetVal; int TotalRows, Counter, TotalRowCount = 0, TempRowCount = 0; RegistryInterfaceType RegistryInterfaceRequest, RegistryInterfaceResponse; Registry.RegistryService Service; XmlDocument Request; XmlElement Element; RetVal = string.Empty; TotalRows = 0; Counter = 0; RegistryInterfaceRequest = null; RegistryInterfaceResponse = null; Service = null; Request = new XmlDocument(); Element = null; try { RegistryInterfaceRequest = new RegistryInterfaceType(); RegistryInterfaceRequest.Header = Global.Get_Appropriate_Header(); RegistryInterfaceRequest.Footer = null; RegistryInterfaceRequest.Item = new SDMXObjectModel.Registry.QueryRegistrationRequestType(); ((SDMXObjectModel.Registry.QueryRegistrationRequestType)RegistryInterfaceRequest.Item).Item = new DataProviderReferenceType(); ((DataProviderReferenceType)((SDMXObjectModel.Registry.QueryRegistrationRequestType)RegistryInterfaceRequest.Item).Item).Items = new List<object>(); ((DataProviderReferenceType)((SDMXObjectModel.Registry.QueryRegistrationRequestType)RegistryInterfaceRequest.Item).Item).Items.Add(new DataProviderRefType(DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Prefix + UserNId, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.AgencyId, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Id, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Version)); Service = new Registry.RegistryService(); Service.Url = HttpContext.Current.Request.Url.OriginalString.Substring(0, HttpContext.Current.Request.Url.OriginalString.IndexOf("libraries")) + Constants.FolderName.SDMX.RegistryServicePath; Service.Url += "?p=" + DbNId.ToString(); Request = Serializer.SerializeToXmlDocument(typeof(RegistryInterfaceType), RegistryInterfaceRequest); Element = Request.DocumentElement; string languageNid = Global.GetLangNidFromlangCode(LanguageCode); Service.QueryRegistration(ref Element, languageNid); RegistryInterfaceResponse = (RegistryInterfaceType)Deserializer.LoadFromText(typeof(RegistryInterfaceType), Element.OuterXml); TotalRows = ((SDMXObjectModel.Registry.QueryRegistrationResponseType)RegistryInterfaceResponse.Item).QueryResult.Count; foreach (QueryResultType QueryResult in ((SDMXObjectModel.Registry.QueryRegistrationResponseType)RegistryInterfaceResponse.Item).QueryResult) { if (StartIndex + NumberPagingRows <= TotalRows) { if ((Counter >= StartIndex) && (Counter < StartIndex + NumberPagingRows)) { TempRowCount = TotalRowCount; RetVal += this.Get_InnerHtml_For_Single_Registration(DbNId, UserNId, LanguageCode, QueryResult.Item.Registration, TempRowCount, out TotalRowCount); RetVal += Constants.Delimiters.PivotRowDelimiter; } } else { if ((Counter >= StartIndex) && (Counter < TotalRows)) { TempRowCount = TotalRowCount; RetVal += this.Get_InnerHtml_For_Single_Registration(DbNId, UserNId, LanguageCode, QueryResult.Item.Registration, TempRowCount, out TotalRowCount); RetVal += Constants.Delimiters.PivotRowDelimiter; } } if (RetVal.Contains("#")) { RetVal = RetVal.Replace("##########", "#").Replace("#########", "#").Replace("########", "#").Replace("#######", "#").Replace("######", "#").Replace("#####", "#").Replace("####", "#").Replace("###", "#").Replace("##", "#"); if (RetVal.StartsWith("#")) { RetVal = RetVal.Substring(1); } } Counter++; } RetVal = RetVal.Remove(RetVal.Length - 1, 1); // TotalRows =TotalRowCount; RetVal += Constants.Delimiters.ParamDelimiter + StartIndex.ToString() + Constants.Delimiters.ParamDelimiter + NumberPagingRows.ToString() + Constants.Delimiters.ParamDelimiter + TotalRows.ToString(); } catch (Exception ex) { Global.CreateExceptionString(ex, null); throw ex; } finally { } return RetVal; }