Exemple #1
0
        public void Apply(IReadModelContext context, IDomainEvent <PayoutAggregate, PayoutId, EmployeePaidEvent> domainEvent)
        {
            AggregateId = domainEvent.AggregateIdentity.Value;
            var e      = domainEvent.AggregateEvent;
            var payout = new PayoutDto()
            {
                PayoutId   = domainEvent.AggregateIdentity.GetGuid(),
                InvoiceId  = e.InvoiceId,
                EmployeeId = e.EmployeeId,
                Amount     = e.Amount,
                Date       = e.PayoutDate
            };

            Json = JsonConvert.SerializeObject(payout);
        }
        private void ParsePayoutFields(string[] content, int index, OptionDto option)
        {
            // 2,1;2;3;4,3,3
            // 11 - 13, 20 - 22
            // 14 - 16 , 23 - 25
            if (string.IsNullOrWhiteSpace(content[index]))
            {
                return;
            }

            PayoutDto payout = new PayoutDto();

            payout.PayoutNumber = int.Parse(content[index]);
            payout.PayoutTypeId = string.IsNullOrWhiteSpace(content[index + 1]) ? null : (int?)int.Parse(content[index + 1]);

            payout.FieldsContent = content[index + 2].Trim();

            option.Payouts.Add(payout);
        }