private static void SendMessage() { var rnd = new Random(); var gender = new string[] { "F", "M" }[rnd.Next(0, 2)]; var address = AddressGenerator.Generate(); var personEUCCID = new EUCCID() { ChristianName = NameGenerator.GenerateFirstName(gender), FamilyName = NameGenerator.GenerateSurname(), EuccidNo = EuccidGenerator.Generate(new DateTime(1987, 4, 23)), Gender = gender, StreetAndHouseNo = string.Format($"{address.Street} {address.HouseNo}"), ApartmentNo = address.ApartmentNo, PostalCode = address.PostalCode, City = address.City, CountryOfResidence = "Denmark" }; Console.WriteLine("---------- EUCCID input: ----------"); personEUCCID.PrintAll(); // translate into CDM format var personCDM = EuccidTranslator.EuccidToCdm(personEUCCID); Console.WriteLine("\n---------- Translated into CDM: ----------"); personCDM.PrintAll(); // build message var message = new Message() { Body = personCDM, Label = personCDM.ToString() }; // build channel var path = @".\Private$\EUCCID_to_CPR"; if (!MessageQueue.Exists(path)) { MessageQueue.Create(path); } var euccidToCprChannel = new MessageQueue(path) { Label = "EU-CCID to CPR" }; // send euccidToCprChannel.Send(message); Console.WriteLine("\n---------- Message sent. ----------\n\n"); }
private static void SendMessage() { var rnd = new Random(); var gender = new string[] { "F", "M" }[rnd.Next(0, 2)]; var address = AddressGenerator.Generate(); var address1 = string.Format($"{address.Street} {address.HouseNo}"); if (!" ".Contains(address.ApartmentNo)) { address1 = string.Format($"{address1}, {address.ApartmentNo}"); } var personCPR = new CPR() { CprNo = CprGenerator.Generate(gender), FirstName = NameGenerator.GenerateFirstName(gender), Surname = NameGenerator.GenerateSurname(), Address1 = address1, Address2 = address.Address2, PostalCode = address.PostalCode, City = address.City, MaritalStatus = "Ugift", Spouse = "", Children = new List <string>(), Mother = EuccidGenerator.Generate(new DateTime(1987, 11, 23)), Father = EuccidGenerator.Generate(new DateTime(1984, 3, 18)), DoctorCVR = "39227491", EuccidNo = EuccidGenerator.Generate(), Gender = gender, }; Console.WriteLine("---------- CPR input: ----------"); personCPR.PrintAll(); // translate into CDM format var personCDM = CprTranslator.CprToCdm(personCPR); Console.WriteLine("\n---------- Translated into CDM: ----------"); personCDM.PrintAll(); // build message var message = new Message() { Body = personCDM, Label = personCDM.ToString() }; // build channel var path = @".\Private$\CPR_to_EUCCID"; if (!MessageQueue.Exists(path)) { MessageQueue.Create(path); } var cprToEuccidChannel = new MessageQueue(path) { Label = "CPR to EU-CCID" }; // send cprToEuccidChannel.Send(message); Console.WriteLine("\n---------- Message sent. ----------\n\n"); }