Esempio n. 1
0
        //private string getFormattedDtring( DateTime time)
        //{
        //    char[] del = { '/' };
        //    var stdate = time.Split(del);
        //    var stDateTime = stdate[1] + "-" + stdate[0] + "-" + stdate[2]
        //                     + " " + startTime + ":00";
        //    return Convert.ToDateTime(stDateTime).ToLocalTime();

        //}

        private int generateOrGetShortMatchCode(string matchCode)
        {
            if (_shortMatchCodes.ContainsKey(matchCode))
            {
                var _savedMatchObject = _shortMatchCodes[matchCode];
                _dailyShortMatchCodeTemp = _savedMatchObject.DailyShortCode;
                return(_savedMatchObject.ShortMatchCode);
            }

            var _shortMatchCode           = ++shortMatchCode;
            var dailyShortMatchCodetoSave = ++_dailyShortMatchCode;

            _dailyShortMatchCodeTemp = dailyShortMatchCodetoSave;
            var _savedMatch = new SavedMatch
            {
                ShortMatchCode = _shortMatchCode,
                DailyShortCode = dailyShortMatchCodetoSave,
                IsAlreadysaved = false
            };

            _shortMatchCodes.Add(matchCode, _savedMatch);



            return(_shortMatchCode);
        }
Esempio n. 2
0
        private void setInitialGamesFromDb()
        {
            _shortMatchCodes = new Dictionary <string, SavedMatch>();

            lock (_getExistingGamesLock)
            {
                var dt = DateTime.Now.Date.ToString();
                var savedLiveMatches = (from db in BetDatabase.LiveMatches
                                        where db.SetDate == dt
                                        select db).ToList();// BetDatabase.LiveMatches.Where(lm => EntityFunctions.DiffDays(lm.SetDate, DateTime.Now) == 0).ToList();
                if (savedLiveMatches != null && savedLiveMatches.Count > 0)
                {
                    setInitialStaticCodeFromDb();
                    var initialDailyShortMatchCode = (from db in BetDatabase.LiveMatches
                                                      where db.BetServiceMatchNo == maxShortCodeInDb
                                                      select db.DailyShortCode).SingleOrDefault();//BetDatabase.LiveMatches.SingleOrDefault(s=>s.DailyShortCode==maxShortCodeInDb).DailyShortCode;
                    if (initialDailyShortMatchCode != 0)
                    {
                        _dailyShortMatchCode = initialDailyShortMatchCode;
                    }
                    else
                    {
                        _dailyShortMatchCode = 0;
                    }
                    foreach (var liveMatch in savedLiveMatches)
                    {
                        var savedMatch = new SavedMatch
                        {
                            ShortMatchCode = (int)liveMatch.BetServiceMatchNo,
                            DailyShortCode = liveMatch.DailyShortCode,
                            IsAlreadysaved = true,
                        };
                        _shortMatchCodes.Add(liveMatch.LiveMatchNo.ToString(), savedMatch);
                    }
                }
                else
                {
                    setInitialStaticCodeFromDb();
                    //    setInitialStaticCodeFromDb();
                    //    var initialDailyShortMatchCode = BetDatabase.LiveMatches.SingleOrDefault(slm => slm.BetServiceMatchNo.Equals(maxShortCodeInDb)).DailyShortCode;
                    //    if (initialDailyShortMatchCode != 0)
                    //    {
                    //        _dailyShortMatchCode = initialDailyShortMatchCode;

                    //    }
                    //    else
                    //    {
                    //        _dailyShortMatchCode = 0;
                    //    }
                }
            }
        }
Esempio n. 3
0
        private int generateOrGetShortMatchCode(string matchCode)
        {
            if (_shortMatchCodes.ContainsKey(matchCode))
            {
                return(_shortMatchCodes[matchCode].ShortMatchCode);
            }
            var _shortMatchCode = ++shortMatchCode;
            var _savedMatch     = new SavedMatch
            {
                ShortMatchCode = _shortMatchCode,
                IsAlreadysaved = false
            };

            _shortMatchCodes.Add(matchCode, _savedMatch);



            return(_shortMatchCode);
        }
Esempio n. 4
0
        public void setInitialGamesFromDb()
        {
            IDictionary <string, SavedMatch> _shortMatchCodes = new Dictionary <string, SavedMatch>();
            var savedLiveMatches = BetDatabase.LiveMatches.Where(lm => lm.SetDate == DateTime.Now.Date.ToString());

            if (savedLiveMatches != null)
            {
                foreach (var liveMatch in savedLiveMatches)
                {
                    var savedMatch = new SavedMatch
                    {
                        ShortMatchCode = (int)liveMatch.BetServiceMatchNo,
                        IsAlreadysaved = true,
                    };
                    _shortMatchCodes.Add(liveMatch.LiveMatchNo.ToString(), savedMatch);
                }
                var count = _shortMatchCodes;
            }
            // return _shortMatchCodes;
        }
Esempio n. 5
0
        private void setInitialGamesFromDb()
        {
            _shortMatchCodes = new Dictionary <string, SavedMatch>();

            lock (_getExistingGamesLock)
            {
                var savedLiveMatches = BetDatabase.LiveMatches.Where(lm => EntityFunctions.DiffDays(lm.SetDate, DateTime.Now) == 0).ToList();
                if (savedLiveMatches != null && savedLiveMatches.Count > 0)
                {
                    setInitialStaticCodeFromDb();
                    foreach (var liveMatch in savedLiveMatches)
                    {
                        var savedMatch = new SavedMatch
                        {
                            ShortMatchCode = (int)liveMatch.BetServiceMatchNo,
                            IsAlreadysaved = true,
                        };
                        _shortMatchCodes.Add(liveMatch.LiveMatchNo.ToString(), savedMatch);
                    }
                }
            }
        }
Esempio n. 6
0
        private SavedMatch isMatchAlreadySavedToDb(string matchCode)
        {
            SavedMatch savedMatchInList = _shortMatchCodes[matchCode];

            return(savedMatchInList);
        }