public void DeleteProgrammingFile(ProgrammingFileDTO dto)
 {
     if (dto == null)
     {
         throw new ArgumentException("参数为空!");
     }
     ProgrammingFile delProgrammingFile = _programmingFileRepository.Get(dto.Id);
     //获取需要删除的对象。
     if (delProgrammingFile != null)
     {
         _programmingFileRepository.Remove(delProgrammingFile); //删除规划文档。
     }
 }
        public void InsertProgrammingFile(ProgrammingFileDTO dto)
        {
            //获取发文单位
            IssuedUnit issuedUnit = _issuedUnitRepository.Get(dto.IssuedUnitId);
            Programming programming = _programmingRepository.Get(dto.ProgrammingId);

            //创建规划文档
            ProgrammingFile newProgrammingFile = ProgrammingFileFactory.CreateProgrammingFile(issuedUnit, dto.IssuedDate,
                dto.DocNumber,
                dto.DocumentId, dto.DocName, programming, dto.Type);

            _programmingFileRepository.Add(newProgrammingFile);
        }
        public void ModifyProgrammingFile(ProgrammingFileDTO dto)
        {
            //获取供应商
            IssuedUnit issuedUnit = _issuedUnitRepository.Get(dto.IssuedUnitId);
            Programming programming = _programmingRepository.Get(dto.ProgrammingId);

            //获取需要更新的对象
            ProgrammingFile updateProgrammingFile = _programmingFileRepository.Get(dto.Id);

            if (updateProgrammingFile != null)
            {
                //更新主表:
                updateProgrammingFile.SetDocNumber(dto.DocNumber);
                updateProgrammingFile.SetDocument(dto.DocumentId, dto.DocName);
                updateProgrammingFile.SetIssuedDate(dto.IssuedDate);
                updateProgrammingFile.SetIssuedUnit(issuedUnit);
                updateProgrammingFile.SetProgramming(programming);
            }
            _programmingFileRepository.Modify(updateProgrammingFile);
        }