internal static SDMXApi_2_0.Message.HeaderType Get_Appropriate_Header() { SDMXApi_2_0.Message.HeaderType RetVal; SDMXApi_2_0.Common.TextType ObjectValue; SDMXApi_2_0.Message.PartyType SenderParty; SDMXApi_2_0.Message.PartyType ReceiverParty; SDMXApi_2_0.Message.ContactType SenderContact; SDMXApi_2_0.Message.ContactType ReceiverContact; RetVal = new SDMXApi_2_0.Message.HeaderType(); RetVal.ID = DevInfo.Lib.DI_LibSDMX.Constants.Header.Id; RetVal.Name = new List<SDMXApi_2_0.Common.TextType>(); RetVal.Test = true; ObjectValue = new SDMXApi_2_0.Common.TextType(); ObjectValue.lang = "en"; ObjectValue.Value = "test"; RetVal.Name.Add(ObjectValue); RetVal.Prepared = DateTime.Now.ToString(SDMXLibrary.Constants.DateFormat) + SDMXObjectModel.Constants.DateTimeSeparator + DateTime.Now.ToString(SDMXLibrary.Constants.TimeFormat); // Sender RetVal.Sender = new List<SDMXApi_2_0.Message.PartyType>(); SenderParty = new SDMXApi_2_0.Message.PartyType(); SenderParty.id = DevInfo.Lib.DI_LibSDMX.Constants.Header.SenderId; SenderParty.Name = new List<SDMXApi_2_0.Common.TextType>(); ObjectValue = new SDMXApi_2_0.Common.TextType(); ObjectValue.lang = "en"; ObjectValue.Value = DevInfo.Lib.DI_LibSDMX.Constants.Header.SenderName; SenderParty.Name.Add(ObjectValue); // Sender Contact SenderParty.Contact = new List<SDMXApi_2_0.Message.ContactType>(); SenderContact = new SDMXApi_2_0.Message.ContactType(); SenderContact.Name = new List<SDMXApi_2_0.Common.TextType>(); ObjectValue = new SDMXApi_2_0.Common.TextType(); ObjectValue.lang = "en"; ObjectValue.Value = DevInfo.Lib.DI_LibSDMX.Constants.Header.SenderName; SenderContact.Name.Add(ObjectValue); SenderContact.Department = new List<SDMXApi_2_0.Common.TextType>(); ObjectValue = new SDMXApi_2_0.Common.TextType(); ObjectValue.lang = "en"; ObjectValue.Value = DevInfo.Lib.DI_LibSDMX.Constants.Header.SenderDepartment; SenderContact.Department.Add(ObjectValue); SenderParty.Contact.Add(SenderContact); RetVal.Sender.Add(SenderParty); //Receiver RetVal.Receiver = new List<SDMXApi_2_0.Message.PartyType>(); ReceiverParty = new SDMXApi_2_0.Message.PartyType(); ReceiverParty.id = DevInfo.Lib.DI_LibSDMX.Constants.Header.ReceiverId; ReceiverParty.Name = new List<SDMXApi_2_0.Common.TextType>(); ObjectValue = new SDMXApi_2_0.Common.TextType(); ObjectValue.lang = "en"; ObjectValue.Value = DevInfo.Lib.DI_LibSDMX.Constants.Header.ReceiverName; ReceiverParty.Name.Add(ObjectValue); // Sender Contact ReceiverParty.Contact = new List<SDMXApi_2_0.Message.ContactType>(); ReceiverContact = new SDMXApi_2_0.Message.ContactType(); ReceiverContact.Name = new List<SDMXApi_2_0.Common.TextType>(); ObjectValue = new SDMXApi_2_0.Common.TextType(); ObjectValue.lang = "en"; ObjectValue.Value = DevInfo.Lib.DI_LibSDMX.Constants.Header.ReceiverName; ReceiverContact.Name.Add(ObjectValue); ReceiverContact.Department = new List<SDMXApi_2_0.Common.TextType>(); ObjectValue = new SDMXApi_2_0.Common.TextType(); ObjectValue.lang = "en"; ObjectValue.Value = DevInfo.Lib.DI_LibSDMX.Constants.Header.ReceiverDepartment; ReceiverContact.Department.Add(ObjectValue); ReceiverParty.Contact.Add(ReceiverContact); RetVal.Receiver.Add(ReceiverParty); return RetVal; }
private static void Fill_Reported_Attribute_Value(ReportedAttributeType ReportedAttribute, string IndicatorNId, Dictionary<string, string> DictMetadataMapping, DIConnection DIConnection, DIQueries DIQueries) { string language, Query; string CategoryNId; DataTable DtTable; SDMXApi_2_0.Common.TextType LanguageSpecificValue; if (DictMetadataMapping.ContainsKey(ReportedAttribute.conceptID)) { ReportedAttribute.Value = new List<SDMXApi_2_0.Common.TextType>(); foreach (DataRow LanguageRow in DIConnection.DILanguages(DIQueries.DataPrefix).Rows) { language = LanguageRow[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Language.LanguageCode].ToString(); Query = "SELECT CategoryNId FROM UT_Metadata_Category_" + language + " WHERE CategoryGId = '" + DictMetadataMapping[ReportedAttribute.conceptID].ToString() + "' AND CategoryType = 'I'"; DtTable = DIConnection.ExecuteDataTable(Regex.Replace(Query, "UT_", DIConnection.DIDataSetDefault(), RegexOptions.IgnoreCase)); if (DtTable != null && DtTable.Rows.Count > 0) { CategoryNId = DtTable.Rows[0]["CategoryNId"].ToString(); Query = "SELECT Metadata FROM UT_MetadataReport_" + language + " WHERE Target_NId = " + IndicatorNId + " AND Category_NId = " + CategoryNId; DtTable = DIConnection.ExecuteDataTable(Regex.Replace(Query, "UT_", DIConnection.DIDataSetDefault(), RegexOptions.IgnoreCase)); if (DtTable != null && DtTable.Rows.Count > 0) { LanguageSpecificValue = new SDMXApi_2_0.Common.TextType(); LanguageSpecificValue.lang = language; LanguageSpecificValue.Value = DtTable.Rows[0]["Metadata"].ToString(); ReportedAttribute.Value.Add(LanguageSpecificValue); } } } } }
/// <summary> /// This method creates object for header elements from input paramaters /// </summary> /// <param name="Lang">language of element</param> /// <param name="FiledValue">value of element</param> /// <returns>list containing TextType object</returns> private List<SDMXApi_2_0.Common.TextType> SetHeaderFilds(string Lang, string FiledValue) { SDMXApi_2_0.Common.TextType ObjTextType; List<SDMXApi_2_0.Common.TextType> ObjListTextType; ObjTextType = new SDMXApi_2_0.Common.TextType(); ObjListTextType = new List<SDMXApi_2_0.Common.TextType>(); ObjTextType.lang = Lang; ObjTextType.Value = FiledValue; ObjListTextType.Add(ObjTextType); return ObjListTextType; }