Exemplo n.º 1
0
        public void UpdateStake()
        {
            var newStake = TicketsInBasket.ToSyncList().Sum(x => x.Stake);

            if (newStake != stake)
            {
                stake = newStake;
                OnPropertyChanged("Stake");
            }
        }
Exemplo n.º 2
0
 public void CopyValues()
 {
     if (!ChangeTracker.TicketBuyActive)
     {
         foreach (var ticket in TicketsInBasket.ToSyncList())
         {
             foreach (var tipItemVw in ticket.TipItems.ToSyncList())
             {
                 tipItemVw.Value = tipItemVw.OddView.Value;
             }
         }
     }
 }
Exemplo n.º 3
0
        //private decimal CalculateConfidenceFactor(Ticket ticket)
        //{
        //    string localDelimeter = "*";
        //    string serverDelimeter = "|";

        //    decimal matchConfidenceFactor = 0;
        //    decimal maxBetLiability = 0;
        //    decimal marketConfidenceFactor = 0;

        //    for (int i = 0; i < ticket.TipItems.Count; i++)
        //    {
        //        string matchId = ticket.TipItems.ElementAt(i).Match.MatchId.ToString();
        //        string oddTag = ticket.TipItems.ElementAt(i).Odd.OddTag.Value;
        //        string tournamentId = ticket.TipItems.ElementAt(i).Match.MatchView.TournamentView.LineObject.SvrGroupId.ToString();
        //        string sportId = ticket.TipItems.ElementAt(i).Match.MatchView.SportView.LineObject.SvrGroupId.ToString();
        //        LiabilityLn liab = LineSr.Instance.AllObjects.Liabilities.SafelyGetValue(matchId + localDelimeter + LineSr.MATCH_FACTOR);
        //        if (liab != null && (liab.factor.Value < matchConfidenceFactor || matchConfidenceFactor == 0))
        //        {
        //            matchConfidenceFactor = liab.factor.Value;
        //        }

        //        liab = LineSr.Instance.AllObjects.Liabilities.SafelyGetValue(tournamentId + localDelimeter + LineSr.TOURN_CONF_RATING);
        //        if (liab != null)
        //        {
        //            LiabilityLn franchisorRating = LineSr.Instance.AllObjects.Liabilities.SafelyGetValue(liab.factor.Value.ToString() + localDelimeter + LineSr.CONF_RATING_VALUES);
        //            if (franchisorRating != null && (franchisorRating.factor.Value < maxBetLiability || maxBetLiability == 0))
        //                maxBetLiability = franchisorRating.factor.Value;
        //        }
        //        else
        //        {
        //            LiabilityLn franchisorRating = LineSr.Instance.AllObjects.Liabilities.SafelyGetValue("3" + localDelimeter + LineSr.CONF_RATING_VALUES);
        //            if (franchisorRating != null && (franchisorRating.factor.Value < maxBetLiability || maxBetLiability == 0))
        //                maxBetLiability = franchisorRating.factor.Value;
        //        }

        //        //marketConfidenceFactor "MATCH|180201|BD_TAG_0_1*LIMIT_FACTORS"
        //        liab = LineSr.Instance.AllObjects.Liabilities.SafelyGetValue("MATCH" + serverDelimeter + matchId + serverDelimeter + oddTag + localDelimeter + LineSr.LIMIT_FACTORS);
        //        if (liab == null)
        //        {
        //            liab = LineSr.Instance.AllObjects.Liabilities.SafelyGetValue("TOURNAMENT" + serverDelimeter + tournamentId + serverDelimeter + oddTag + localDelimeter + LineSr.LIMIT_FACTORS);
        //            if (liab == null)
        //            {
        //                liab = LineSr.Instance.AllObjects.Liabilities.SafelyGetValue("SPORT" + serverDelimeter + sportId + serverDelimeter + oddTag + localDelimeter + LineSr.LIMIT_FACTORS);
        //                if (liab == null)
        //                {
        //                    liab = LineSr.Instance.AllObjects.Liabilities.SafelyGetValue("SPORT" + serverDelimeter + sportId + serverDelimeter + "DEFAULT" + localDelimeter + LineSr.LIMIT_FACTORS);
        //                    if (liab != null && (liab.factor.Value < marketConfidenceFactor || marketConfidenceFactor == 0))
        //                    {
        //                        marketConfidenceFactor = liab.factor.Value;
        //                    }
        //                }
        //                else if (liab.factor.Value < marketConfidenceFactor || marketConfidenceFactor == 0)
        //                {
        //                    marketConfidenceFactor = liab.factor.Value;
        //                }
        //            }
        //            else if (liab.factor.Value < marketConfidenceFactor || marketConfidenceFactor == 0)
        //            {
        //                marketConfidenceFactor = liab.factor.Value;
        //            }
        //        }
        //        else if(liab.factor.Value < marketConfidenceFactor || marketConfidenceFactor == 0)
        //        {
        //            marketConfidenceFactor = liab.factor.Value;
        //        }
        //    }

        //    if (matchConfidenceFactor == 0)
        //        matchConfidenceFactor = 1;

        //    if (marketConfidenceFactor == 0)
        //        marketConfidenceFactor = 1;

        //    return matchConfidenceFactor * maxBetLiability * marketConfidenceFactor;
        //}

        public void UpdateTicket()
        {
            lock (_lockUpdate)
            {
                var ticketsInBasket = TicketsInBasket.ToSyncList();
                foreach (var ticket in ticketsInBasket)
                {
                    ticket.User = ChangeTracker.CurrentUser;
                    if (TicketState == TicketStates.Single && ticket.TipItems.ToSyncList().Count(x => x.IsChecked) >= 2)
                    {
                        TicketState = TicketStates.Multy;
                    }
                    if (TicketState != TicketStates.Single && ticket.TipItems.ToSyncList().Count(x => x.IsChecked) < 2)
                    {
                        if (ticketsInBasket.Count == 1)
                        {
                            ticketsInBasket.First().TicketState = TicketStates.Single;
                        }
                        TicketState = TicketStates.Single;
                    }

                    DataBinding.UpdateSystemOrCombiticket(ticket);
                    if (ticket.Stake > ticket.MaxBet && ChangeTracker.CurrentUser.Cashpool > 0)
                    {
                        OnChangeStake("max", ticket, ChangeTracker.CurrentUser.Cashpool);
                    }
                }
                UpdateStake();
            }



            OnPropertyChanged("MaxBet");
            OnPropertyChanged("MaxWin");
            OnPropertyChanged("MinBet");
            OnPropertyChanged("CurrentTicketPossibleWin");

            OnPropertyChanged("Count");
            OnPropertyChanged("TotalOddDisplay");
            OnPropertyChanged("ManipulationFeeValue");
            OnPropertyChanged("ManipulationFeePercentage");
            OnPropertyChanged("BonusValue");
            OnPropertyChanged("BonusValueRounded");
            OnPropertyChanged("IsVisibleBank");
            OnPropertyChanged("BonusPercentage");
        }