Ejemplo n.º 1
0
    public string GetSubscriptionDetails(string requestParam)
    {
        string RetVal = string.Empty;
        string[] Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
        string DbNId, UserIdAndType, SubscriptionId;
        XmlDocument SubscriptionDetailsXml = new XmlDocument();
        string CategoriesGIDAndSchemeIds = string.Empty;
        string CategoriesGIDAndSchemeId = string.Empty;
        string CategoryGId = string.Empty;
        string CategorySchemeId = string.Empty;
        string Email = string.Empty;
        string WebServiceAddress = string.Empty;
        bool IsSOAP = false;
        string StartDate = string.Empty;
        string EndDate = string.Empty;
        string EventType = string.Empty;
        string hlngcode = string.Empty;
        Registry.RegistryService Service;
        XmlDocument Query;
        XmlElement Element;
        XmlDocument Response;
        SDMXObjectModel.Message.RegistryInterfaceType SubRegistryInterface;
        int i;

        Service = new Registry.RegistryService();
        Query = new XmlDocument();
        Response = new XmlDocument();
        Element = null;
        SubRegistryInterface = new SDMXObjectModel.Message.RegistryInterfaceType();

        try
        {
            SubscriptionId = Params[0];
            DbNId = Params[1].ToString().Trim();
            UserIdAndType = Params[2].ToString();
            hlngcode = Params[3].ToString().Trim();
            Query = GetQueryXmlDocumentOnTypeBasis(12, string.Empty, string.Empty, string.Empty, UserIdAndType);
            Element = Query.DocumentElement;
            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();
            Service.QuerySubscription(ref Element);
            Response.LoadXml(Element.OuterXml);
            SubRegistryInterface = (SDMXObjectModel.Message.RegistryInterfaceType)(SDMXObjectModel.Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.RegistryInterfaceType), Response));
            foreach (SDMXObjectModel.Registry.SubscriptionType Subscription in ((SDMXObjectModel.Registry.QuerySubscriptionResponseType)(SubRegistryInterface.Item)).Subscription)
            {
                if (SubscriptionId == Subscription.RegistryURN)
                {
                    Email = Subscription.NotificationMailTo[0].Value.ToString();
                    WebServiceAddress = Subscription.NotificationHTTP[0].Value.ToString();
                    IsSOAP = Subscription.NotificationHTTP[0].isSOAP;
                    StartDate = Subscription.ValidityPeriod.StartDate.ToString("dd-MM-yyyy");
                    EndDate = Subscription.ValidityPeriod.EndDate.ToString("dd-MM-yyyy");

                    RetVal = Email;
                    RetVal += Constants.Delimiters.ValuesDelimiter + WebServiceAddress;
                    RetVal += Constants.Delimiters.ValuesDelimiter + IsSOAP;
                    RetVal += Constants.Delimiters.ValuesDelimiter + StartDate;
                    RetVal += Constants.Delimiters.ValuesDelimiter + EndDate;

                    if (Subscription.EventSelector[0] is DataRegistrationEventsType)
                    {
                        EventType = GetlanguageBasedValueOfKey("lang_Data_Registration", hlngcode, "RegSubscription.xml");
                        for (i = 0; i < ((DataRegistrationEventsType)(Subscription.EventSelector[0])).Items.Length; i++)
                        {
                            CategoryGId = ((SDMXObjectModel.Common.CategoryRefType)(((CategoryReferenceType)(((DataRegistrationEventsType)(Subscription.EventSelector[0])).Items[i])).Items[0])).id;
                            CategorySchemeId = ((SDMXObjectModel.Common.CategoryRefType)(((CategoryReferenceType)(((DataRegistrationEventsType)(Subscription.EventSelector[0])).Items[i])).Items[0])).maintainableParentID;
                            CategoriesGIDAndSchemeIds = CategoriesGIDAndSchemeIds + CategoryGId + Constants.Delimiters.PivotColumnDelimiter + CategorySchemeId + ",";
                        }
                        CategoriesGIDAndSchemeIds = CategoriesGIDAndSchemeIds.Remove(CategoriesGIDAndSchemeIds.Length - 1, 1);
                        RetVal += Constants.Delimiters.ValuesDelimiter + EventType;
                        RetVal += Constants.Delimiters.ValuesDelimiter + CategoriesGIDAndSchemeIds;
                    }
                    else if (Subscription.EventSelector[0] is MetadataRegistrationEventsType)
                    {
                        EventType = GetlanguageBasedValueOfKey("lang_Metadata_Registration", hlngcode, "RegSubscription.xml");
                        RetVal += Constants.Delimiters.ValuesDelimiter + EventType;
                        RetVal += Constants.Delimiters.ValuesDelimiter + ((MaintainableQueryType)((MaintainableEventType)(((MetadataRegistrationEventsType)(Subscription.EventSelector[0])).Items[0])).Item).id;
                    }
                    else if (Subscription.EventSelector[0] is StructuralRepositoryEventsType)
                    {
                        EventType = GetlanguageBasedValueOfKey("lang_Structural_Metadata_Registration", hlngcode,
        "RegSubscription.xml");
                        RetVal += Constants.Delimiters.ValuesDelimiter + EventType;
                    }

                    // get preferred language

                    RetVal += Constants.Delimiters.ValuesDelimiter + Global.GetPreferredLanguageFromSubscriptionId(SubscriptionId);
                    break;
                }

            }

        }
        catch (Exception ex)
        {
            RetVal = string.Empty;
            Global.CreateExceptionString(ex, null);
        }

        return RetVal;
    }
Ejemplo n.º 2
0
    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;
    }
Ejemplo n.º 3
0
    public string GetLoggedInUserSubscriptions(string requestParam)
    {
        string RetVal;
        string[] Params;
        string DBNId;
        string UserIdAndType;
        string hlngcode;
        StringBuilder sb;
        Registry.RegistryService Service;
        XmlDocument Query;
        XmlElement Element;
        XmlDocument Response;
        SDMXObjectModel.Message.RegistryInterfaceType SubRegistryInterface;
        string RegistryURN;
        string Email;
        string WebServiceAddress;
        string StartDate;
        string EndDate;
        string EventType;
        string Action;
        string prefLang;

        RetVal = string.Empty;
        Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
        DBNId = Params[0];
        UserIdAndType = Params[1];
        hlngcode = Params[2];

        sb = new StringBuilder();
        Service = new Registry.RegistryService();
        Query = new XmlDocument();
        Response = new XmlDocument();
        Element = null;
        SubRegistryInterface = new SDMXObjectModel.Message.RegistryInterfaceType();
        RegistryURN = string.Empty;
        Email = string.Empty;
        WebServiceAddress = string.Empty;
        StartDate = string.Empty;
        EndDate = string.Empty;
        EventType = string.Empty;
        Action = string.Empty;
        prefLang = string.Empty;

        Query = GetQueryXmlDocumentOnTypeBasis(12, string.Empty, string.Empty, string.Empty, UserIdAndType);
        Element = Query.DocumentElement;

        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();
        Service.QuerySubscription(ref Element);
        Response.LoadXml(Element.OuterXml);
        SubRegistryInterface = (SDMXObjectModel.Message.RegistryInterfaceType)(SDMXObjectModel.Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.RegistryInterfaceType), Response));
        foreach (SDMXObjectModel.Registry.SubscriptionType Subscription in ((SDMXObjectModel.Registry.QuerySubscriptionResponseType)(SubRegistryInterface.Item)).Subscription)
        {
            RegistryURN = Subscription.RegistryURN;
            Email = Subscription.NotificationMailTo[0].Value.ToString();
            WebServiceAddress = Subscription.NotificationHTTP[0].Value.ToString();
            StartDate = Subscription.ValidityPeriod.StartDate.ToString("dd-MM-yyyy");
            EndDate = Subscription.ValidityPeriod.EndDate.ToString("dd-MM-yyyy");
            if (Subscription.EventSelector[0] is DataRegistrationEventsType)
            {
                EventType = GetlanguageBasedValueOfKey("lang_Data_Registration", hlngcode, "RegSubscription.xml");
            }
            else if (Subscription.EventSelector[0] is MetadataRegistrationEventsType)
            {
                EventType = GetlanguageBasedValueOfKey("lang_Metadata_Registration", hlngcode, "RegSubscription.xml");
            }
            else if (Subscription.EventSelector[0] is StructuralRepositoryEventsType)
            {
                EventType = GetlanguageBasedValueOfKey("lang_Structural_Metadata_Registration", hlngcode, "RegSubscription.xml");
            }

            // Get preferred language
            prefLang = Global.GetLanguageNameFromNid(Global.GetPreferredLanguageFromSubscriptionId(RegistryURN));

            sb.Append(RegistryURN);
            sb.Append("~");
            sb.Append(Email);
            sb.Append("~");
            sb.Append(WebServiceAddress);
            sb.Append("~");
            sb.Append(StartDate);
            sb.Append("~");
            sb.Append(EndDate);
            sb.Append("~");
            sb.Append(EventType);
            sb.Append("~");
            // Append preferred language
            sb.Append(prefLang);
            sb.Append("~");
            sb.Append("<a style=\"cursor:pointer;\" href=\"javascript:void(0);\" onclick=\"OpenSubscriptionDetailsPopup('V','" + Subscription.RegistryURN + "' );\" name=\"lang_View\"></a> | ");
            sb.Append("<a style=\"cursor:pointer;\" href=\"javascript:void(0);\" onclick=\"OpenSubscriptionDetailsPopup('U','" + Subscription.RegistryURN + "');\" name=\"lang_Edit\"></a> | ");
            sb.Append("<a style=\"cursor:pointer;\" href=\"javascript:void(0);\" onclick=\"OpenSubscriptionDetailsPopup('D','" + Subscription.RegistryURN + "');\" name=\"lang_Delete\"></a>");
            sb.Append(Constants.Delimiters.PivotRowDelimiter);
        }

        sb.Remove(sb.Length - 1, 1);
        RetVal = sb.ToString();
        return RetVal;
    }