Exemple #1
0
        public IActionResult PostOdd([FromBody] Odds odds)
        {
            try
            {
                if (odds != null)
                {
                    _logger.LogInformation("API Request hit: INSERT Odds : ");
                    var result = _marketRepository.AddOdd(odds);

                    if (result == 0)
                    {
                        return(Ok("{\"status\": \"Success\"}"));
                    }
                    else
                    {
                        _logger.LogInformation("API Request (INSERT Odds : ) not committed");
                        return(NotFound("Failed: INSERT could not commit"));
                    }
                }
                else
                {
                    _logger.LogInformation("API Request hit (INSERT Odds) with null entry");
                    return(BadRequest("Failed: null entry"));
                }
            }

            catch (Exception e)
            {
                _logger.LogError("API Request (INSERT Odds) FAILED: ", e);
                return(BadRequest(e));
            }
        }
Exemple #2
0
        public IActionResult UpdateOdd([FromBody] Odds odd)
        {
            try
            {
                if (odd != null)
                {
                    _logger.LogInformation("API Request hit: UPDATE Odds : " + odd.Id);
                    var result = _marketRepository.UpdateOdd(odd);

                    if (result == 0)
                    {
                        return(Ok("{\"status\": \"Success\"}"));
                    }
                    else
                    {
                        _logger.LogInformation("API Request (UPDATE Odds : " + odd.Id + " ) not committed");
                        return(NotFound("Failed: UPDATE could not commit"));
                    }
                }
                else
                {
                    _logger.LogInformation("API Request hit (UPDATE Odds) with null entry");
                    return(BadRequest("Failed: null entry"));
                }
            }

            catch (Exception e)
            {
                _logger.LogError("API Request (UPDATE Odds) FAILED: ", e);
                return(BadRequest("Failed"));
            }
        }
Exemple #3
0
        public Odds ReadDetailedPageContent(Sport sport, Stream stream, Odds odd)
        {
            switch (sport)
            {
            case Sport.FOOTBALL: return(ReadDetailedFootballPageContent(stream, odd));

            default: return(ReadDetailedFootballPageContent(stream, odd));
            }
        }
Exemple #4
0
 /// <summary>
 /// Method to live update odds in a group for a match
 /// </summary>
 /// <param name="odds"></param>
 /// <param name="round"></param>
 public async Task BroadcastOdds(List <Decimal> odds, Round round)
 {
     Odds oddsObj = new Odds {
         Match = round.Match,
         Odds1 = odds[0],
         Odds2 = odds[1]
     };
     await Clients.Group(round.Match.Name).addOdds(oddsObj);
 }
        public override T GetItem()
        {
            double pulledValue = Odds.PercentDouble() * weightSum;
            int    index       = -1;

            do
            {
                pulledValue -= weightedTable[++index].Item2;
            } while (pulledValue > 0);
            return(weightedTable[index].Item1);
        }
Exemple #6
0
        public DTOSpecificOdds(Database.Entity.Match entity)
        {
            Key  = entity.Key;
            Odds = new Odds()
            {
                Away = entity.Odds.Away,
                Draw = entity.Odds.Draw,
                Home = entity.Odds.Home
            };

            Outcome = entity.Outcome.ToString();
            Result  = entity.FullTime != entity.Total ? $"{entity.Total} ({entity.FullTime})" : entity.FullTime;
        }
 public void ShowDefaultOdds(Odds odds)
 {
     org_odds = odds;
     _odds = ModelCopy.CopyValueForModel<Odds>(odds);
     this.Title = odds.LotteryName + "默认赔率修改";
     this.Title += ("->" + odds.PlayTypeName + "->" + odds.PlayTypeRadioName);
     this.dataForm1.CurrentItem = _odds;
     this.dataForm1.Loaded += (s, e) =>
     {
         (this.dataForm1.FindNameInContent("df_RemainCount") as DataField).Visibility = Visibility.Collapsed;
         (this.dataForm1.FindNameInContent("df_Odds") as DataField).Label = "默认赔率";
     };
     base.Show();
 }
Exemple #8
0
        public string Post([FromBody] Odds odds)
        {
            Object res = new object();

            if (AmericanOdds.IsValid(odds.odds_input))
            {
                amOdds = new AmericanOdds(odds.odds_input);
                res    = new { status = "success", data = amOdds.GetBreakEvenPercentage() };
            }
            else
            {
                res = new { status = "fail", data = "Invalid Format" };
            }
            return(JsonConvert.SerializeObject(res));
        }
Exemple #9
0
    public static Odds GetNearest(float winPercent)
    {
        var  closestDistance = 0f;
        Odds closestOdds     = null;

        foreach (var odds in Table)
        {
            var distance = Math.Abs(winPercent - odds.winPercent);
            if (closestOdds == null || distance < closestDistance)
            {
                closestDistance = distance;
                closestOdds     = odds;
            }
        }
        return(closestOdds);
    }
        private void BuildTiles()
        {
            Vector3    tileHeight = new Vector3(0, -1, 0);
            GameObject hexMap     = new GameObject("HexTiling");

            System.Type[] tileHolderComponents = new System.Type[] { typeof(MonoHexGridCell) };

            foreach (IHexGridCell tile in HexTiling.AllCells)
            {
                Vector3    tileLocation = new Vector3(tile.Position.Center.X, 0, tile.Position.Center.Y);
                GameObject tileHolder   = new GameObject(TileName(tile), tileHolderComponents);
                tileHolder.transform.position = tileLocation;
                tileHolder.transform.parent   = hexMap.transform;
                tileHolder.GetComponent <MonoHexGridCell>().HexGridCell = tile;
                tile.AddComponent(new GameObjectComponent(tileHolder));

                GameObject terrainPrefab = Odds.SelectAtRandom(terrainToGameObject[tile.GetComponent <ITerrainComponent>().GetType()]);
                GameObject terrain       = AddToTileHolder(tileHolder, terrainPrefab, tileHeight, Constants.terrainObjectName);

                if (tile.HasComponent <CreepComponent>())
                {
                    GameObject creep = AddToTileHolder(tileHolder, Odds.SelectAtRandom(enemyCreepTiles), tileHeight, Constants.creepObjectName);
                    creep.AddComponent <OnHoverOutline>();
                    tile.GetComponent <CreepComponent>().SetTileHolder(tileHolder);
                }

                if (!tile.HasComponent <UnselectableComponent>())
                {
                    terrain.AddComponent <OnHoverOutline>();
                }

                if (tile.HasComponent <TownComponent>())
                {
                    AddToTileHolder(tileHolder, goldCity);
                }

                if (tile.HasComponent <PlayerBaseComponent>())
                {
                    AddToTileHolder(tileHolder, playerBase);
                }

                if (tile.HasComponent <EnemyBaseComponent>())
                {
                    AddToTileHolder(tileHolder, enemyBase);
                }
            }
        }
Exemple #11
0
 public RTOdds(Odds odds)
 {
     _odds = odds;
     _oddsFromExactas = null;
 }