예제 #1
0
 public void DeleteCaacProgramming(CaacProgrammingDTO dto)
 {
     if (dto == null)
     {
         throw new ArgumentException("参数为空!");
     }
     CaacProgramming delCaacProgramming = _caacProgrammingRepository.Get(dto.Id);
     //获取需要删除的对象。
     if (delCaacProgramming != null)
     {
         _caacProgrammingRepository.DeleteCaacProgramming(delCaacProgramming); //删除民航局五年规划。
     }
 }
예제 #2
0
        public void ModifyCaacProgramming(CaacProgrammingDTO dto)
        {
            IssuedUnit issuedUnit = _issuedUnitRepository.Get(dto.IssuedUnitId); //获取发文单位
            Programming programming = _programmingRepository.Get(dto.ProgrammingId); //获取规划期间

            //获取需要更新的对象
            CaacProgramming updateCaacProgramming = _caacProgrammingRepository.Get(dto.Id);

            if (updateCaacProgramming != null)
            {
                //更新主表:
                updateCaacProgramming.SetDocument(dto.DocumentId, dto.DocName);
                updateCaacProgramming.SetIssuedDate(dto.IssuedDate);
                updateCaacProgramming.SetIssuedUnit(issuedUnit);
                updateCaacProgramming.SetName(dto.Name);
                updateCaacProgramming.SetNote(dto.Note);
                updateCaacProgramming.SetProgramming(programming);
                updateCaacProgramming.SetDocNumber(dto.DocNumber);

                //更新规划行:
                List<CaacProgrammingLineDTO> dtoCaacProgrammingLines = dto.CaacProgrammingLines;
                ICollection<CaacProgrammingLine> caacProgrammingLines = updateCaacProgramming.CaacProgrammingLines;
                DataHelper.DetailHandle(dtoCaacProgrammingLines.ToArray(),
                    caacProgrammingLines.ToArray(),
                    c => c.Id, p => p.Id,
                    i => InsertCaacProgrammingLine(updateCaacProgramming, i),
                    UpdateCaacProgrammingLine,
                    d => _caacProgrammingRepository.RemoveCaacProgrammingLine(d));
            }
            _caacProgrammingRepository.Modify(updateCaacProgramming);
        }
예제 #3
0
        public void InsertCaacProgramming(CaacProgrammingDTO dto)
        {
            IssuedUnit issuedUnit = _issuedUnitRepository.Get(dto.IssuedUnitId); //获取发文单位
            Programming programming = _programmingRepository.Get(dto.ProgrammingId); //获取规划期间

            //创建民航局五年规划
            CaacProgramming newCaacProgramming = CaacProgrammingFactory.CreateCaacProgramming();
            newCaacProgramming.SetDocument(dto.DocumentId, dto.DocName);
            newCaacProgramming.SetIssuedDate(dto.IssuedDate);
            newCaacProgramming.SetIssuedUnit(issuedUnit);
            newCaacProgramming.SetName(dto.Name);
            newCaacProgramming.SetNote(dto.Note);
            newCaacProgramming.SetProgramming(programming);
            newCaacProgramming.SetDocNumber(dto.DocNumber);

            //添加规划行
            dto.CaacProgrammingLines.ToList().ForEach(line => InsertCaacProgrammingLine(newCaacProgramming, line));

            _caacProgrammingRepository.Add(newCaacProgramming);
        }