Beispiel #1
0
 public void DeletePlanAircraft(PlanAircraftDTO dto)
 {
     if (dto == null)
     {
         throw new ArgumentException("参数为空!");
     }
     PlanAircraft delPlanAircraft = _planAircraftRepository.Get(dto.Id);
     //获取需要删除的对象。
     if (delPlanAircraft != null)
     {
         _planAircraftRepository.Remove(delPlanAircraft); //删除计划飞机。
     }
 }
Beispiel #2
0
        public void ModifyPlanAircraft(PlanAircraftDTO dto)
        {
            AircraftType aircraftType = _aircraftTypeRepository.Get(dto.AircraftTypeId);
            Airlines airlines = _airlinesRepository.Get(dto.AirlinesId);

            //获取需要更新的对象
            PlanAircraft updatePlanAircraft = _planAircraftRepository.Get(dto.Id);

            if (updatePlanAircraft != null)
            {
                //更新主表:
                if (dto.AircraftId != null)
                {
                    Aircraft aircraft = _aircraftRepository.Get(dto.AircraftId);
                    updatePlanAircraft.SetAircraft(dto.AircraftId);
                }
                updatePlanAircraft.SetAircraftType(aircraftType);
                updatePlanAircraft.SetAirlines(airlines);
                updatePlanAircraft.SetLock();
                updatePlanAircraft.SetOwn();
                updatePlanAircraft.SetManageStatus((ManageStatus) dto.Status);
            }
            _planAircraftRepository.Modify(updatePlanAircraft);
        }
Beispiel #3
0
        public void InsertPlanAircraft(PlanAircraftDTO dto)
        {
            AircraftType aircraftType = _aircraftTypeRepository.Get(dto.AircraftTypeId);
            Airlines airlines = _airlinesRepository.Get(dto.AirlinesId);

            //创建计划飞机
            PlanAircraft newPlanAircraft = PlanAircraftFactory.CreatePlanAircraft();
            newPlanAircraft.ChangeCurrentIdentity(dto.Id);
            newPlanAircraft.SetAircraftType(aircraftType);
            newPlanAircraft.SetAirlines(airlines);
            newPlanAircraft.SetLock();
            newPlanAircraft.SetOwn();
            newPlanAircraft.SetManageStatus(ManageStatus.计划);

            _planAircraftRepository.Add(newPlanAircraft);
        }