public void DeletePlanHistory(PlanHistoryDTO dto) { if (dto == null) { throw new ArgumentException("参数为空!"); } PlanHistory delPlanHistory = _planHistoryRepository.Get(dto.Id); //获取需要删除的对象。 if (delPlanHistory != null) { _planHistoryRepository.Remove(delPlanHistory); //删除计划明细。 } }
public void ModifyPlanHistory(PlanHistoryDTO dto) { //获取 ActionCategory actionCategory = _actionCategoryRepository.Get(dto.ActionCategoryId); ActionCategory targetCategory = _actionCategoryRepository.Get(dto.TargetCategoryId); AircraftType aircraftType = _aircraftTypeRepository.Get(dto.AircraftTypeId); Airlines airlines = _airlinesRepository.Get(dto.AirlinesId); Annual annual = _annualRepository.Get(dto.PerformAnnualId); OperationHistory operationHistory = _aircraftRepository.GetPh(dto.RelatedGuid); AircraftBusiness aircraftBusiness = _aircraftRepository.GetAb(dto.RelatedGuid); //获取需要更新的对象 PlanHistory updatePlanHistory = _planHistoryRepository.Get(dto.Id); // 更新计划历史 if (dto.PlanType == 1) { updatePlanHistory.SetActionCategory(actionCategory, targetCategory); updatePlanHistory.SetAircraftType(aircraftType); updatePlanHistory.SetAirlines(airlines); updatePlanHistory.SetCarryingCapacity(dto.CarryingCapacity); updatePlanHistory.SetIsSubmit(dto.IsSubmit); updatePlanHistory.SetNote(dto.Note); updatePlanHistory.SetPerformDate(annual, dto.PerformMonth); updatePlanHistory.SetPlanAircraft(dto.PlanAircraftId); updatePlanHistory.SetSeatingCapacity(dto.SeatingCapacity); updatePlanHistory.SetApprovalHistory(dto.ApprovalHistoryId); updatePlanHistory.SetCanRequest((CanRequest) dto.CanRequest); updatePlanHistory.SetCanDeliver((CanDeliver) dto.CanDeliver); var operationPlan = updatePlanHistory as OperationPlan; if (operationPlan != null) operationPlan.SetOperationHistory(operationHistory); } else if (dto.PlanType == 2) { updatePlanHistory.SetActionCategory(actionCategory, targetCategory); updatePlanHistory.SetAircraftType(aircraftType); updatePlanHistory.SetAirlines(airlines); updatePlanHistory.SetCarryingCapacity(dto.CarryingCapacity); updatePlanHistory.SetIsSubmit(dto.IsSubmit); updatePlanHistory.SetNote(dto.Note); updatePlanHistory.SetPerformDate(annual, dto.PerformMonth); updatePlanHistory.SetPlanAircraft(dto.PlanAircraftId); updatePlanHistory.SetSeatingCapacity(dto.SeatingCapacity); updatePlanHistory.SetApprovalHistory(dto.ApprovalHistoryId); updatePlanHistory.SetCanRequest((CanRequest) dto.CanRequest); updatePlanHistory.SetCanDeliver((CanDeliver) dto.CanDeliver); var changePlan = updatePlanHistory as ChangePlan; if (changePlan != null) changePlan.SetAircraftBusiness(aircraftBusiness); } _planHistoryRepository.Modify(updatePlanHistory); }
public void InsertPlanHistory(PlanHistoryDTO dto) { //获取 ActionCategory actionCategory = _actionCategoryRepository.Get(dto.ActionCategoryId); ActionCategory targetCategory = _actionCategoryRepository.Get(dto.TargetCategoryId); AircraftType aircraftType = _aircraftTypeRepository.Get(dto.AircraftTypeId); Airlines airlines = _airlinesRepository.Get(dto.AirlinesId); Annual annual = _annualRepository.Get(dto.PerformAnnualId); // 添加接机行 if (dto.PlanType == 1) { PlanHistory newPlanHistory = PlanHistoryFactory.CreateOperationPlan(dto.PlanId); newPlanHistory.SetActionCategory(actionCategory, targetCategory); newPlanHistory.SetAircraftType(aircraftType); newPlanHistory.SetAirlines(airlines); newPlanHistory.SetCarryingCapacity(dto.CarryingCapacity); newPlanHistory.SetIsSubmit(dto.IsSubmit); newPlanHistory.SetNote(dto.Note); newPlanHistory.SetPerformDate(annual, dto.PerformMonth); newPlanHistory.SetPlanAircraft(dto.PlanAircraftId); newPlanHistory.SetSeatingCapacity(dto.SeatingCapacity); newPlanHistory.SetCanRequest((CanRequest) dto.CanRequest); newPlanHistory.SetCanDeliver((CanDeliver) dto.CanDeliver); _planHistoryRepository.Add(newPlanHistory); } else if (dto.PlanType == 2) { PlanHistory newPlanHistory = PlanHistoryFactory.CreateChangePlan(dto.PlanId); newPlanHistory.SetActionCategory(actionCategory, targetCategory); newPlanHistory.SetAircraftType(aircraftType); newPlanHistory.SetAirlines(airlines); newPlanHistory.SetCarryingCapacity(dto.CarryingCapacity); newPlanHistory.SetIsSubmit(dto.IsSubmit); newPlanHistory.SetNote(dto.Note); newPlanHistory.SetPerformDate(annual, dto.PerformMonth); newPlanHistory.SetPlanAircraft(dto.PlanAircraftId); newPlanHistory.SetSeatingCapacity(dto.SeatingCapacity); newPlanHistory.SetCanRequest((CanRequest) dto.CanRequest); newPlanHistory.SetCanDeliver((CanDeliver) dto.CanDeliver); _planHistoryRepository.Add(newPlanHistory); } }