コード例 #1
0
 public void ShowForm(int MinBetSize, BetType betType)
 {
     if (this.Visible == true)
         return;
     OrderSizeUpDown.Minimum = MinBetSize;
     OrderSizeUpDown.Value = MinBetSize;
     CapotCheck.Enabled = (MinBetSize >= 250);
     bType = betType;
     switch (betType)
     {
         case BetType.T_BET:
             {
                 ContraButton.Visible = false;
                 break;
             }
         case BetType.T_BETABET:
             {
                 ContraButton.Visible = true;
                 break;
             }
         case BetType.BET_CAPOT:
             {
                 CapotCheck.Checked = true;
                 CapotCheck.Enabled = false;
                 break;
             }
     }
     ShowDialog();
 }
コード例 #2
0
        public IBetType New()
        {
            var betType = new BetType();

            this.dataContext.BetTypes.Add(betType);
            return(new BetTypeDto(betType));
        }
コード例 #3
0
        public static IList <Bet> ReadFile(string path, BetType type)
        {
            var list  = new List <Bet>();
            var lines = File.ReadAllLines(path);

            foreach (var line in lines)
            {
                var    values = line.Split(new char[] { ',' });
                int    customerID;
                int    eventID;
                int    participantID;
                double stake;
                double win;

                if (int.TryParse(values[0], out customerID) &&
                    int.TryParse(values[1], out eventID) &&
                    int.TryParse(values[2], out participantID) &&
                    double.TryParse(values[3], out stake) &&
                    double.TryParse(values[4], out win))
                {
                    list.Add(new Bet()
                    {
                        CustomerID    = customerID,
                        ParticipantID = participantID,
                        EventID       = eventID,
                        Type          = type,
                        Stake         = stake,
                        Win           = win
                    });
                }
            }
            return(list);
        }
コード例 #4
0
 public IActionResult Update(int?betTypeId, [FromBody] BetType betType)
 {
     try
     {
         if (betTypeId.HasValue && betType != null)
         {
             if (betTypeId == betType.BetTypeId)
             {
                 _betTypeService.Update(betType);
                 _logger.LogInformation($"Record with id: {betTypeId} deleted from BetType Table");
                 return(Ok("Record deleted successfully"));
             }
             else
             {
                 //_logger.LogError("Delet: Operation failed");
                 return(NotFound("There was an error trying to process the request . Record was not found"));
             }
         }
         else
         {
             return(BadRequest($"There was an error trying to process the request"));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest($"There was an error trying to process the request {ex}"));
     }
 }
コード例 #5
0
        public IActionResult Put([FromBody] BetType betType)
        {
            try
            {
                if (betType.Equals(null))
                {
                    return(StatusCode(400, StatusCodes.ReturnStatusObject("The was no data present.")));
                }
                var result = _betTypeRepository.Update(betType);

                if (result)
                {
                    _logger.LogInformation("Bet Type ID : {0} successfully updated.", betType.BetTypeId);
                    return(StatusCode(200, StatusCodes.ReturnStatusObject($"{betType.BetTypeName} was Successfully Updated.")));
                }
                else
                {
                    _logger.LogError("Bet Type : {0} was not updated.", betType.BetTypeId);
                    return(StatusCode(400, StatusCodes.ReturnStatusObject($"Update was unsuccessful.")));
                }
            }
            catch (Exception e)
            {
                _logger.LogError("The Bet Type update has failed. Error - {0}", e.Message);
                return(StatusCode(400, StatusCodes.ReturnStatusObject("The update has failed.")));
            }
        }
コード例 #6
0
        public void Update(GamePlayerModel model)
        {
            stage       = model.stage;
            status      = model.status;
            chairIndex  = model.chairIndex;
            card1       = model.card1;
            card2       = model.card2;
            orderNo     = model.orderNo;
            buyInLeft   = model.buyInLeft;
            lastBetType = model.lastBetType;
            betCount    = model.betCount;
            lastBet     = model.lastBet;
            lastCall    = model.lastCall;
            lastRaise   = model.lastRaise;
            stageBet    = model.stageBet;
            totalBet    = model.totalBet;

            result = model.result;

            userIndex = model.userIndex;
            coin      = model.coin;
            nickName  = model.nickName;
            isMyTurn  = model.isMyTurn;

            roomStage = model.roomStage;
            roomState = model.roomState;
            isWinner  = model.isWinner;
        }
コード例 #7
0
ファイル: CrapsService.cs プロジェクト: MickMelon/FalloutRPG
 public Bet(IUser user, int betAmount, BetType betType)
 {
     User      = user;
     BetAmount = betAmount;
     BetType   = betType;
     Point     = -1;
 }
コード例 #8
0
 public IActionResult Post([FromBody] BetType betType)
 {
     try
     {
         if (betType == null)
         {
             return(StatusCode(400, StatusCodes.ReturnStatusObject("No items have been provided.")));
         }
         var result = _betTypeRepository.Add(betType);
         if (result)
         {
             _logger.LogInformation("Bet Type Successfully Added");
             return(StatusCode(200, StatusCodes.ReturnStatusObject("Successfully Added.")));
         }
         else
         {
             _logger.LogError("Bet Type has Failed to Add. Bet Type - {0}", betType);
             return(StatusCode(400, StatusCodes.ReturnStatusObject("Bet Type failed to add.")));
         }
     }
     catch (Exception e)
     {
         _logger.LogError("Error Bet Type failed to add . Error - {0} , Data - {1}", e.Message, betType);
         return(StatusCode(400, StatusCodes.ReturnStatusObject("Error Bet Type Failed to Add.")));
     }
 }
コード例 #9
0
ファイル: BetslipHelper.cs プロジェクト: iadaria/PlaceBetBot
        /* Создаем поле "requestCoupon" для json ставки */
        public JToken CreateRequestCoupon(
            JArray outcomes,
            JToken checkedCoupon,
            BetType betType,
            double stake,
            bool ew)
        {
            var combinations = CreateSystemCombinations(betType, outcomes);
            var outcomeIds   = combinations?.Select(combination => combination["outcomeIds"]);

            var requestCoupon = new
            {
                allowOddsChange    = checkedCoupon["allowOddsChange"],
                odds               = checkedCoupon["odds"],
                stakes             = CreateStakes(betType, outcomes.Count(), (int)(stake * 1000)),
                outcomeIds         = checkedCoupon["outcomeIds"],
                type               = GetType(betType),
                eachWayFraction    = GetEachWayFraction(ew, outcomes),
                eachWayPlaceLimit  = GetEachWayPlaceLimit(ew, outcomes),
                betsPattern        = GenerateBetsPatternForPlace(betType, new JArray(outcomeIds)),
                systemCombinations = combinations,
                eachWay            = GetEachWay(betType, ew, outcomes.Count()),
                selection          = checkedCoupon["selection"]
            };

            return(JObject.FromObject(requestCoupon, new JsonSerializer {
                NullValueHandling = NullValueHandling.Ignore
            }));
        }
コード例 #10
0
        /**
         *  플레이어 베팅상태 업데이트
         */
        public Room SetPlayerBetting(int roomIndex, long userIdx, BetType betType, long callAmount, long betAmount)
        {
            string str       = JsonUtility.ToJson(GameServer.Instance.SetPlayerBetting(roomIndex, userIdx, (int)betType, callAmount, betAmount), true);
            Room   returnVal = JsonUtility.FromJson <Room>(str);

            return(returnVal);
        }
コード例 #11
0
        private bool IsBetGuessed(BetType betType, int?firstTeamScore, int?secondTeamScore)
        {
            if (!firstTeamScore.HasValue || !secondTeamScore.HasValue)
            {
                return(false);
            }

            switch (betType)
            {
            case BetType.One:
                return(firstTeamScore.Value > secondTeamScore.Value);

            case BetType.OneTwo:
                return(firstTeamScore.Value != secondTeamScore.Value);

            case BetType.Two:
                return(firstTeamScore.Value < secondTeamScore.Value);

            case BetType.X:
                return(firstTeamScore.Value == secondTeamScore.Value);

            case BetType.XOne:
                return(firstTeamScore.Value >= secondTeamScore.Value);

            case BetType.XTwo:
                return(firstTeamScore.Value <= secondTeamScore.Value);

            default:
                throw new Exception("Bet type not supported");
            }
        }
コード例 #12
0
        //Метод для совершения ставки, возвращает строку результата
        public string MakeBet(int accountId, decimal sum, int eventCode, BetType type)
        {
            Account user          = GetAccount(accountId);
            string  sqlExpression = "";

            try
            {
                if (user.balance < sum)
                {
                    throw new Exception("Не хватает денег, для ставки");
                }
                sqlExpression = string.Format("INSERT INTO Bets (Sum, eventCode, type, accountId,Date, Result) VALUES (@sum, @eventCode,@type,@userCode,@date,@result)");
                SqlCommand command = new SqlCommand(sqlExpression, connection);
                command.Parameters.Add(new SqlParameter("@sum", sum));
                command.Parameters.Add(new SqlParameter("@eventCode", eventCode));
                command.Parameters.Add(new SqlParameter("@type", type));
                command.Parameters.Add(new SqlParameter("@userCode", user.code));
                command.Parameters.Add(new SqlParameter("@date", DateTime.Now));
                command.Parameters.Add(new SqlParameter("@result", status.active));
                int number = command.ExecuteNonQuery();
                if (number > 0)
                {
                    Withdraw(user.code, sum);
                    return("Ставка сделана");
                }
                throw new Exception("Не удалось поставить ставку, повторите позже");
            }
            catch (Exception ex)
            {
                return(ex.Message); // ex.Message;
            }
        }
コード例 #13
0
ファイル: BetModel.cs プロジェクト: cenpengzhu/SuperMarsh
        //结算
        public bool Settle(BetType winnerType)
        {
            WinnerType = winnerType;
            double WinnerTotalValue = winnerType == BetType.singular ? SingularTotalValue : DualTotalValue;

            foreach (var eachUserBetInfo in UserBetList)
            {
                if (eachUserBetInfo.UserBetType == winnerType)
                {
                    //赢得尸体计算
                    double temp = eachUserBetInfo.UserBetValue / WinnerTotalValue * TotalValue;
                    //10000瓜子折合1千克尸体
                    temp = temp / 10000;
                    var Collection = SingleInstanceHelper.Instance.DBHelper.DataBase.GetCollection <BsonDocument>(SingleInstanceHelper.Instance.DBHelper.UserRecordCoName);
                    FilterDefinition <BsonDocument> filter = Builders <BsonDocument> .Filter.Eq(x => x["UserId"], eachUserBetInfo.UserId);

                    List <BsonDocument> UserInDB = Collection.Find(filter).ToList();
                    if (UserInDB != null && UserInDB.Count > 0)
                    {
                        var tempUserRecord = new UserRecordModel();
                        tempUserRecord.FromBson(UserInDB[0]);
                        tempUserRecord.UserGetWeight += temp;
                        var TempBson = BsonSerializer.Deserialize <BsonDocument>(JsonHelper.getJsonByObject(tempUserRecord));
                        SingleInstanceHelper.Instance.DBHelper.Save(SingleInstanceHelper.Instance.DBHelper.UserRecordCoName, TempBson, "UserId");
                        //记录流水
                        UserGetWeightWaterRecordHelper.WaterRecord(tempUserRecord.UserName, tempUserRecord.UserId, temp, "增加", "竞猜获胜");
                    }
                }
            }
            DumpToDB();
            return(true);
        }
コード例 #14
0
        public void MakeBet(int accCode, decimal amount, BetType type, List <Event> results)
        {
            var bet = new Bet
            {
                Amount       = amount,
                BetDate      = DateTime.Now,
                Account_Code = accCode
            };

            switch (type)
            {
            case BetType.Simple:
                bet.Win_Amount = SetSimpleWin(amount, results.First());
                bet.Results    = results.First().Name;
                break;

            case BetType.System:
                break;

            case BetType.SuperExpress:
                break;
            }
            db.Bets.InsertOnSubmit(bet);
            db.SubmitChanges();
        }
コード例 #15
0
        public static IList<Bet> ReadFile(string path, BetType type)
        {
            var list = new List<Bet>();
            var lines = File.ReadAllLines(path);

            foreach (var line in lines)
            {
                var values = line.Split(new char[] { ',' });
                int customerID;
                int eventID;
                int participantID;
                double stake;
                double win;

                if (int.TryParse(values[0], out customerID) &&
                    int.TryParse(values[1], out eventID) &&
                    int.TryParse(values[2], out participantID) &&
                    double.TryParse(values[3], out stake) &&
                    double.TryParse(values[4], out win))
                {
                    list.Add(new Bet()
                    {
                        CustomerID = customerID,
                        ParticipantID = participantID,
                        EventID = eventID,
                        Type = type,
                        Stake = stake,
                        Win = win
                    });
                }
            }
            return list;
        }
コード例 #16
0
        public void SetGamePlayer(GamePlayer gamePlayer, Room room)
        {
            stage       = gamePlayer.stage;
            status      = (GamePlayerState)gamePlayer.state;
            chairIndex  = gamePlayer.chairIndex;
            card1       = gamePlayer.card1;
            card2       = gamePlayer.card2;
            orderNo     = gamePlayer.orderNo;
            buyInLeft   = gamePlayer.buyInLeft;
            lastBetType = (BetType)gamePlayer.lastBetType;
            betCount    = gamePlayer.betCount;
            lastBet     = gamePlayer.lastBet;
            lastCall    = gamePlayer.lastCall;
            lastRaise   = gamePlayer.lastRaise;
            stageBet    = gamePlayer.stageBet;
            totalBet    = gamePlayer.totalBet;

            userIndex = gamePlayer.userIndex;
            coin      = gamePlayer.coin;
            nickName  = gamePlayer.nickName;
            result    = gamePlayer.result;

            isMyTurn = gamePlayer.userIndex == room.currentUserIndex && roomStage % 3 == 0;

            betCount  = room.betCount;
            roomStage = room.stage;
            isWinner  = room.winnerUserIndex == gamePlayer.userIndex;
            roomState = (int)room.state;
        }
コード例 #17
0
        public BetCalculationViewModel CalculateBet(BetType betType, double backStake, double backOdds, double layOdds,
                                                    double layCommission)
        {
            var betCalcViewModel =
                _betCalculationService.CalculateBet(betType, backStake, backOdds, layOdds, layCommission);

            return(betCalcViewModel);
        }
コード例 #18
0
        public async Task <BetType> Post([FromBody] BetType betType)
        {
            var Name = new SqlParameter("@name", betType.BetName);
            var EID  = new SqlParameter("@EID", betType.EventID);

            var Added = await _context.BetTypes.FromSql("InsertBetType @name, @EID", Name, EID).FirstOrDefaultAsync();

            return(Added);
        }
コード例 #19
0
        public static BetType DBCopy(this BetType betType, VilkaEntities context)
        {
            if (betType == null)
            {
                return(null);
            }

            return(context.BetTypes.Where((b) => b.ID == betType.ID).FirstOrDefault());
        }
コード例 #20
0
        public async Task <List <BetType> > Put(int id, [FromBody] BetType betType)
        {
            var ID   = new SqlParameter("@ID", id);
            var Name = new SqlParameter("@name", betType.BetName);

            var Edit = await _context.BetTypes.FromSql("UpdateBetType @ID, @name", ID, Name).ToListAsync();

            return(Edit);
        }
コード例 #21
0
ファイル: BetslipHelper.cs プロジェクト: iadaria/PlaceBetBot
        /* Генерируем паттерн для валидации купона из всевозможных комбинаций, всегда 1*/
        // "1111111" для Treble(1 + 2 + 3 + 12 + 13 + 23 + 123) 7 комбинаций
        public string GetBetsPatternForValidate(BetType betType, int selectionCount)
        {
            var pattern = string.Empty;

            for (int of = 1; of <= selectionCount; of++)
            {
                pattern += new string('1', combination(selectionCount, of));
            }
            return(pattern);
        }
コード例 #22
0
        public async Task <List <BetType> > Delete(int id)
        {
            BetType betType = await Get(id);

            var ID = new SqlParameter("@ID", betType.id);

            var Deleted = await _context.BetTypes.FromSql("DeleteBetType @ID", ID).ToListAsync();

            return(Deleted);
        }
コード例 #23
0
        public void Init()
        {
            betType  = BetType.Fivefolds;
            stake    = 0.01;
            ew       = true;
            helper   = new BetslipHelper();
            outcomes = InitOutcomes();
            logger   = InitLogger();

            logger.LogDebug($"Was generated outcome:\n{outcomes.GetDump()}");
        }
コード例 #24
0
 /// <summary>
 /// Constructor.
 /// Creates a LowHighBet for the provided bet type.
 /// </summary>
 public LowHighBet(BetType betType) : this()
 {
     if (betType == BetType.Low || betType == BetType.High)
     {
         _betType = betType;
     }
     else
     {
         throw new Exception("LowHighBet(BetType betType): betType must be Low or High.");
     }
 }
コード例 #25
0
 /// <summary>
 /// Constructor.
 /// Creates a RedBlackBet for the provided bet type.
 /// </summary>
 public RedBlackBet(BetType betType) : this()
 {
     if (betType == BetType.Red || betType == BetType.Black)
     {
         _betType = betType;
     }
     else
     {
         throw new Exception("RedBlackBet(BetType betType): betType must be Red or Black.");
     }
 }
コード例 #26
0
 /// <summary>
 /// Constructor.
 /// Creates a EvenOddBet for the provided bet type.
 /// </summary>
 public EvenOddBet(BetType betType) : this()
 {
     if (betType == BetType.Even || betType == BetType.Odd)
     {
         _betType = betType;
     }
     else
     {
         throw new Exception("EvenOddBet(BetType betType): betType must be Even or Odd.");
     }
 }
コード例 #27
0
        public IBetCalculatorStrategy Create(BetType betType)
        {
            var availableStrategy = _availableBetCalculatorStrategies?.FirstOrDefault(x => x.BetType == betType);

            if (availableStrategy == null)
            {
                throw new InvalidOperationException($"not strategy available for Bet Type: {betType}");
            }

            return(availableStrategy);
        }
コード例 #28
0
 /// <summary>
 /// Constructor.
 /// Creates a ColumnBet for the provided bet type.
 /// </summary>
 public ColumnBet(BetType betType) : this()
 {
     if (betType == BetType.FirstColumn || betType == BetType.SecondColumn || betType == BetType.ThirdColumn)
     {
         _betType = betType;
     }
     else
     {
         throw new Exception("ColumnBet(BetType betType): betType must be FirstColumn, SecondColumn, or ThirdColumn.");
     }
 }
コード例 #29
0
ファイル: DozenBet.cs プロジェクト: prbasha/RouletteSimulator
 /// <summary>
 /// Constructor.
 /// Creates a DozenBet for the provided bet type.
 /// </summary>
 public DozenBet(BetType betType) : this()
 {
     if (betType == BetType.FirstDozen || betType == BetType.SecondDozen || betType == BetType.ThirdDozen)
     {
         _betType = betType;
     }
     else
     {
         throw new Exception("DozenBet(BetType betType): betType must be FirstDozen, SecondDozen, or ThirdDozen.");
     }
 }
コード例 #30
0
        public void Init()
        {
            betType  = BetType.SuperYankee;
            stake    = 0.01;
            ew       = false;
            helper   = new BetslipHelper();
            outcomes = InitOutcomes();
            logger   = InitLogger();

            logger.LogDebug($"Was generated outcome:\n{outcomes.GetDump()}");
        }
コード例 #31
0
        // --------------- HELPERS ---------------

        public double GetBetAmount(Match match, BetType t)
        {
            if (t == BetType.BetHome)
            {
                return(match.HomeWins);
            }
            if (t == BetType.BetTied)
            {
                return(match.Tied);
            }
            return(match.AwayWins);
        }
コード例 #32
0
ファイル: BetslipHelper.cs プロジェクト: iadaria/PlaceBetBot
        /*Генерируем поле json - "stakes" прим. Doubles из 3 + EW price 0,1: "stakes": [ 100, 100, 100 ],*/
        private JArray CreateStakes(BetType betType, int from, int stake)
        {
            var stakes   = new JArray();
            var countBet = BetTypeUtils.GetNumberOfInternalBets(betType, from, false);

            for (int i = 1; i <= countBet; i++)
            {
                stakes.Add(stake);
            }

            return(stakes);
        }
コード例 #33
0
 // Показ экрана совершения ставки
 public void ShowBetScreen(int BetSize, BetType BetType)
 {
     if (BetType == BetType.BET_SURCOINCHE)
     {
         betForm4 = new BetFormType4(this.Game);
         betForm4.ShowDialog();
         betForm4 = null;
     }
     else
     {
         betForm123.ShowForm(BetSize, BetType);
     }
 }
コード例 #34
0
ファイル: Hfapi.cs プロジェクト: XenocodeRCE/HFAPI
        /// <summary>
        /// Permet de parier une somme de crédit X contre un utilisateur
        /// </summary>
        /// <param name="username">L'Username de la personne contre laquelle vous pariez</param>
        /// <param name="montant">En int, minimum 50 maximum 10,000</param>
        /// <param name="bet">Choisir le <type cref="BetType"/> de partie : Public, Private, System</param>
        /// <remark>Ne permet pas de savoir si on gagne ou on perd !</remark>
        public static void Bet(string username, string montant, BetType bet)
        {
            var betpoints = montant.ToString();

            var response = MyWebClient.UploadValues("http://hack-free.net/newpoints.php", new NameValueCollection()
           {
               { "my_post_key", PostKey },
               { "action", "betting"},
               { "type", bet.ToString() },
               { "username", username },
               { "points", betpoints },
               { "submit", "Affronter" }
           });

            var result = System.Text.Encoding.UTF8.GetString(response);
        }
コード例 #35
0
ファイル: Bet.cs プロジェクト: davedf/tdd-exercises-csharp
 public Bet(Player p, int value,BetType betType)
 {
     this.p = p;
     this.betValue = value;
     this.betType = betType;
 }
コード例 #36
0
ファイル: Board.cs プロジェクト: athigan/FPCD-Casino
 public void DisplayBet(int money,BetType bt)
 {
 }
コード例 #37
0
 // Показ экрана совершения ставки
 public void ShowBetScreen(int BetSize, BetType BetType)
 {
 }