예제 #1
0
파일: Income.cs 프로젝트: Sp1n89/AutoDok
 public Income(string name, decimal amount, DateTime date, Wash wash = null)
     : base(name, amount, date)
 {
     Wash = wash;
     if (wash != null)
     {
         WashId = wash.Id;
     }
 }
예제 #2
0
파일: WashBll.cs 프로젝트: Sp1n89/AutoDok
        private void CreateCarpetWash(CreateWashEntity entity)
        {
            if (!entity.Amount.HasValue)
            {
                throw new BusinessLayerException("Carpet wash has no amount.");
            }

            if (!entity.SquareArea.HasValue)
            {
                throw new BusinessLayerException("Carpet wash has no square area.");
            }

            var income = new Income(entity.WashType.Localize(), entity.Amount.Value, entity.Date);
            _operationRepository.Insert(income);

            var wash = new Wash(entity.Date, entity.SquareArea.Value, income);
            _washRepository.Insert(wash);

            income.Wash = wash;
            income.WashId = wash.Id;
            _operationRepository.Update(income);
        }
예제 #3
0
파일: WashBll.cs 프로젝트: Sp1n89/AutoDok
        private void CreateContractedCarWash(CreateWashEntity entity)
        {
            if (!entity.ContractId.HasValue)
            {
                throw new BusinessLayerException("Contracted Car wash has no amount.");
            }

            var contract = _contractRepository.GetById(entity.ContractId.Value);

            if (contract == null)
            {
                throw  new BusinessLayerException("Selected contract does not exist.");
            }

            var wash = new Wash(entity.Date, entity.CarNumber, contract);
            _washRepository.Insert(wash);

            contract.Washes.Add(wash);
            _contractRepository.Update(contract);
        }
예제 #4
0
파일: WashBll.cs 프로젝트: Sp1n89/AutoDok
        private void CreateIndividualCarWash(CreateWashEntity entity)
        {
            if (!entity.Amount.HasValue)
            {
                throw new BusinessLayerException("Individual Car wash has no amount.");
            }

            var income = new Income(entity.WashType.Localize(), entity.Amount.Value, entity.Date);

            var wash = new Wash(entity.Date, entity.CarNumber, income);
            _washRepository.Insert(wash);

            income.Wash = wash;
            income.WashId = wash.Id;
            _operationRepository.Insert(income);
        }