예제 #1
0
        /**
         * Create Program Details Broadcast.
         * XML Message sent to the Hub broadcasting the details of the new cannabis licence issued.
         * The purpose is to broadcast licence details to partners subscribed to the Hub
         */
        public string CreateXML(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            if (licence == null)
            {
                throw new Exception("The licence can not be null");
            }
            else if (licence.AdoxioEstablishment == null)
            {
                throw new Exception("The licence must have an Establishment");
            }
            else if (licence.AdoxioLicencee == null)
            {
                throw new Exception("The licence must have an AdoxioLicencee");
            }
            var programAccountDetailsBroadcast = new SBNProgramAccountDetailsBroadcast1();

            programAccountDetailsBroadcast.header = GetProgramAccountDetailsBroadcastHeader(licence);
            programAccountDetailsBroadcast.body   = GetProgramAccountDetailsBroadcastBody(licence);

            var serializer = new XmlSerializer(typeof(SBNProgramAccountDetailsBroadcast1));

            using (StringWriter textWriter = new StringWriter())
            {
                serializer.Serialize(textWriter, programAccountDetailsBroadcast);
                return(textWriter.ToString());
            }
        }
예제 #2
0
        /**
         * Create Program Details Broadcast.
         * XML Message sent to the Hub broadcasting the details of the new cannabis licence issued.
         * The purpose is to broadcast licence details to partners subscribed to the Hub
         */
        public void CreateXML()
        {
            var programAccountDetailsBroadcast = new SBNProgramAccountDetailsBroadcast1();

            programAccountDetailsBroadcast.header = GetProgramAccountDetailsBroadcastHeader();
            programAccountDetailsBroadcast.body   = GetProgramAccountDetailsBroadcastBody();

            var serializer = new XmlSerializer(typeof(SBNProgramAccountDetailsBroadcast1));

            using (var stream = new StreamWriter("C:\\delete\\Test_ProgramAccountDetailsBroadcast.xml"))
                serializer.Serialize(stream, programAccountDetailsBroadcast);
        }