/// <summary> Конвертировать CallHistoryPeerModelManaged в ModelCallHistoryPeer </summary> private static ModelCallHistoryPeer ConvertCallHistoryPeerModelManagedToModelCallHistoryPeer(CallHistoryPeerModelManaged callHistoryPeerModelManaged) { var result = new ModelCallHistoryPeer { ModelPeerObj = callHistoryPeerModelManaged.Peer != null ? new ModelPeer { Id = callHistoryPeerModelManaged.Peer.Id, Identity = callHistoryPeerModelManaged.Peer.Identity, ModelContactObj = DataSourceContact.GetModelContactFromContactModelManaged(callHistoryPeerModelManaged.Peer.Contact), ModelEnumCallAddressTypeObj = ModelEnumCallAddressType.GetModelEnum((int)callHistoryPeerModelManaged.Peer.AddressType) } : null, ModelCallStatisticsObj = callHistoryPeerModelManaged.Statistics != null ? new ModelCallStatistics { HasIncomingEncryptedCall = callHistoryPeerModelManaged.Statistics.HasIncomingEncryptedCall, HasOutgoingEncryptedCall = callHistoryPeerModelManaged.Statistics.HasOutgoingEncryptedCall, NumberOfIncomingSuccessfulCalls = callHistoryPeerModelManaged.Statistics.NumberOfIncomingSuccessfulCalls, NumberOfIncomingUnsuccessfulCalls = callHistoryPeerModelManaged.Statistics.NumberOfIncomingUnsuccessfulCalls, NumberOfOutgoingSuccessfulCalls = callHistoryPeerModelManaged.Statistics.NumberOfOutgoingSuccessfulCalls, NumberOfOutgoingUnsuccessfulCalls = callHistoryPeerModelManaged.Statistics.NumberOfOutgoingUnsuccessfulCalls, NumberOfMissedCalls = callHistoryPeerModelManaged.Statistics.NumberOfMissedCalls, WasConference = callHistoryPeerModelManaged.Statistics.WasConference } : null, ListModelCallHistoryEntry = callHistoryPeerModelManaged.DetailsList.Select(ConvertCallHistoryEntryModelManagedToModelCallHistoryEntry).ToList() }; return(result); }
/// <summary> Конвертировать CallModelManaged в ModelCall </summary> private static ModelCall ConvertCallModelManagedToModelCall(CallModelManaged callModelManaged) { var result = new ModelCall { Id = callModelManaged.Id, Duration = callModelManaged.Duration, Identity = callModelManaged.Identity, ModelContactObj = DataSourceContact.GetModelContactFromContactModelManaged(callModelManaged.Contact), ModelEnumCallDirectionObj = ModelEnumCallDirection.GetModelEnum((int)callModelManaged.Direction), ModelEnumCallAddressTypeObj = ModelEnumCallAddressType.GetModelEnum((int)callModelManaged.AddressType), ModelEnumVoipEncryptionObj = ModelEnumVoipEncryption.GetModelEnum((int)callModelManaged.Encription), ModelEnumCallStateObj = ModelEnumCallState.GetModelEnum((int)callModelManaged.State) }; return(result); }