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; }
/// <summary> /// Sets header details to sdmx structure header object and return object /// </summary> /// <param name="ObjHeaderDet">Class containg fields for header detail</param> /// <returns>Structure header object with fields initlized</returns> private SDMXApi_2_0.Message.HeaderType GetSdmxMessageHeaderStructure(HeaderDetailsTemplate ObjHeaderDet) { SDMXApi_2_0.Message.HeaderType ObjHeader = null; SDMXApi_2_0.Message.PartyType SenderParty; SDMXApi_2_0.Message.PartyType RecieverParty; SDMXApi_2_0.Message.ContactType SenderContact; SDMXApi_2_0.Message.ContactType ReceiverContact; string LanguageCode = string.Empty; try { SenderParty = new SDMXApi_2_0.Message.PartyType(); RecieverParty = new SDMXApi_2_0.Message.PartyType(); SenderParty.Contact = new List<SDMXApi_2_0.Message.ContactType>(); RecieverParty.Contact = new List<SDMXApi_2_0.Message.ContactType>(); LanguageCode = ObjHeaderDet.LanguageCode; #region "--Set sender fields value--" // Set sender Id SenderParty.id = ObjHeaderDet.SenderId; // Set sender name SenderParty.Name = SetHeaderFilds(LanguageCode, ObjHeaderDet.SenderName); // Set sender contact Name SenderContact = new SDMXApi_2_0.Message.ContactType(); SenderContact.Name = SetHeaderFilds(LanguageCode, ObjHeaderDet.SenderContactName); // Set reciever contact role SenderContact.Role = SetHeaderFilds(LanguageCode, ObjHeaderDet.SenderRole); // Set sender contact department SenderContact.Department = SetHeaderFilds(LanguageCode, ObjHeaderDet.SenderDepartment); // Set value of sender item fileds, telephone,emailid and fax SenderContact.Items = new string[] { ObjHeaderDet.SenderTelephone, ObjHeaderDet.SenderEmail, ObjHeaderDet.SenderFax }; SenderContact.ItemsElementName = new SDMXApi_2_0.Message.ContactChoiceType[] { SDMXApi_2_0.Message.ContactChoiceType.Telephone, SDMXApi_2_0.Message.ContactChoiceType.Email, SDMXApi_2_0.Message.ContactChoiceType.Fax }; SenderParty.Contact.Add(SenderContact); #endregion #region "--set Reciever fields value--" // Set Reciever Id RecieverParty.id = ObjHeaderDet.RecieverId; // Set reciever name RecieverParty.Name = SetHeaderFilds(LanguageCode, ObjHeaderDet.RecieverName); ReceiverContact = new SDMXApi_2_0.Message.ContactType(); // Set reciever contact name ReceiverContact.Name = SetHeaderFilds(LanguageCode, ObjHeaderDet.RecieverContactName); // Set reciever contact role ReceiverContact.Role = SetHeaderFilds(LanguageCode, ObjHeaderDet.RecieverRole); // Set reciever contact department ReceiverContact.Department = SetHeaderFilds(LanguageCode, ObjHeaderDet.RecieverDepartment); // Set value of sender item fileds, telephone,emailid and fax ReceiverContact.Items = new string[] { ObjHeaderDet.RecieverTelephone, ObjHeaderDet.RecieverEmail, ObjHeaderDet.RecieverFax }; ReceiverContact.ItemsElementName = new SDMXApi_2_0.Message.ContactChoiceType[] { SDMXApi_2_0.Message.ContactChoiceType.Telephone, SDMXApi_2_0.Message.ContactChoiceType.Email, SDMXApi_2_0.Message.ContactChoiceType.Fax }; RecieverParty.Contact.Add(ReceiverContact); #endregion //Init line header object ObjHeader = new SDMXApi_2_0.Message.HeaderType(); // Add SenderParty object to headers sender property ObjHeader.Sender.Add(SenderParty); // Add RecieverParty object to headers reciever property ObjHeader.Receiver.Add(RecieverParty); // Set id of header ObjHeader.ID = ObjHeaderDet.HeaderId; ObjHeader.Name = SetHeaderFilds(LanguageCode, ObjHeaderDet.HeaderDsdName); ObjHeader.Prepared = ObjHeaderDet.Prepared; } catch (Exception Ex) { throw Ex; } return ObjHeader; }