Ejemplo n.º 1
0
        public void AddCostout(ProjectCostOutDto dto)
        {
            if (dto.ProjectId == 0)
            {
                throw new BingoX.LogicException("項目 爲空");
            }
            if (string.IsNullOrEmpty(dto.Title))
            {
                throw new BingoX.LogicException("摘要 爲空");
            }
            if (string.IsNullOrEmpty(dto.CostoutDate))
            {
                throw new BingoX.LogicException("日期 爲空");
            }
            var project = repository.GetStandingbook(dto.ProjectId);

            if (project == null)
            {
                throw new BingoX.LogicException("項目 不存在");
            }
            decimal projectExpendAmount = repository.GetProjectExpendAmount(dto.ProjectId);

            ProjectCostOut entity = dto.ProjectedAs <ProjectCostOut>();

            entity.Created(this);
            repository.AddCostout(entity);
            repository.UnitOfWork.Commit();
        }