Beispiel #1
0
        public void DeleteScn(ScnDTO dto)
        {
            if (dto == null)
            {
                throw new ArgumentException("参数为空!");
            }
            Scn delScn = _scnRepository.Get(dto.Id);
            //获取需要删除的对象。

            if (delScn != null)
            {
                _scnRepository.DeleteScn(delScn); //删除Scn。
            }
        }
Beispiel #2
0
        public void DeleteAirBusScn(ScnDTO dto)
        {
            if (dto == null)
            {
                throw new ArgumentException("参数为空!");
            }
            AirBusScn delScn = _airBusScnRepository.Get(dto.Id);
            //获取需要删除的对象。

            if (delScn != null)
            {
                _airBusScnRepository.Remove(delScn); //删除Scn。
            }
        }
Beispiel #3
0
        public void ModifyScn(ScnDTO dto)
        {
            //获取需要更新的对象
            Scn updateScn = _scnRepository.Get(dto.Id);

            if (updateScn != null)
            {
                //更新主表:
                ScnFactory.SetScn(updateScn, dto.Title, dto.Type, dto.CheckDate, dto.CSCNumber, dto.ModNumber,
                    dto.RfcNumber, dto.ValidDate, dto.Cost,
                    dto.ScnNumber, dto.ScnType, dto.ScnStatus, dto.Description, dto.ScnDocName, dto.ScnDocumentId,
                    dto.ReceiveDate,
                    dto.AuditOrganization, dto.Auditor, dto.AuditTime, dto.AuditNotes);
                UpdateApplicableAircrafts(dto.ApplicableAircrafts, updateScn);
                ////更新Scn适用飞机集合:
                //var dtoApplicableAircrafts = dto.ApplicableAircrafts;
                //var applicableAircrafts = updateScn.ApplicableAircrafts;
                //DataHelper.DetailHandle(dtoApplicableAircrafts.ToArray(),
                //    applicableAircrafts.ToArray(),
                //    c => c.Id, p => p.Id,
                //    i => InsertApplicableAircraft(updateScn, i),
                //    UpdateApplicableAircraft,
                //    d => _scnRepository.RemoveApplicableAircraft(d));
            }
            _scnRepository.Modify(updateScn);
        }
Beispiel #4
0
        public void InsertScn(ScnDTO dto)
        {
            //创建SCN
            Scn newScn = ScnFactory.CreateScn();
            ScnFactory.SetScn(newScn, dto.Title, dto.Type, dto.CheckDate, dto.CSCNumber, dto.ModNumber, dto.RfcNumber,
                dto.ValidDate, dto.Cost,
                dto.ScnNumber, dto.ScnType, dto.ScnStatus, dto.Description, dto.ScnDocName, dto.ScnDocumentId,
                dto.ReceiveDate,
                dto.AuditOrganization, dto.Auditor, dto.AuditTime, dto.AuditNotes);

            //添加使用飞机
            dto.ApplicableAircrafts.ToList().ForEach(appliAc => InsertApplicableAircraft(newScn, appliAc));

            _scnRepository.Add(newScn);
        }