public CustomersBettingProfile(List <CustomerBet> settledBets, List <CustomerBet> unsettledBets) { if (settledBets == null) { throw new ArgumentException("Please provide settled list"); } if (unsettledBets == null) { throw new ArgumentException("Please provide unsettled list"); } _settledBets = settledBets; _unsettledBets = unsettledBets; CustomerBets.AddRange(settledBets); DetermineUnUsualBet(); DetermineIfRisky(); DetermineAverageStake(); DetermineTenTimesHigherStake(); DetermineThirtyTimesHigherStake(); CustomerBets.AddRange(unsettledBets); }
/// <summary> /// Runs when selected customer is changed. /// </summary> protected override void OnSelectedCustomerChanged() { CustomerBets.Clear(); if (KeyedCustomersData.ContainsKey(SelectedCustomer)) { List <CustomerBet> unususalCustomerBets = KeyedCustomersData[SelectedCustomer].Where(b => b.WinAmount > 0.6m * b.StakeAmount).ToList(); unususalCustomerBets.ForEach(CustomerBets.Add); } }
/// <summary> /// Runs when selected customer is changed. /// </summary> protected override void OnSelectedCustomerChanged() { CustomerBets.Clear(); if (KeyedCustomersData.ContainsKey(SelectedCustomer)) { List <CustomerBet> customerItems = KeyedCustomersData[SelectedCustomer]; var average = customerItems.Sum(i => i.StakeAmount) / customerItems.Count; customerItems.ForEach(cb => { if (cb.WinAmount > 0.6m * cb.StakeAmount) { cb.RiskyUnsettledBetSeverity = RiskSeverity.Risky; } if (cb.StakeAmount > 10 * average) { cb.RiskyUnsettledBetSeverity = RiskSeverity.Unusual; } if (cb.StakeAmount > 30 * average) { cb.RiskyUnsettledBetSeverity = RiskSeverity.HighlyUnusual; } if (cb.WinAmount >= 1000m) { cb.RiskyUnsettledBetSeverity = RiskSeverity.HighWonAmount; } }); List <CustomerBet> riskyCustomerBets = (from cb in customerItems where cb.WinAmount > 0.6m * cb.StakeAmount || cb.StakeAmount > 10 * average || cb.StakeAmount > 30 * average || cb.WinAmount >= 1000m select cb).ToList(); riskyCustomerBets.ForEach(CustomerBets.Add); } }