예제 #1
0
        public async Task <AssignmentDto> ExecuteQueryAsync(GetAssignmentQuery query, CancellationToken cancellationToken)
        {
            var assignmentId = AssignmentId.With(query.AssignmentId);
            var readModel    = await _readStore.GetAsync(assignmentId.Value, cancellationToken).ConfigureAwait(false);

            return(readModel.ReadModel.ToAssignmentDto());
        }
        protected void slkButtonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                SaveGradingList(SaveAction.SaveOnly);

                string url = SlkUtilities.UrlCombine(SPWeb.ServerRelativeUrl, Constants.SlkUrlPath, "AssignmentProperties.aspx");
                url = String.Format(CultureInfo.InvariantCulture, "{0}?AssignmentId={1}", url, AssignmentId.ToString());

                Response.Redirect(url, true);
            }
            catch (ThreadAbortException)
            {
                // Calling Response.Redirect throws a ThreadAbortException which will
                // flag an error in the next step if we don't do this.
                throw;
            }
            catch (Exception ex)
            {
                pageHasErrors = true;
                errorBanner.AddException(SlkStore, ex);
            }
        }
예제 #3
0
        public async Task HandleAsync(IReadOnlyCollection <IDomainEvent> domainEvents, CancellationToken cancellationToken)
        {
            var domainEvent = domainEvents.Single();

            switch (domainEvent.EventType.FullName)
            {
            case "Invoice.Core.DomainModel.InvoiceCreatedEvent":
            {
                // Initiate process for this invoice
                var id        = domainEvent.GetIdentity();
                var invoiceId = Guid.Parse(id.Value.Replace("invoice-", ""));
                await _assignmentService.CreateAssignment(new CreateAssignmentCommand(AssignmentId.New, invoiceId));

                break;
            }

            case "Invoice.Core.DomainModel.InvoiceSentEvent":
            {
                var id        = domainEvent.GetIdentity();
                var invoiceId = Guid.Parse(id.Value.Replace("invoice-", ""));

                var assignment = await _queryProcessor.ProcessAsync(new GetAssignmentByInvoiceIdQuery(invoiceId), CancellationToken.None);

                await _assignmentService.SetWaitingForPayment(new SetWaitingForPaymentCommand(AssignmentId.With(assignment.AssignmentId), assignment.InvoiceId));

                await _paymentService.SetWaitingForPayment(new WaitingForPaymentRequest()
                    {
                        InvoiceId = invoiceId
                    });

                var assignmentInvoice = await _queryProcessor.ProcessAsync(new GetAssignmentInvoiceQuery(invoiceId), CancellationToken.None);

                if (assignmentInvoice.PayInAdvance)
                {
                    await _payoutService.PayEmployee(new PayEmployeeRequest { InvoiceId = invoiceId });
                }

                break;
            }

            case "Payment.Core.DomainModel.PaymentReceivedEvent":
            {
                dynamic paymentReceived   = domainEvent.GetAggregateEvent();
                Guid    invoiceId         = paymentReceived.InvoiceId;
                var     assignmentInvoice = await _queryProcessor.ProcessAsync(new GetAssignmentInvoiceQuery(invoiceId), CancellationToken.None);

                if (!assignmentInvoice.PayInAdvance)
                {
                    await _payoutService.PayEmployee(new PayEmployeeRequest { InvoiceId = invoiceId });
                }
                break;
            }

            case "Payment.Core.DomainModel.PaymentDueEvent":
            {
                dynamic paymentDue = domainEvent.GetAggregateEvent();
                Guid    invoiceId  = paymentDue.InvoiceId;
                await _invoiceService.SendReminder(invoiceId);

                break;
            }

            case "Payout.Core.DomainModel.EmployeePaidEvent":
            {
                // close assignment
                dynamic employeePaid = domainEvent.GetAggregateEvent();
                Guid    invoiceId    = employeePaid.InvoiceId;
                var     assignment   = await _queryProcessor.ProcessAsync(new GetAssignmentByInvoiceIdQuery(invoiceId), CancellationToken.None);

                await _assignmentService.CloseAssignment(new CloseAssignmentCommand(AssignmentId.With(assignment.AssignmentId)));

                break;
            }
            }
        }
예제 #4
0
 public AssignmentGridRowViewModel(WorkspaceService workspace, AssignmentId assignmentId)
 {
     Workspace    = workspace;
     AssignmentId = assignmentId;
 }
예제 #5
0
파일: UnitTest1.cs 프로젝트: cykelbud/lrms
 public async Task CreateAssignments4()
 {
     var invoiceId    = new Guid("743de7e2-7379-48f0-b113-1f3879bacb80");
     var assignmentId = AssignmentId.With(new Guid("d8f2b0ea-6676-4afe-ab34-b8c41639d7e9"));
     await _assignmentService.SetWaitingForPayment(new SetWaitingForPaymentCommand(assignmentId, invoiceId)).ConfigureAwait(false);
 }
예제 #6
0
파일: UnitTest1.cs 프로젝트: cykelbud/lrms
        public async Task CreateAssignments2()
        {
            var invoiceId    = Guid.NewGuid();
            var assignmentId = AssignmentId.New;
            await _assignmentService.CreateAssignment(new CreateAssignmentCommand(assignmentId, invoiceId));

            var assignment = await _queryProcessor.ProcessAsync(new GetAssignmentByInvoiceIdQuery(invoiceId), CancellationToken.None).ConfigureAwait(false);

            Assert.Equal(assignmentId.GetGuid(), assignment.AssignmentId);

            await _assignmentService.SetWaitingForPayment(new SetWaitingForPaymentCommand(AssignmentId.With(assignment.AssignmentId), assignment.InvoiceId)).ConfigureAwait(false);
        }