示例#1
0
 public void DeletePlanEngine(PlanEngineDTO dto)
 {
     if (dto == null)
     {
         throw new ArgumentException("参数为空!");
     }
     PlanEngine delPlanEngine = _planEngineRepository.Get(dto.Id);
     //获取需要删除的对象。
     if (delPlanEngine != null)
     {
         _planEngineRepository.Remove(delPlanEngine); //删除计划发动机。
     }
 }
示例#2
0
        public void ModifyPlanEngine(PlanEngineDTO dto)
        {
            EngineType engineType = _engineTypeRepository.Get(dto.EngineTypeId);
            Airlines airlines = _airlinesRepository.Get(dto.AirlinesId);

            //获取需要更新的对象
            PlanEngine updatePlanEngine = _planEngineRepository.Get(dto.Id);

            if (updatePlanEngine != null)
            {
                //更新主表:
                if (dto.EngineId != null)
                {
                    Engine engine = _engineRepository.Get(dto.EngineId);
                    updatePlanEngine.SetEngine(engine);
                }
                updatePlanEngine.SetEngineType(engineType);
                updatePlanEngine.SetAirlines(airlines);
            }
            _planEngineRepository.Modify(updatePlanEngine);
        }
示例#3
0
        public void InsertPlanEngine(PlanEngineDTO dto)
        {
            EngineType engineType = _engineTypeRepository.Get(dto.EngineTypeId);
            Airlines airlines = _airlinesRepository.Get(dto.AirlinesId);

            //创建计划发动机
            PlanEngine newPlanEngine = PlanEngineFactory.CreatePlanEngine();
            newPlanEngine.ChangeCurrentIdentity(dto.Id);
            newPlanEngine.SetEngineType(engineType);
            newPlanEngine.SetAirlines(airlines);

            _planEngineRepository.Add(newPlanEngine);
        }