コード例 #1
0
        private void submitLRAP1Button_Click(object sender, RoutedEventArgs e)
        {
            var submissionService = new Lrap1SubmissionService(
                new MessageSender(App.Bus),
                new CommandInvoker(
                    new SubmissionDataService(
                        new Lrap1SubmissionRepository(),
                        new Lrap1AttachmentRepository())));

            var attachments = new List<Lrap1Attachment>
            {
                new Lrap1Attachment() {Payload = File.ReadAllText("./TestXMLData/Attachment Service Test 1 XmlRequest.xml")},
                new Lrap1Attachment() {Payload = File.ReadAllText("./TestXMLData/Attachment Service Test 1 XmlRequest.xml")}
            };

            var package = new Lrap1Package()
            {
                Payload = File.ReadAllText("./TestXMLData/eDRS Test 4 XmlRequest.xml"),
                Attachments = attachments
            };

            var result = submissionService.Submit("LRUser001","BGPassword001",package);
            applicationIdTextBox.Text = result.Command.ApplicationId;

            MessageBox.Show(string.Format("Package Submitted{0}ApplicationId: {1}", Environment.NewLine ,result.ToString()), "Success", MessageBoxButton.OK);
        }
コード例 #2
0
        public SubmitLrap1Result Submit(string username, string password, Lrap1Package lrap1Package)
        {
            var applicationId = Guid.NewGuid().ToString();

            var saveResult = _commandInvoker.Execute<CreateLrap1SubmissionCommand, CreateLrap1SubmissionQueryResult>(new CreateLrap1SubmissionCommand()
            {
                ApplicationId = applicationId,
                Username = username,
                Payload = lrap1Package.Payload
            });

            var saveAttachmentResult = _commandInvoker.Execute<CreateLrap1AttachmentCommand, CreateLrap1AttachmentQueryResult>(new CreateLrap1AttachmentCommand()
            {
                AttachmentId = Guid.NewGuid().ToString(),
                ApplicationId = saveResult.Command.ApplicationId,
                Username = username,
                Payload = lrap1Package.Attachments[0].Payload
            });

            var sendResult = _messageSender.Send(new SubmitLrap1Command()
            {
                ApplicationId = saveResult.Command.ApplicationId,
                Username = username,
                Password = password,
                Payload = lrap1Package.Payload
            });

            foreach (var attachment in lrap1Package.Attachments)
            {
                _messageSender.Send(new SubmitLrap1AttachmentCommand()
                {
                    AttachmentId = saveAttachmentResult.Command.AttachmentId,
                    ApplicationId = saveResult.Command.ApplicationId,
                    Username = username,
                    Password = password,
                    Payload = attachment.Payload
                });
            }

            return sendResult;
        }
コード例 #3
0
        public SubmitLrap1Result Submit(string username, string password, Lrap1Package lrap1Package)
        {
            var applicationId = Guid.NewGuid().ToString();

            var saveResult = _commandInvoker.Execute <CreateLrap1SubmissionCommand, CreateLrap1SubmissionQueryResult>(new CreateLrap1SubmissionCommand()
            {
                ApplicationId = applicationId,
                Username      = username,
                Payload       = lrap1Package.Payload
            });

            var saveAttachmentResult = _commandInvoker.Execute <CreateLrap1AttachmentCommand, CreateLrap1AttachmentQueryResult>(new CreateLrap1AttachmentCommand()
            {
                AttachmentId  = Guid.NewGuid().ToString(),
                ApplicationId = saveResult.Command.ApplicationId,
                Username      = username,
                Payload       = lrap1Package.Attachments[0].Payload
            });

            var sendResult = _messageSender.Send(new SubmitLrap1Command()
            {
                ApplicationId = saveResult.Command.ApplicationId,
                Username      = username,
                Password      = password,
                Payload       = lrap1Package.Payload
            });

            foreach (var attachment in lrap1Package.Attachments)
            {
                _messageSender.Send(new SubmitLrap1AttachmentCommand()
                {
                    AttachmentId  = saveAttachmentResult.Command.AttachmentId,
                    ApplicationId = saveResult.Command.ApplicationId,
                    Username      = username,
                    Password      = password,
                    Payload       = attachment.Payload
                });
            }

            return(sendResult);
        }