Esempio n. 1
0
        public void EditCostin(long id, ProjectCostInDto dto)
        {
            if (dto.ProjectId == 0)
            {
                throw new LogicException("項目 爲空");
            }
            if (string.IsNullOrEmpty(dto.Title))
            {
                throw new LogicException("摘要 爲空");
            }

            ProjectCostIn entity = repository.GetCostIn(id);

            dto.ProjectedAs <ProjectCostIn>(entity);
            //         entity.CopyFromGroup(dto.ProjectedAs<ProjectCostIn>(), "Info");
            repository.UpdateCostIn(entity);
            repository.UnitOfWork.Commit();
        }
Esempio n. 2
0
        public void AddCostin(ProjectCostInDto dto)
        {
            if (string.IsNullOrEmpty(dto.Title))
            {
                throw new LogicException("摘要 爲空");
            }
            if (dto.ProjectId == 0)
            {
                throw new LogicException("項目 爲空");
            }

            var project = repository.GetProjectMaster(dto.ProjectId);

            if (project == null)
            {
                throw new LogicException("項目 不存在");
            }
            ProjectCostIn entity = dto.ProjectedAs <ProjectCostIn>();

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