예제 #1
0
            private string GenerateInvoiceReport()
            {
                IProgramSelector selector = null;

                if (_memory.TryGet("ICIES", out CustomerInfoEnteredSignal info))
                {
                    var individualInfo = info as IndividualCustomerInfoEnteredSignal;

                    selector = _invoiceBuilder
                               .CreateForIndividual()
                               .WithName(individualInfo.FirstName, individualInfo.LastName);
                }
                else if (_memory.TryGet("CCIES", out info))
                {
                    var companyInfo = info as CompanyCustomerInfoEnteredSignal;

                    selector = _invoiceBuilder
                               .CreateForCompany()
                               .WithName(companyInfo.CompanyName);
                }

                if (selector != null)
                {
                    if (_memory.TryGet("WPSS", out WashProgramSelectedSignal _signal))
                    {
                        return(selector
                               .Select(_signal.Program)
                               .Choose(info.PreferredCurrency)
                               .Calculate()
                               .Build());
                    }
                }

                return(string.Empty);
            }