//methods public override void CloseBetBeforeEnd(object sender, ScoredEventArgs args) { if (sender == this.Match && !this.BetClosed && minTimeToclose < args.PassedPartOfMatch && args.PassedPartOfMatch <= maxTimeToclose && ((args.ScoredAway > (args.ScoredHome + scoreDiffToClose) && this.BetOnResult == DrawNotPossibleResults.WinAway) || (args.ScoredHome > (args.ScoredAway + scoreDiffToClose) && this.BetOnResult == DrawNotPossibleResults.WinHome))) { this.AmountWon = (this.Match.Coefficients[(int)this.BetOnResult] - 1) * this.BetAmnout / 2; this.BetClosed = true; Console.WriteLine("The bet({0}) for ({1}) has been closed before the end of match with {2:C} win above the bet amount({3:C})!", this.ID, this.Match.ID, this.AmountWon, this.BetAmnout); } }
public override void CloseBetBeforeEnd(object sender, ScoredEventArgs args) {//if half of match duration has passed and preferred team wins - close bet with 50% of possible win if (sender == this.Match && !this.BetClosed && (args.PassedPartOfMatch <= 0.5) && ((args.ScoredAway > args.ScoredHome && (this.BetOnResult & DrawPossibleResults.WinAway) == DrawPossibleResults.WinAway) || (args.ScoredAway < args.ScoredHome && (this.BetOnResult & DrawPossibleResults.WinHome) == DrawPossibleResults.WinHome) || (args.ScoredAway == args.ScoredHome && (this.BetOnResult & DrawPossibleResults.Draw) == DrawPossibleResults.Draw))) { decimal[] arrCoef = ReorderCoefToPossibleResults(); this.AmountWon = (arrCoef[(int)this.BetOnResult - 1] - 1) * this.BetAmnout / 2; this.BetClosed = true; Console.WriteLine("The bet({0}) for ({1}) has been closed before the end of match with {2:C} win above the bet amount({3:C})!", this.ID, this.Match.ID, this.AmountWon, this.BetAmnout); } }
static void PrintScoreEvent(object sender, ScoredEventArgs args) { Console.WriteLine("team {0} has scored after {1:f2}% of match has passed", args.Team, args.PassedPartOfMatch); }
private void Service_Scored(object sender, ScoredEventArgs args) { _score.Text = args.Score.ToString(); }
//methods public abstract void CloseBetBeforeEnd(object sender, ScoredEventArgs args);