コード例 #1
0
        private async void RemoveBkFromList(Bookmaker obj)
        {
            SettingsViewModel settingsViewModel = this;

            if (obj == null)
            {
                await settingsViewModel.ShowErrorDialogAsync("Не выбран БК");
            }
            else
            {
                if (await settingsViewModel.ShowYesOrNoDialogAsync("Запрос", "Вы уверены, что хотите удалить " + obj.EBookmaker.ToNormalStringUpper()) == MessageDialogResult.Negative)
                {
                    return;
                }
                int num = settingsViewModel.Bookmakers.IndexOf(obj);
                if (num < 0 || num >= settingsViewModel.Bookmakers.Count)
                {
                    await settingsViewModel.ShowErrorDialogAsync("Не нашли бк в списке активных");
                }
                else
                {
                    settingsViewModel.SelectedBookmaker = settingsViewModel.Bookmakers[num - 1];
                    settingsViewModel.Bookmakers.Remove(obj);
                }
            }
        }
コード例 #2
0
 private static void AddNewBookmaker(Bookmaker bookmaker, Settings settings)
 {
     if (settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == bookmaker.EBookmaker)) != null)
     {
         return;
     }
     settings.UserSettings.BookmakersList.Add(bookmaker);
 }
コード例 #3
0
 public MatchParserControl(BetsLibrary.BookmakerParser parser, Bookmaker bookmaker, string matchUrl, MatchName MatchName)
 {
     InitializeComponent();
     browserControl.GoTo(matchUrl, bookmaker);
     this.parser    = parser;
     this.matchUrl  = matchUrl;
     this.MatchName = MatchName;
     Bookmaker      = bookmaker;
 }
コード例 #4
0
 public static BookmakerSettings Get(Bookmaker bookmaker)
 {
     if (!settingsDict.TryGetValue(bookmaker, out BookmakerSettings settings))
     {
         settings = new BookmakerSettings();
         settingsDict.Add(bookmaker, settings);
     }
     return(settings);
 }
コード例 #5
0
 public void GoTo(string address, Bookmaker bookmaker)
 {
     bookmakerSettings = BookmakersSettingsCollection.Get(bookmaker);
     if (bookmakerSettings.UseProxy)
     {
         SetProxy();
     }
     GoTo(address);
 }
コード例 #6
0
        private static void SetBookmakerAutomatSupport(Settings settings, EBookmakers bookmakers)
        {
            Bookmaker bookmaker = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == bookmakers));

            if (bookmaker == null)
            {
                return;
            }
            bookmaker.IsSupportAutomat = true;
        }
コード例 #7
0
        private static void UpdateFromLastTo46(Settings settings)
        {
            settings.UserSettings.BookmakersList = settings.UserSettings.BookmakersList.OrderBy <Bookmaker, EBookmakers>((Func <Bookmaker, EBookmakers>)(x => x.BookmakersGroup)).ToList <Bookmaker>();
            Bookmaker bookmaker = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._betfair));

            if (bookmaker == null)
            {
                return;
            }
            bookmaker.CommissionCoef = new Decimal(65, 0, 0, false, (byte)1);
        }
コード例 #8
0
        private static void UpdateFromLastTo55(Settings settings)
        {
            settings.Version = new Version(0, 0, 0, 55);
            Bookmaker bookmaker = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._dafabet));

            if (bookmaker != null)
            {
                settings.UserSettings.BookmakersList.Remove(bookmaker);
            }
            SettingVersionUpdater.AddNewBookmaker(EBookmakers._dafabetMobile, settings);
        }
コード例 #9
0
        private static void UpdateFromLastTo61(Settings settings)
        {
            settings.Version = new Version(0, 0, 0, 61);
            Bookmaker bookmaker = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._pinnacle));

            if (bookmaker == null)
            {
                return;
            }
            bookmaker.BookmakersGroup = EBookmakers._pinnacle;
        }
コード例 #10
0
        private static void SetMirrorGroup(DublicateList result, Settings settings)
        {
            MirrorsGroupsManager mirrorsGroupsManager = new MirrorsGroupsManager();

            foreach (KeyValuePair <EBookmakers, List <EBookmakers> > keyValuePair in mirrorsGroupsManager.BookmakersGroups.ToDictionary <KeyValuePair <EBookmakers, List <EBookmakers> >, EBookmakers, List <EBookmakers> >((Func <KeyValuePair <EBookmakers, List <EBookmakers> >, EBookmakers>)(x => x.Key), (Func <KeyValuePair <EBookmakers, List <EBookmakers> >, List <EBookmakers> >)(x => x.Value)))
            {
                KeyValuePair <EBookmakers, List <EBookmakers> > groupe = keyValuePair;
                int num;
                if (groupe.Value.Count == 1)
                {
                    DublicateList dublicateList = result;
                    string        index         = string.Format("Booker[{0}][mirror_booker_id]", (object)(int)groupe.Key);
                    num = (int)groupe.Key;
                    string str = num.ToString();
                    dublicateList[index] = str;
                }
                Bookmaker bookmaker = settings.UserSettings.BookmakersList.Where <Bookmaker>((Func <Bookmaker, bool>)(x => x.BookmakersGroup == groupe.Key)).ToList <Bookmaker>().FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.IsEnabled));
                if (bookmaker == null)
                {
                    DublicateList dublicateList = result;
                    string        index         = string.Format("Booker[{0}][mirror_booker_id]", (object)(int)groupe.Key);
                    num = (int)groupe.Key;
                    string str = num.ToString();
                    dublicateList[index] = str;
                }
                else if (mirrorsGroupsManager.RuMirrors.ContainsKey(bookmaker.EBookmaker))
                {
                    if (bookmaker.IsRu)
                    {
                        DublicateList dublicateList = result;
                        string        index         = string.Format("Booker[{0}][mirror_booker_id]", (object)(int)groupe.Key);
                        num = (int)mirrorsGroupsManager.RuMirrors[bookmaker.EBookmaker];
                        string str = num.ToString();
                        dublicateList[index] = str;
                    }
                    else
                    {
                        DublicateList dublicateList = result;
                        string        index         = string.Format("Booker[{0}][mirror_booker_id]", (object)(int)groupe.Key);
                        num = (int)bookmaker.EBookmaker;
                        string str = num.ToString();
                        dublicateList[index] = str;
                    }
                }
                else
                {
                    DublicateList dublicateList = result;
                    string        index         = string.Format("Booker[{0}][mirror_booker_id]", (object)(int)groupe.Key);
                    num = (int)bookmaker.EBookmaker;
                    string str = num.ToString();
                    dublicateList[index] = str;
                }
            }
        }
コード例 #11
0
        private static void UpdateFromLastTo63(Settings settings)
        {
            settings.Version = new Version(0, 0, 0, 63);
            SettingVersionUpdater.AddNewBookmaker(EBookmakers._pinnacleBeta, settings);
            Bookmaker bookmaker = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._pinnacleBeta));

            if (bookmaker == null)
            {
                return;
            }
            bookmaker.IsEnabled = false;
        }
コード例 #12
0
        private static void UpdateBookmakerData(Bookmaker bookmaker, Settings settings)
        {
            Bookmaker bookmaker1 = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == bookmaker.EBookmaker));

            if (bookmaker1 == null)
            {
                return;
            }
            settings.UserSettings.BookmakersList.Remove(bookmaker1);
            bookmaker.Login    = bookmaker1.Login;
            bookmaker.Password = bookmaker1.Password;
            settings.UserSettings.BookmakersList.Add(bookmaker);
        }
コード例 #13
0
        private static void EnabledAutoBookmaker(EBookmakers bookmaker, Settings settings)
        {
            Dictionary <EBookmakers, Bookmaker> dictionary = settings.UserSettings.BookmakersList.ToDictionary <Bookmaker, EBookmakers, Bookmaker>((Func <Bookmaker, EBookmakers>)(x => x.EBookmaker), (Func <Bookmaker, Bookmaker>)(x => x));

            if (!dictionary.ContainsKey(bookmaker))
            {
                Bookmaker bookmaker1 = AllBookmakersHelper.GetBookmaker(bookmaker);
                settings.UserSettings.BookmakersList.Add(bookmaker1);
            }
            else
            {
                dictionary[bookmaker].IsSupportAutomat = true;
            }
        }
コード例 #14
0
        private ITokenizer GetTokenizer(Bookmaker bookmaker)
        {
            switch (bookmaker)
            {
            case Bookmaker.Fonbet:
                return(new FonbetTokenizer());

            case Bookmaker.Marathon:
                return(new MarathonTokenizer());

            default:
                throw new NotImplementedException("bookmaker is not implemented " + bookmaker.ToString());
            }
        }
コード例 #15
0
        private async void CopyLoginPassword(Bookmaker obj)
        {
            SettingsViewModel settingsViewModel = this;

            if (obj == null)
            {
                await settingsViewModel.ShowErrorDialogAsync("Не выбран БК");
            }
            else
            {
                Clipboard.SetText("Букмекер:\"" + obj.EBookmaker.ToNormalStringUpper() + "\"" + Environment.NewLine + "Логин:\"" + obj.Login + "\"" + Environment.NewLine + "Пароль:\"" + obj.Password + "\"");
                await settingsViewModel.ShowSuccessDialogAsync("Данные успешно скопированы");
            }
        }
コード例 #16
0
        private static void UpdateFromLastTo51(Settings settings)
        {
            settings.Version = new Version(0, 0, 0, 50);
            Bookmaker bookmaker = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._gamebookers));

            if (bookmaker != null)
            {
                bookmaker.IsSupportAutomat = true;
            }
            else
            {
                SettingVersionUpdater.AddNewBookmaker(EBookmakers._gamebookers, settings);
            }
            SettingVersionUpdater.AddNewBookmaker(EBookmakers._betStarts, settings);
        }
コード例 #17
0
        private Model.ConcreateOdd CreateConcreateOdd(Bookmaker bookmaker, double odd)
        {
            var genericOdd = new Model.ConcreateOdd()
            {
                OddsBeforeCommission = odd,
                CommissionPct        = (double)(bookmaker.CurrentCommission ?? 0.0m),
                DecimalOdds          = odd * (1 - (double)(bookmaker.CurrentCommission ?? 0.0m)),
                BookmakerName        = bookmaker.BookmakerName,
                Source    = "Tennis Data Odds",
                TimeStamp = CouponDate,
                Priority  = bookmaker.Priority
            };

            return(genericOdd);
        }
コード例 #18
0
        public async Task RegisterAsync(string name)
        {
            var SportsBetting = await _bookmakerRepository.GetAsync(name);

            if (SportsBetting != null)
            {
                throw new Exception($"User with email: {name} already exists.");
            }
            var salt = Guid.NewGuid().ToString("N");

            SportsBetting = Bookmaker.Create(name);
            await _bookmakerRepository.AddAsync(SportsBetting);

            await Task.CompletedTask;
        }
コード例 #19
0
        public Bookmaker AddOrUpdate(Bookmaker bookmaker)
        {
            var storedBookmaker = First <Bookmaker>(b => b.BookmakerName == bookmaker.BookmakerName);

            if (storedBookmaker == null)
            {
                Add <Bookmaker>(bookmaker);
                return(bookmaker);
            }
            else
            {
                Update <Bookmaker>(bookmaker);
                Save <Bookmaker>(bookmaker);
                return(bookmaker);
            }
        }
コード例 #20
0
        private static void UpdateFromLastTo54(Settings settings)
        {
            settings.Version = new Version(0, 0, 0, 54);
            Bookmaker bookmaker1 = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._unibet));

            if (bookmaker1 != null)
            {
                bookmaker1.IsSupportAutomat = true;
            }
            Bookmaker bookmaker2 = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._zirkabet));

            if (bookmaker2 == null)
            {
                return;
            }
            bookmaker2.IsSupportAutomat = true;
        }
コード例 #21
0
        private static void UpdateCurrency(
            EBookmakers bookmaker,
            Settings settings,
            ECurrency newCurrency)
        {
            Dictionary <EBookmakers, Bookmaker> dictionary = settings.UserSettings.BookmakersList.ToDictionary <Bookmaker, EBookmakers, Bookmaker>((Func <Bookmaker, EBookmakers>)(x => x.EBookmaker), (Func <Bookmaker, Bookmaker>)(x => x));

            if (!dictionary.ContainsKey(bookmaker))
            {
                Bookmaker bookmaker1 = AllBookmakersHelper.GetBookmaker(bookmaker);
                settings.UserSettings.BookmakersList.Add(bookmaker1);
            }
            else
            {
                dictionary[bookmaker].CurrentCurrency = newCurrency;
            }
        }
コード例 #22
0
        public void AddActualBookmakers()
        {
            List <Bookmaker> list = this._settigs.UserSettings.BookmakersList.Where <Bookmaker>((Func <Bookmaker, bool>)(x => x.IsEnabled)).ToList <Bookmaker>();

            foreach (Bookmaker bookmaker1 in (Collection <Bookmaker>) this.Bookmakers)
            {
                Bookmaker bookmaker  = bookmaker1;
                Bookmaker bookmaker2 = list.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == bookmaker.EBookmaker));
                if (bookmaker2 != null)
                {
                    bookmaker2.IsLogin = bookmaker.IsLogin;
                    bookmaker2.Balance = bookmaker.Balance;
                }
            }
            this.Bookmakers = new ObservableCollection <Bookmaker>(list);
            this.UnderChanged();
        }
コード例 #23
0
ファイル: BookmakersAuth.cs プロジェクト: uvbs/oddsscanner
        public static string GetAuthorizedCheckScript(Bookmaker bookmaker)
        {
            switch (bookmaker)
            {
            case Bookmaker.Marathonbet:
                return("(function() { return document.getElementsByClassName('button btn-login').length; })();");

            case Bookmaker.Titanbet:
                return(string.Empty);

            case Bookmaker.Olimp:
                return("(function() { return document.getElementsByClassName('enterBtn').length; })();");

            case Bookmaker.Leon:
                return(string.Empty);
            }
            return(string.Empty);
        }
コード例 #24
0
        private static void UpdateFromLastTo62(Settings settings)
        {
            settings.Version = new Version(0, 0, 0, 62);
            Bookmaker bookmaker1 = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._pinnacle));

            if (bookmaker1 != null)
            {
                bookmaker1.BookmakersGroup = EBookmakers._pinnacle;
                bookmaker1.OriginalUrl     = "https://future.pinnacle.com/";
            }
            Bookmaker bookmaker2 = settings.UserSettings.BookmakersList.FirstOrDefault <Bookmaker>((Func <Bookmaker, bool>)(x => x.EBookmaker == EBookmakers._pinnacleBeta));

            if (bookmaker2 == null)
            {
                return;
            }
            bookmaker2.BookmakersGroup = EBookmakers._pinnacle;
            bookmaker2.OriginalUrl     = "https://beta.pinnacle.com/";
        }
コード例 #25
0
        public void Run(SoccerDataContext dbContext)
        {
            var url     = Feeds.OddsBookmakersFeed.GetFeedUrl();
            var rawJson = JsonUtility.GetRawJsonFromUrl(url);
            var feed    = Feeds.OddsBookmakersFeed.FromJson(rawJson);

            var  dbBookmakersDict = dbContext.Bookmakers.ToDictionary(x => x.ApiFootballId, y => y);
            var  apiBookmakers    = feed.Result?.Bookmakers;
            bool hasChange        = false;

            if (apiBookmakers != null && apiBookmakers.Count > 0)
            {
                foreach (var apiBookmaker in apiBookmakers)
                {
                    if (!dbBookmakersDict.TryGetValue(apiBookmaker.Id, out Bookmaker dbBookmaker))
                    {
                        dbBookmaker = new Bookmaker
                        {
                            ApiFootballId   = apiBookmaker.Id,
                            ApiFootballName = apiBookmaker.Name,
                            BookmakerName   = apiBookmaker.Name
                        };
                        dbBookmakersDict.Add(apiBookmaker.Id, dbBookmaker);
                        dbContext.Bookmakers.Add(dbBookmaker);
                        hasChange = true;
                    }
                    else
                    {
                        if (dbBookmaker.ApiFootballName != apiBookmaker.Name)
                        {
                            dbBookmaker.ApiFootballName = apiBookmaker.Name;
                            hasChange = true;
                        }
                    }
                }
            }

            if (hasChange)
            {
                dbContext.SaveChanges();
            }
        }
コード例 #26
0
        public void ExtractFromBookmaker(Bookmaker bookmaker)
        {
            var bets = bookmaker.Bets.FirstOrDefault();

            foreach (var bet in bets.Values)
            {
                if (bet.Value == "Home")
                {
                    OddHome = Convert.ToDouble(bet.Odd);
                }
                else if (bet.Value == "Draw")
                {
                    OddDraw = Convert.ToDouble(bet.Odd);
                }
                else if (bet.Value == "Away")
                {
                    OddAway = Convert.ToDouble(bet.Odd);
                }
            }
        }
コード例 #27
0
        private async void Login(Bookmaker bookmaker)
        {
            MainViewModel mainViewModel1 = this;

            if (bookmaker == null)
            {
                await mainViewModel1.ShowErrorDialogAsync("При авторизации. Что-то пошло не так!");
            }
            else
            {
                if (bookmaker.IsSupportAutomat && (string.IsNullOrWhiteSpace(bookmaker.Login) || string.IsNullOrWhiteSpace(bookmaker.Password)))
                {
                    MainViewModel       mainViewModel2 = mainViewModel1;
                    LoginDialogSettings settigs        = new LoginDialogSettings();
                    settigs.InitialUsername       = bookmaker.Login;
                    settigs.InitialPassword       = bookmaker.Password;
                    settigs.AffirmativeButtonText = "Авторизоваться";
                    LoginDialogData loginDialogData = await mainViewModel2.ShowLoginAsync("Не хватает данных", "Укажите данные для авторизации:", settigs);

                    if (loginDialogData == null)
                    {
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(loginDialogData.Username) || string.IsNullOrWhiteSpace(loginDialogData.Password))
                    {
                        await mainViewModel1.ShowErrorDialogAsync("Необходимо заполнить логин/пароль!");

                        return;
                    }
                    bookmaker.Login    = loginDialogData.Username;
                    bookmaker.Password = loginDialogData.Password;
                }
                Settings.Save(mainViewModel1._settigs);
                mainViewModel1._sitesManager.Login(bookmaker);
            }
        }
コード例 #28
0
        public Bookmaker GetBookmaker(string bookmakerName)
        {
            Db.Database.Connection.Open();

            var bookmaker = (from n in Db.Bookmakers where n.BookmakerName == bookmakerName select n).FirstOrDefault();

            if (bookmaker == null)
            {
                bookmaker = new Bookmaker
                {
                    BookmakerName = bookmakerName
                };

                Db.Bookmakers.Add(bookmaker);
                Db.SaveChanges();

                var repo = new LogRepository();
                repo.WriteLog(Database.SystemData.Severity.Information, "Insert to Bookmakers table new record", nameof(BookmakerOddsDataRepository),
                              "localhost", "[bookmakerId = " + bookmaker.BookmakerId + "] [bookmakerName = " + bookmaker.BookmakerName + "]", "");
            }

            Db.Database.Connection.Close();
            return(bookmaker);
        }
コード例 #29
0
ファイル: BookmakersAuth.cs プロジェクト: uvbs/oddsscanner
        public static string GetAuthorizeScript(Bookmaker bookmaker, string login, string password)
        {
            switch (bookmaker)
            {
            case Bookmaker.Marathonbet:
                return(string.Format("document.getElementById('auth_login').value = '{0}';" +
                                     "document.getElementById('auth_login_password').value = '{1}';" +
                                     "document.getElementsByClassName('button btn-login')[0].click();", login, password));

            case Bookmaker.Titanbet:
                break;

            case Bookmaker.Olimp:
                //  return "(function() { return document.getElementsByName('login').length; })();";
                return(string.Format("document.getElementsByName('login')[3].value = '{0}';" +
                                     "document.getElementsByName('passw')[2].value = '{1}';" +
                                     "document.getElementsByClassName('enterBtn')[0].click();", login, password));

            case Bookmaker.Leon:
                break;
            }

            return(string.Empty);
        }
コード例 #30
0
        private static void UpdateBookmaker(EBookmakers bookmaker, Settings settings)
        {
            Dictionary <EBookmakers, Bookmaker> dictionary = settings.UserSettings.BookmakersList.ToDictionary <Bookmaker, EBookmakers, Bookmaker>((Func <Bookmaker, EBookmakers>)(x => x.EBookmaker), (Func <Bookmaker, Bookmaker>)(x => x));
            Bookmaker bookmaker1 = AllBookmakersHelper.GetBookmaker(bookmaker);

            if (!dictionary.ContainsKey(bookmaker))
            {
                if (bookmaker1 == null)
                {
                    return;
                }
                settings.UserSettings.BookmakersList.Add(bookmaker1);
            }
            else if (bookmaker1 != null)
            {
                Bookmaker bookmaker2 = dictionary[bookmaker];
                bookmaker1.Login        = bookmaker2.Login;
                bookmaker1.Password     = bookmaker2.Password;
                bookmaker1.Url          = bookmaker2.Url;
                bookmaker1.Proxy        = bookmaker2.Proxy;
                bookmaker1.SportFilters = bookmaker2.SportFilters;
                throw new NotImplementedException("Додеделать как понадобиться");
            }
        }