private Collection <CallsData> UnionCallsAndFailedCallsData( Collection <PerfCounterData> totalCallsPerfCounterDataCollection, Collection <PerfCounterData> failedCallsPerfCounterDataCollection) { Collection <CallsData> callsAndFailedCallsDataCollection = new Collection <CallsData>(); foreach (PerfCounterData totalCallsPerfCounterData in totalCallsPerfCounterDataCollection) { PerfCounterData matchingFailedCallsPerfCounterData = failedCallsPerfCounterDataCollection.FirstOrDefault(a => a.CounterName == totalCallsPerfCounterData.CounterName); CallsData callsData = new CallsData(); callsData.CounterName = totalCallsPerfCounterData.CounterName; callsData.FriendlyName = totalCallsPerfCounterData.FriendlyName; callsData.TotalCalls = totalCallsPerfCounterData.MaxValue; callsData.TotalFailedCalls = matchingFailedCallsPerfCounterData.MaxValue; callsData.PercentFailure = Math.Round(((Convert.ToDouble(callsData.TotalFailedCalls) / Convert.ToDouble(callsData.TotalCalls)) * 100), 2); callsAndFailedCallsDataCollection.Add(callsData); } return(callsAndFailedCallsDataCollection); }
private Collection<CallsData> UnionCallsAndFailedCallsData( Collection<PerfCounterData> totalCallsPerfCounterDataCollection, Collection<PerfCounterData> failedCallsPerfCounterDataCollection) { Collection<CallsData> callsAndFailedCallsDataCollection = new Collection<CallsData>(); foreach (PerfCounterData totalCallsPerfCounterData in totalCallsPerfCounterDataCollection) { PerfCounterData matchingFailedCallsPerfCounterData = failedCallsPerfCounterDataCollection.FirstOrDefault(a => a.CounterName == totalCallsPerfCounterData.CounterName); CallsData callsData = new CallsData(); callsData.CounterName = totalCallsPerfCounterData.CounterName; callsData.FriendlyName = totalCallsPerfCounterData.FriendlyName; callsData.TotalCalls = totalCallsPerfCounterData.MaxValue; callsData.TotalFailedCalls = matchingFailedCallsPerfCounterData.MaxValue; callsData.PercentFailure = Math.Round(((Convert.ToDouble(callsData.TotalFailedCalls) / Convert.ToDouble(callsData.TotalCalls)) * 100), 2); callsAndFailedCallsDataCollection.Add(callsData); } return callsAndFailedCallsDataCollection; }