Пример #1
0
        public void DeleteInstallController(InstallControllerDTO dto)
        {
            InstallController delInstallController = _installControllerRepository.Get(dto.Id); //获取需要删除的对象。

            _installControllerRepository.DeleteInstallController(delInstallController); //删除InstallController。
        }
Пример #2
0
        public void InsertInstallController(InstallControllerDTO dto)
        {
            Item item = _itemRepository.Get(dto.ItemId);
            PnReg pnReg = _pnRegRepository.Get(dto.PnRegId);
            AircraftType aircraftType = _aircraftTypeRepository.Get(dto.AircraftTypeId);

            InstallController newInstallController = InstallControllerFactory.CreateInstallController(dto.StartDate,
                dto.EndDate, item, pnReg, aircraftType);

            //添加依赖项
            dto.Dependencies.ToList().ForEach(dependency => InsertDependency(newInstallController, dependency));

            _installControllerRepository.Add(newInstallController);
        }
Пример #3
0
        public void ModifyInstallController(InstallControllerDTO dto)
        {
            Item item = _itemRepository.Get(dto.ItemId);
            PnReg pnReg = _pnRegRepository.Get(dto.PnRegId);
            AircraftType aircraftType = _aircraftTypeRepository.Get(dto.AircraftTypeId);

            InstallController updateInstallController = _installControllerRepository.Get(dto.Id); //获取需要更新的对象。

            //更新主表。
            updateInstallController.SetAircraftType(aircraftType);
            updateInstallController.SetEndDate(dto.EndDate);
            updateInstallController.SetItem(item);
            updateInstallController.SetPnReg(pnReg);
            updateInstallController.SetStartDate(dto.StartDate);

            //更新依赖项集合:
            List<DependencyDTO> dtoDependencies = dto.Dependencies;
            ICollection<Dependency> dependencies = updateInstallController.Dependencies;
            DataHelper.DetailHandle(dtoDependencies.ToArray(),
                dependencies.ToArray(),
                c => c.Id, p => p.Id,
                i => InsertDependency(updateInstallController, i),
                UpdateDependency,
                d => _installControllerRepository.RemoveDependency(d));

            _installControllerRepository.Modify(updateInstallController);
        }