/// <summary> /// 新增所有权历史 /// </summary> /// <returns></returns> public OwnershipHistory AddNewOwnershipHistory(int supplierId, DateTime starDate, DateTime? endatDate, OperationStatus status) { var ownershipHistory = new OwnershipHistory { AircraftId = Id, }; ownershipHistory.SetSupplier(supplierId); ownershipHistory.SetStartDate(starDate); ownershipHistory.SetEndDate(endatDate); ownershipHistory.GenerateNewIdentity(); OwnershipHistories.Add(ownershipHistory); ownershipHistory.SetOperationStatus(status); return ownershipHistory; }
/// <summary> /// 更新所有权历史 /// </summary> /// <param name="ownershipHistoryDto">所有权历史DTO</param> /// <param name="ownershipHistory">所有权历史</param> private void UpdateOwnershipHistory(OwnershipHistoryDTO ownershipHistoryDto, OwnershipHistory ownershipHistory) { //获取相关数据 Supplier supplier = _supplierRepository.Get(ownershipHistoryDto.SupplierId); //更新所有权历史 ownershipHistory.SetEndDate(ownershipHistoryDto.EndDate); ownershipHistory.SetOperationStatus((OperationStatus) ownershipHistoryDto.Status); ownershipHistory.SetStartDate(ownershipHistoryDto.StartDate); ownershipHistory.SetSupplier(supplier); }