Ejemplo n.º 1
0
        public CalculateCostSplitAndReserveLimitsResult Handle(CalculateCostSplitAndReserveLimitsCommand cmd)
        {
            using (var tx = new TransactionScope())
            {
                ClearPreviousConsumptionForCase(cmd);

                var costSplitServices = SplitCostForServices(cmd);

                tx.Complete();

                return(CalculateCostSplitAndReserveLimitsResult.For(costSplitServices));
            }
        }
Ejemplo n.º 2
0
        private List <CaseServiceCostSplit> SplitCostForServices(CalculateCostSplitAndReserveLimitsCommand cmd)
        {
            var costSplitServices = BuildServicesList(cmd.Case);

            foreach (var caseService in costSplitServices)
            {
                var costSplitPolicies = _costSplitPoliciesFactory.CreatePoliciesFor
                                        (
                    caseService.PolicyId,
                    caseService.Date
                                        );


                caseService.SplitCost(costSplitPolicies);

                _dataStore.CommitChanges();
            }

            return(costSplitServices);
        }
Ejemplo n.º 3
0
 private void ClearPreviousConsumptionForCase(CalculateCostSplitAndReserveLimitsCommand cmd)
 {
     //_limitConsumptionContainers.RemoveForCase(cmd.Case.Number);
 }