コード例 #1
0
ファイル: DataBinding.cs プロジェクト: litfung/Sport-Betting
        public static void UpdateSingleticketItems(ref TipListInfo tipListInfo, ObservableCollection <TipItem> tipItems)
        {
            decimal oddVal = 1;

            ///ASSERTION  :  Tipitem has exactly one item
            if (tipItems.Count == 1)
            {
                oddVal = tipItems[0].Odd.Value;
                tipListInfo.MinCombination = minCombinationOfAll(tipItems[0]);
            }
            tipListInfo.NumOfTipps    = 1;
            tipListInfo.NumOfBets     = 1;
            tipListInfo.OddOfTipps    = oddVal;
            tipListInfo.FullOddFactor = oddVal;
            tipListInfo.BonusFactor   = 1;

            tipListInfo.MinBet = MinStakeSingleBet;
            tipListInfo.MaxBet = Math.Round(LimitHandling.SingleMaxStake(oddVal * tipListInfo.ManipulationFeeReduction), 1);

            tipListInfo.MinWin = tipListInfo.OddOfTipps * tipListInfo.MinBet * ((tipListInfo.BonusFactor > 0) ? tipListInfo.BonusFactor : 1) * tipListInfo.ManipulationFeeReduction;
            tipListInfo.MaxWin = tipListInfo.OddOfTipps * tipListInfo.MaxBet * ((tipListInfo.BonusFactor > 0) ? tipListInfo.BonusFactor : 1) * tipListInfo.ManipulationFeeReduction;

            tipListInfo.PossWin = tipListInfo.OddOfTipps * tipListInfo.Bet * ((tipListInfo.BonusFactor > 0) ? tipListInfo.BonusFactor : 1) * tipListInfo.ManipulationFeeReduction;
        }
コード例 #2
0
        public static void UpdateSingleticketItems(IList <TipItemVw> tipItems, Ticket ticketToCalculate = null)
        {
            decimal oddVal = 0;

            ///ASSERTION  :  Tipitem has exactly one item

            if (ChangeTracker.MultipleSingles != null)
            {
                TipListInfo.Bet         = ticketToCalculate.Stake;
                TipListInfo.BonusFactor = ticketToCalculate.BonusValue;
            }

            foreach (var tipItem in tipItems)
            {
                oddVal += tipItem.Odd.Value.Value;
            }

            if (tipItems.Count > 0)
            {
                TipListInfo.MinCombination = minCombinationOfAll(tipItems[0]);
            }

            TipListInfo.NumOfTipps    = 1;
            TipListInfo.OddOfTipps    = oddVal;
            TipListInfo.FullOddFactor = oddVal;

            if (TipListInfo.FullOddFactor >= MaxOdd)
            {
                TipListInfo.IsMaxOddBet          = true;
                ticketToCalculate.MaxOddExceeded = false;
                if (TipListInfo.FullOddFactor > MaxOdd)
                {
                    TipListInfo.IllegalOddFactor     = TipListInfo.FullOddFactor;
                    ticketToCalculate.MaxOddExceeded = true;
                }
                TipListInfo.FullOddFactor = MaxOdd;
                TipListInfo.OddOfTipps    = MaxOdd;
            }
            else
            {
                TipListInfo.IllegalOddFactor     = 0;
                TipListInfo.IsMaxOddBet          = false;
                ticketToCalculate.MaxOddExceeded = false;
            }



            TipListInfo.MinBet = MinStakeSingleBet;

            //if (ChangeTracker.MultipleSingles == null)
            //{
            // MaxBet and MaxWin for MultiSingles is assigned in UpdateTicket()
            if (tipItems.Count > 0)
            {
                TipListInfo.MaxBet = Round(LimitHandling.SingleMaxStake(oddVal * TipListInfo.ManipulationFeeReduction, ticketToCalculate), 2);
            }
            else
            {
                TipListInfo.MaxBet = Round(LimitHandling.SingleMaxStake(1 * TipListInfo.ManipulationFeeReduction, ticketToCalculate), 2);
            }

            TipListInfo.MaxWin = TipListInfo.OddOfTipps * TipListInfo.MaxBet *
                                 ((TipListInfo.BonusFactor > 0) ? TipListInfo.BonusFactor : 1) *
                                 TipListInfo.ManipulationFeeReduction;
            var maxWinSingleBetFromAdmin = StationRepository.GetMaxWinSingleBet(ticketToCalculate);

            if (maxWinSingleBetFromAdmin > 0 && TipListInfo.MaxWin > maxWinSingleBetFromAdmin)
            {
                TipListInfo.MaxWin = maxWinSingleBetFromAdmin;
                var manipulationFee = StationRepository.GetManipulationFeePercentage(ChangeTracker.NewTicket);
                TipListInfo.MaxBet = Round(100 * TipListInfo.MaxWin / ((100 - manipulationFee) * TipListInfo.BonusFactor * TipListInfo.FullOddFactor), 2);
            }
            //}
            //else
            //{
            //    TipListInfo.MaxBet = ticketToCalculate.MaxBet;
            //    TipListInfo.MaxWin = ticketToCalculate.MaxWin;
            //}

            TipListInfo.MinWin = TipListInfo.OddOfTipps * TipListInfo.MinBet *
                                 ((TipListInfo.BonusFactor > 0) ? TipListInfo.BonusFactor : 1) *
                                 TipListInfo.ManipulationFeeReduction;

            TipListInfo.CurrentTicketPossibleWin = TipListInfo.OddOfTipps * TipListInfo.Bet *
                                                   ((TipListInfo.BonusFactor > 0) ? TipListInfo.BonusFactor : 1) *
                                                   TipListInfo.ManipulationFeeReduction;
        }