/// <summary> /// 卡号选择SelectedIndexChanged事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dropExpensesAddCardNumber_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.dropExpensesAddCardNumber.SelectedValue)) { this.dropExpensesAddOwner.Enabled = true; List <DropItem> list = new List <DropItem>(); list.Add(new DropItem { ValueField = "", DisplayField = " " }); CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(this.dropExpensesAddCardNumber.SelectedValue)); UserCollection coll = ExpensesMethods.GetOwnerByCardNumber(cardInfo.CardNumber); if (coll != null && coll.Count > 0) { for (int i = 0; i < coll.Count; i++) { list.Add(new DropItem { ValueField = coll[i].Id.ToString(), DisplayField = coll[i].Name }); } this.dropExpensesAddOwner.DataSource = list; Helper.SetDropDownList(this.dropExpensesAddOwner); } } else { this.dropExpensesAddOwner.Enabled = false; this.dropExpensesAddOwner.DataSource = new List <DropItem>(); this.dropExpensesAddOwner.SelectedValue = string.Empty; } }
private void BindBorrowListDataGrid(List<QueryElement> list) { BorrowORLoanCollection coll = BorrowedMethods.GetBorrowList(list); this.BorrowListDataGrid.DataSource = coll; this.BorrowListDataGrid.DataBind(); for (int i = 0; i < coll.Count; i++) { CardInfo cardInfo = CardMethods.GetCardById(coll[i].BorrowORLoanAccountId); string bank = StaticRescourse.DisplayBank(cardInfo.BankId); this.BorrowListDataGrid.Items[i].Cells[4].Text = coll[i].BorrowedAccount + " " + bank; this.BorrowListDataGrid.Items[i].Cells[8].Text = coll[i].HappenedDate.ToString("yyyy-MM-dd"); this.BorrowListDataGrid.Items[i].Cells[2].Text = StaticRescourse.DisplayBorrowORLoanType(coll[i].BorrowORLoanType); bool dateFlag = HelperCommon.CompareAccordToRequired(coll[i].ReturnDate); if (dateFlag) { this.BorrowListDataGrid.Items[i].Cells[9].Text = coll[i].ReturnDate.ToString("yyyy-MM-dd"); } else { this.BorrowListDataGrid.Items[i].Cells[9].Text = string.Empty; } if (coll[i].Status == 2) { this.BorrowListDataGrid.Items[i].Cells[10].Text = "已还"; } else { this.BorrowListDataGrid.Items[i].Cells[10].Text = "未还"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //if (Application["user"] != null) //{ if (!string.IsNullOrEmpty(Request.QueryString["CardSettingId"])) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayCardEditdiv();", true); CardInfo info = CardMethods.GetCardById(Convert.ToInt32(Request.QueryString["CardSettingId"])); Initialize(info); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplaySysdiv();", true); } BindDataGrid(queryList); //} //else //{ // Response.Redirect("~/Views/Login.aspx"); // Alert.Show(this, "请先登录!"); //} } }
/****************************** * Initializing *******************************/ private static void initializeComponents() { string textFilePath = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())) + @"\Data\DataEncr.txt"; //http://stackoverflow.com/questions/14549766/how-to-get-my-project-path ExtensionMethods.niceLayout("INITIALIZING ELEMENTS"); InitializeObjects.readDataFromTextFile(textFilePath, '\t', citylist, LongDestDeck, NormDestDeck, tracks); InitializeObjects.addTrainCards(trainCardDeck); foreach (City stad in citylist) { Program.logboek.WriteLine(stad.ToString()); ExtensionMethods.niceLayout(""); } ExtensionMethods.niceLayout("Start Game"); Program.logboek.WriteLine("SHUFFLING CARDS"); CardMethods <LongDestCard> .shuffle(LongDestDeck); Program.logboek.WriteLine("\tlong destination cards shuffled"); CardMethods <NormDestCard> .shuffle(NormDestDeck); Program.logboek.WriteLine("\tnormal destination cards shuffled"); CardMethods <TrainCard> .shuffle(trainCardDeck); Program.logboek.WriteLine("\ttraincards shuffled"); }
private void initializePlayers(List <foto> pics) { ExtensionMethods.niceLayout("initialziing players"); Program.logboek.WriteLine("asking input from playerform"); FormDataObject data = new FormDataObject(); AmountofPlayersForm form = new AmountofPlayersForm(pics, data); /****************************** * Ask user here how many and if he wants to play with intelligent bots bl *******************************/ form.ShowDialog(); int realplayers = data.getReal(); int coOps = data.getCoOps(); Program.logboek.WriteLine("real players:\t" + realplayers); Program.logboek.WriteLine("Robots:\t" + coOps); ExtensionMethods.niceLayout("Adding Players and deviding the cards"); InitializeObjects.addPlayers(players, pics, realplayers, coOps, citylist, tracks); CardMethods <AbstrDestCard> .devideCards(players, LongDestDeck, NormDestDeck, trainCardDeck); foreach (Player player in players) { Program.logboek.WriteLine(player.ToString()); } ExtensionMethods.niceLayout("remaining cards"); Program.logboek.WriteLine(trainCardDeck.ToArray().Length + " traincards"); Program.logboek.WriteLine(NormDestDeck.ToArray().Length + " normdestcards"); Program.logboek.WriteLine(LongDestDeck.ToArray().Length + " longdestcards"); }
/****************************** * Adding The players *******************************/ public static void addPlayers(List <Player> playerList, List <foto> pics, int realPlayers, int robots, List <City> citylist, List <Railroad> network) { List <Player> botPlayer = new List <Player>(); IntelligentPlayer Emiel = new IntelligentPlayer("Emile", System.Drawing.Color.Blue, citylist, network); botPlayer.Add(Emiel); IntelligentPlayer Dirk = new IntelligentPlayer("Dirkske", System.Drawing.Color.Red, citylist, network); botPlayer.Add(Dirk); IntelligentPlayer Luka = new IntelligentPlayer("Luka", System.Drawing.Color.Yellow, citylist, network); botPlayer.Add(Luka); IntelligentPlayer Jeff = new IntelligentPlayer("Jeff", System.Drawing.Color.Black, citylist, network); botPlayer.Add(Jeff); for (int i = 0; i < robots; i++) { CardMethods <Player> .swapCardFromDeck(botPlayer, playerList); } /****************************** * Ask user here player data *******************************/ for (int i = 0; i < realPlayers; i++) { PlayerData data = new PlayerData(); PlayerDialog form = new PlayerDialog(data, pics); while (data.getName() == null || data.getColor() == null) { form.ShowDialog(); } Player a = new Player(data.getName(), data.getColor()); playerList.Add(a); } Program.logboek.WriteLine(string.Format("{0} players added", playerList.Count)); }
protected void btnLoanAddSubmit_Click(object sender, EventArgs e) { BorrowORLoanInfo loanInfo = new BorrowORLoanInfo(); if (!string.IsNullOrEmpty(this.HiddenField1.Value.Trim())) { loanInfo.Id = Convert.ToInt32(this.HiddenField1.Value.Trim()); } else { loanInfo.Id = 0; } #region 验证 if (!CheckLoanAddForm()) { string type = this.RadioLoanAddLoanType.SelectedValue; string temp = this.HidderField2.Value; this.ClientScript.RegisterStartupScript(this.GetType(), "fillForm", "DisplayAddLoandiv('" + type + "');fillFormField({loanAccount:'" + temp + "'});", true); return; } #endregion loanInfo.Borrower = this.txtLoanAddBorrower.Text.Trim(); if (this.RadioLoanAddLoanType.SelectedValue == "2" && !string.IsNullOrEmpty(this.HidderField2.Value.Trim())) { string[] s = this.HidderField2.Value.Split(','); CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(s[0])); loanInfo.LoanAccount = cardInfo.CardNumber; loanInfo.BorrowORLoanAccountId = cardInfo.Id; } loanInfo.Lender = this.txtLoanAddLender.Text.Trim(); loanInfo.BorrowedAccount = this.txtLoanAddBorrowAccount.Text.Trim(); loanInfo.BorrowORLoanType = Convert.ToInt32(this.RadioLoanAddLoanType.SelectedValue); loanInfo.Amount = Convert.ToSingle(this.txtLoanAddLoanAmount.Text.Trim()); loanInfo.HappenedDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtLoanAddLoanDate.Text.Trim())); if (!string.IsNullOrEmpty(this.txtLoanAddReturnDate.Text.Trim())) { loanInfo.ReturnDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtLoanAddReturnDate.Text.Trim())); } loanInfo.Status = Convert.ToInt32(this.dropLoanAddStatus.SelectedValue); loanInfo.Content = this.txtLoanAddContent.Text.Trim(); int iSuccess = LoanMethods.InsertOrUpdatetoLoan(loanInfo); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddLoandiv();", true); if (iSuccess == 1) { Alert.Show(this, "新增一条收入成功!"); } else if (iSuccess == 2) { Alert.Show(this, "修改成功!"); } else { Alert.Show(this, "操作失败!"); } queryList = new List <QueryElement>(); BindLoanListDataGrid(queryList); }
public override string ToString() { string text = "\n\t" + name + '\t' + '(' + (color) + ')' + '\n' + "punten\n\t" + points + "\nStationnen" + StationsToString() + '\n' + "Amount of trains:\n\t" + (amountOfTrains - 8) + '\n' + "DestinationCards:" + CardMethods <AbstrDestCard> .getCardValues(DestinationCards) + '\n' + "Traincards:" + '\n' + CardMethods <TrainCard> .getAllSortedTrainCards(traincards) + '\n'; return(text); }
internal static void CheckSizeOfMainDeck(List <TrainCard> Deck) { if (Deck.Count < 5) // we add the used cards to the deck and shuffle the deck if the deck gets bigger { while (usedCardsDeck.Count > 5) { CardMethods <TrainCard> .swapCardFromDeck(usedCardsDeck, Deck); } CardMethods <TrainCard> .shuffle(Deck); } }
private void BindDataGrid(List <QueryElement> list) { cardColl = CardMethods.GetCard(list); this.CardListDataGrid.DataSource = cardColl; this.CardListDataGrid.DataBind(); for (int i = 0; i < cardColl.Count; i++) { this.CardListDataGrid.Items[i].Cells[2].Text = StaticRescourse.DisplayAccountType(cardColl[i].AccountType); this.CardListDataGrid.Items[i].Cells[3].Text = StaticRescourse.DisplayBank(cardColl[i].BankId); } }
public static bool PickNormDestinationCard(List <NormDestCard> destinationcard, Player player) { NormDestCard card = CardMethods <AbstrDestCard> .pickAndRemoveCardsFromDeck(destinationcard); player.addCard(card); Program.logboek.WriteLine(player.GetName() + " picked:\t" + card.ToString()); if (!(player is IntelligentPlayer)) { MessageBox.Show(string.Format("You picked:\n\t" + card.ToString())); } return(true); } // ez done
/// <summary> /// 初始化卡号(新增) /// </summary> private void InitializeDropExpensesDropControl() { List <CardHelper> cardNumberList = new List <CardHelper>(); List <CardHelper> cxList = new List <CardHelper>(); CardCollection cardcoll = new CardCollection(); //返回的卡的collection cardcoll = CardMethods.GetCard(new List <QueryElement>()); List <DropItem> card = new List <DropItem>(); card.Add(new DropItem { ValueField = "", DisplayField = " " }); for (int i = 0; i < cardcoll.Count; i++) { CardInfo info = cardcoll[i]; cardNumberList.Add(new CardHelper { CardId = info.Id, BankId = info.BankId, CardNumber = info.CardNumber }); } cxList.AddRange(cardNumberList.OrderBy(x => x.CardNumber)); cardNumberList.Clear(); for (int i = 0; i < cxList.Count; i++) { if (i == 0 || cxList[i].CardNumber != cxList[i - 1].CardNumber) { cardNumberList.Add(new CardHelper { CardId = cxList[i].CardId, BankId = cxList[i].BankId, CardNumber = cxList[i].CardNumber }); } } for (int i = 0; i < cardNumberList.Count; i++) { var cardInfo = cardNumberList[i]; string bank = StaticRescourse.DisplayBank(cardInfo.BankId); card.Add(new DropItem { ValueField = cardInfo.CardId.ToString(), DisplayField = cardInfo.CardNumber + " " + bank }); // +" "+bank } this.dropExpensesAddCardNumber.DataSource = card; Helper.SetDropDownList(this.dropExpensesAddCardNumber); this.dropExpensesAddSpendMode.DataSource = StaticRescourse.GetSpendMode(); Helper.SetDropDownList(this.dropExpensesAddSpendMode); this.dropExpensesAddSpendType.DataSource = StaticRescourse.GetSpendType(); Helper.SetDropDownList(this.dropExpensesAddSpendType); }
private static void Header(List <TrainCard> visibleTraincards, int roundNumber, Player player) { Program.logboek.WriteLine(""); Program.logboek.WriteLine(""); //ExtensionMethods.WaitForUser(); // Console.Clear(); Program.logboek.WriteLine("Round " + roundNumber); Program.logboek.WriteLine("De zichtbare kaarten zijn"); Program.logboek.WriteLine(CardMethods <TrainCard> .getCardValues(visibleTraincards)); Program.logboek.WriteLine(player.ToString()); Program.logboek.WriteLine("-----------------------------------"); Program.logboek.WriteLine("Turn:\t" + player.GetName()); Program.logboek.WriteLine("\t1.\tPick some TrainCards\n\t" + "2.\tBuild a track between 2 cities\n\t" + "3.\tPick a destination Card\n\t" + "4.\tBuild a station"); }
private void BindExpensesListDataGrid(List <QueryElement> list) { ExpensesCollection coll = ExpensesMethods.GetExpensesList(list); this.ExpensesListDataGrid.DataSource = coll; this.ExpensesListDataGrid.DataBind(); for (int i = 0; i < coll.Count; i++) { ExpensesInfo expenses = coll[i]; CardInfo cardInfo = CardMethods.GetCardByCardNumber(expenses.CardNumber, expenses.OwnerId); string bank = StaticRescourse.DisplayBank(cardInfo.BankId); this.ExpensesListDataGrid.Items[i].Cells[4].Text = StaticRescourse.DisplaySpendType(expenses.SpendType); this.ExpensesListDataGrid.Items[i].Cells[6].Text = expenses.SpendDate.ToString("yyyy-MM-dd"); this.ExpensesListDataGrid.Items[i].Cells[7].Text = StaticRescourse.DisplaySpendMode(expenses.SpendMode); } }
/******************** * wou met events handlers werken en wachten op input wan de console * (om zoveel mogelijk de data/ onderliggende objecten af te schermen) * maar had hiervoor een asynchrone methode voor nodig en had een beetje tijdtekort, * heb me vooral gefocust op intelligentie en een werkend programma *********************/ public Round(Game game, List <foto> gamePics) { this.gamePics = gamePics; citylist = game.getcitylist(); destinationcard = game.getNormDestcard(); deck = game.getDeck(); network = game.getNetwork(); playerlist = game.getPlayers(); for (int i = 0; i < 5; i++) { CardMethods <TrainCard> .swapCardFromDeck(deck, visibleTraincards); // we pick the first 5 cards from the deck and put them in the visible pack } visibleTraincards.Sort(); Program.form.refreshVisibleTrainCards(visibleTraincards); }
protected void btnCardAddSave_Click(object sender, EventArgs e) { #region 验证 if (string.IsNullOrEmpty(this.txtAddCardNumber.Text.Trim())) { Alert.Show(this, "请输入卡号!"); this.txtAddCardNumber.Focus(); return; } if (string.IsNullOrEmpty(this.txtAddCardOpenDate.Text.Trim())) { Alert.Show(this, "开户日期不能为空!"); this.txtAddCardOpenDate.Focus(); return; } #endregion CardInfo cardInfo = new CardInfo(); cardInfo.BankId = Convert.ToInt32(this.dropAddBank.SelectedValue); cardInfo.CardNumber = this.txtAddCardNumber.Text.Trim(); cardInfo.AccountType = Convert.ToInt32(this.dropCardAddAccountType.SelectedValue); cardInfo.OwnerId = Convert.ToInt32(this.dropAddCardOwner.SelectedValue); cardInfo.OwnerCode = UserMethods.GetUserById(Convert.ToInt32(this.dropAddCardOwner.SelectedValue)).Code; if (!string.IsNullOrEmpty(this.dropAddCardUser.SelectedValue)) { cardInfo.UserId = Convert.ToInt32(this.dropAddCardUser.SelectedValue); cardInfo.UserCode = UserMethods.GetUserById(Convert.ToInt32(this.dropAddCardUser.SelectedValue)).Code; } else { cardInfo.UserId = 0; cardInfo.UserCode = string.Empty; } cardInfo.BankName = this.txtAddBankName.Text.Trim(); cardInfo.OpenDate = Convert.ToDateTime(this.txtAddCardOpenDate.Text.Trim()); cardInfo.Content = this.txtCardAddContent.Text.Trim(); int i = CardMethods.InsertOrUpdatetoCard(cardInfo); if (i > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "closeWin();", true); } }
private void CardEditSubmit(ref int i) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayCardAdddiv();", true); #region 验证 // if (string.IsNullOrEmpty(Request.Form["txtAddCardNumber"].ToString())) if (string.IsNullOrEmpty(this.txtAddCardNumber.Text.Trim())) { Alert.Show(this, "请输入卡号!"); this.txtAddCardNumber.Focus(); return; } if (string.IsNullOrEmpty(this.txtAddCardOpenDate.Text.Trim())) { Alert.Show(this, "开户日期不能为空!"); this.txtAddCardOpenDate.Focus(); return; } #endregion CardInfo cardInfo = new CardInfo(); cardInfo.BankId = Convert.ToInt32(this.dropAddBank.SelectedValue); //cardInfo.CardNumber = Request.Form["txtAddCardNumber"].ToString().Trim(); cardInfo.CardNumber = this.txtAddCardNumber.Text.Trim(); cardInfo.AccountType = Convert.ToInt32(this.dropCardAddAccountType.SelectedValue); cardInfo.OwnerId = Convert.ToInt32(this.dropAddCardOwner.SelectedValue); cardInfo.OwnerCode = UserMethods.GetUserById(Convert.ToInt32(this.dropAddCardOwner.SelectedValue)).Code; if (!string.IsNullOrEmpty(this.dropAddCardUser.SelectedValue)) { cardInfo.UserId = Convert.ToInt32(this.dropAddCardUser.SelectedValue); cardInfo.UserCode = UserMethods.GetUserById(Convert.ToInt32(this.dropAddCardUser.SelectedValue)).Code; } else { cardInfo.UserId = 0; cardInfo.UserCode = string.Empty; } cardInfo.BankName = this.txtAddBankName.Text.Trim(); cardInfo.OpenDate = Convert.ToDateTime(this.txtAddCardOpenDate.Text.Trim()); cardInfo.Content = this.txtCardAddContent.Text.Trim(); i = CardMethods.InsertOrUpdatetoCard(cardInfo); }
private void BindIncomeListDataGrid(List <QueryElement> list) { CashIncomeCollection coll = CashIncomeMethods.GetCashIncome(list); this.IncomeListDataGrid.DataSource = coll; this.IncomeListDataGrid.DataBind(); for (int i = 0; i < coll.Count; i++) { CashIncomeInfo cashInfo = coll[i]; CardInfo cardInfo = CardMethods.GetCardByCardNumber(cashInfo.CardNumber, cashInfo.OwnerId); string bank = StaticRescourse.DisplayBank(cardInfo.BankId); this.IncomeListDataGrid.Items[i].Cells[1].Text = StaticRescourse.DisplayIncomeStatus(cashInfo.Status); this.IncomeListDataGrid.Items[i].Cells[4].Text = StaticRescourse.DisplayIncomeType(cashInfo.IncomeType); this.IncomeListDataGrid.Items[i].Cells[6].Text = StaticRescourse.DisplayMode(cashInfo.Mode); this.IncomeListDataGrid.Items[i].Cells[7].Text = StaticRescourse.DisplayRate(cashInfo.Rate); this.IncomeListDataGrid.Items[i].Cells[8].Text = cashInfo.DepositDate.ToString("yyyy-MM-dd"); if (cashInfo.AutoSave == 1) { this.IncomeListDataGrid.Items[i].Cells[12].Text = "是"; } else { this.IncomeListDataGrid.Items[i].Cells[12].Text = "否"; } if (HelperCommon.CompareAccordToRequired(cashInfo.BDate)) { this.IncomeListDataGrid.Items[i].Cells[9].Text = cashInfo.BDate.ToString("yyyy-MM-dd"); } else { this.IncomeListDataGrid.Items[i].Cells[9].Text = string.Empty; } if (HelperCommon.CompareAccordToRequired(cashInfo.EDate)) { this.IncomeListDataGrid.Items[i].Cells[10].Text = cashInfo.EDate.ToString("yyyy-MM-dd"); } else { this.IncomeListDataGrid.Items[i].Cells[10].Text = string.Empty; } this.IncomeListDataGrid.Items[i].Cells[13].Text = StaticRescourse.DisplayIncomeDepositMode(cashInfo.DepositMode); } }
public async Task <Deck> UpdateDeck(Guid deckId, Guid cardId) { int j = 0; FilterDefinition <Deck> deckFilter = Builders <Deck> .Filter.Eq(deck => deck.Id, deckId); FilterDefinition <Player> playerFilter = Builders <Player> .Filter.ElemMatch(player => player.DecksOwned, deckFilter); Player player = await _playerCollection.Find(playerFilter).FirstAsync(); if (player == null) { throw new NotFoundException(); } var cardCreation = new CardMethods(); Card newcard = cardCreation.AddANewCard(); for (int i = 0; i < player.DecksOwned.Count; i++) { foreach (var deck in player.DecksOwned) { if (deck.Id == deckId) { foreach (var card in deck.Cards_InDeck) { if (card.Id == cardId) { player.DecksOwned[i].Cards_InDeck.RemoveAt(j); player.DecksOwned[i].Cards_InDeck.Add(newcard); player = await _playerCollection.FindOneAndReplaceAsync(playerFilter, player); return(player.DecksOwned[i]); } j++; } } } } return(null); }
public static List <DropItem> getLoanAccountByPerson(string loanName) { UserInfo userInfo = UserMethods.GetUserByName(loanName); if (userInfo.Id > 0) { CardCollection coll = CardMethods.GetCardByUserId(userInfo.Id); List <DropItem> list = new List <DropItem>(); //list.Add(new DropItem { ValueField = "", DisplayField = " " }); for (int i = 0; i < coll.Count; i++) { string bank = StaticRescourse.DisplayBank(coll[i].BankId); list.Add(new DropItem { ValueField = coll[i].Id.ToString(), DisplayField = coll[i].CardNumber + " " + bank }); } return(list); } return(new List <DropItem>()); }
/*---------- ---------- ---------- ---------- ----------*/ // Deck related // Creating decks, getting decks, deleting & modifying decks // public async Task <Deck> CreateDeck(Guid playerId) { var filter = Builders <Player> .Filter.Eq(player => player.Id, playerId); var deckCreation = new CardMethods(); var deck = deckCreation.CreateADeck(); deck.Id = Guid.NewGuid(); var pushDeck = Builders <Player> .Update.Push(player => player.DecksOwned, deck); FindOneAndUpdateOptions <Player> options = new FindOneAndUpdateOptions <Player>() { ReturnDocument = ReturnDocument.After }; Player player = await _playerCollection.FindOneAndUpdateAsync(filter, pushDeck, options); return(deck); }
protected void CardListDataGrid_DeleteCommand(object source, DataGridCommandEventArgs e) { TableCell itemcell = e.Item.Cells[0]; string ids = itemcell.Text; int id = Convert.ToInt32(ids); int iSuccess = CardMethods.DeleteCard(id); if (iSuccess == 1) { Alert.Show(this, "删除成功!"); } else { Alert.Show(this, "删除失败!"); } if (queryList == null) { queryList = new List <QueryElement>(); } BindDataGrid(queryList); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["CardNumber"])) { this.labTitle.Text = "卡信息维护--编辑"; this.txtAddCardNumber.Enabled = false; this.dropAddCardOwner.Enabled = false; this.dropAddBank.Enabled = false; this.dropCardAddAccountType.Enabled = false; this.txtAddCardOpenDate.Enabled = false; this.dropAddCardUser.Focus(); CardInfo cardInfo = CardMethods.GetCardByCardNumber(Request.QueryString["CardNumber"]); InitializeEdit(cardInfo); } else { this.labTitle.Text = "卡信息维护--新增"; this.txtAddCardNumber.Focus(); Initialize(); } } }
/// <summary> /// 初始化卡号(新增) /// </summary> private void InitializeDropIncomeCardNumber() { CardCollection cardcoll = new CardCollection(); List <QueryElement> list = new List <QueryElement>(); cardcoll = CardMethods.GetCard(list); List <DropItem> card = new List <DropItem>(); card.Add(new DropItem { ValueField = "", DisplayField = " " }); for (int i = 0; i < cardcoll.Count; i++) { CardInfo cardInfo = cardcoll[i]; string bank = StaticRescourse.DisplayBank(cardInfo.BankId); card.Add(new DropItem { ValueField = cardInfo.Id.ToString(), DisplayField = cardInfo.CardNumber + " " + bank }); // +" "+bank } this.dropIncomeAddCardNumber.DataSource = card; Helper.SetDropDownList(this.dropIncomeAddCardNumber); this.dropIncomeAddCardNumber.SelectedValue = string.Empty; }
public IActionResult PlayGame(int id, PlayerAction playerAction, int initialBet) { if (ModelState.IsValid) { CardMethods card = new CardMethods(); HttpClient client = MyHTTPClientNewGame.Client; string path = "/api/Play"; PlayApiRequest req = new PlayApiRequest(id, (int)playerAction, initialBet); HttpResponseMessage response = client.PostAsJsonAsync(path, req).Result; if (!response.IsSuccessStatusCode) { return(View("Index")); } PlayApiResponse nr = response.Content.ReadAsAsync <PlayApiResponse>().Result; if (playerAction == PlayerAction.Double) { ViewBag.Bet = initialBet * 2; } else { ViewBag.Bet = initialBet; } if (nr.PlayingRound == false) { Game game = Repository.GetGame(id); if (nr.RoundFinalResult == (int)RoundFinalResult.Win) { game.Wins = game.Wins + 1; } else if (nr.RoundFinalResult == (int)RoundFinalResult.Lose) { game.Loses = game.Loses + 1; } else if (nr.RoundFinalResult == (int)RoundFinalResult.Empate) { game.Ties = game.Ties + 1; } else if (nr.RoundFinalResult == (int)RoundFinalResult.BlackJack) { game.BlackJack = game.BlackJack + 1; game.Wins = game.Wins + 1; ViewBag.Result = ViewBag.Bet * 1.5; } else if (nr.RoundFinalResult == (int)RoundFinalResult.Surrender) { ViewBag.Result = ViewBag.Bet / 2; } game.Rounds = nr.RoundCount; game.Credits = nr.PlayerCredits; Repository.UpdateGame(game); } ViewBag.DealerHand = card.ValueHands(nr.Dealerhand); ViewBag.PlayerHand = card.ValueHands(nr.PlayerHand); return(View(nr)); } else { return(View()); } }
public static bool PickTrainCards(Player player, List <TrainCard> deck, List <TrainCard> visibleDeck, int roundNumber, List <foto> gamePics, List <TrainCard> favourableCards = null) { // visibleTraincards = visibleDeck; /****************************** * playerInput *******************************/ int i = 0, val = 0; TrainCard card = null; bool Locomotive = false; while (Locomotive == false && i < 2) // de spelers mogen 2 kaarten nemen (tenzij ze een locomotief nemen in de eerste ronde { Program.logboek.WriteLine(""); Program.logboek.WriteLine("1.\tPick an invisible card"); Program.logboek.WriteLine("2.\tPick a visible card"); val = player.ChoseOption(Possibilities.Traincard); // geïmplementeerd bij intelligente speler switch (val) { case (int)Cardoptions.Invisible: /****************************** * Onzichtbare kaart *******************************/ card = CardMethods <TrainCard> .pickAndRemoveCardsFromDeck(deck); player.addCard(card); Program.logboek.WriteLine(string.Format( "{0} picked an invisible card, that was a {1} traincard", player.GetName(), card.ToString())); if (!(player is IntelligentPlayer)) { MessageBox.Show(string.Format("{0} picked an invisible card, that was a {1} traincard", player.GetName(), card.ToString())); } break; case (int)Cardoptions.Visible: /****************************** * Zichtbare kaart *******************************/ Program.logboek.WriteLine("Please type the name of the card you want to pick"); bool cardFound = false; while (cardFound == false) { val = player.ChoseOption(Possibilities.visibleTraincards); // override bij intelligente spelers cardFound = true; if (i == 1 && cardFound) // indien geen geneste if krijg ik een fout omdat het object card --> null (nulreferenceException) { if ((Color)val == Color.Locomotief) // indien het de 2de (sub) beurt is en de gevonden kaart geen locomotief is { Program.logboek.WriteLine("you can't pick an locomotive as a visible card"); if (!(player is IntelligentPlayer)) { MessageBox.Show("you can't pick an locomotive as a visible card, in you second turn"); cardFound = false; } } } if (cardFound) { cardFound = false; foreach (TrainCard tCard in visibleDeck) { /****************************** * swapping card form dack *******************************/ if (tCard.getColor() == (Color)val) { card = CardMethods <TrainCard> .pickAndRemoveCardsFromDeck(visibleDeck, visibleDeck.IndexOf(tCard)); CardMethods <TrainCard> .swapCardFromDeck(deck, visibleDeck); player.addCard(card); Program.logboek.WriteLine("valid"); cardFound = true; Program.form.refreshVisibleTrainCards(visibleDeck); //Round.Header(visibleDeck, roundNumber, player); if (tCard.ToString() == Convert.ToString(Color.Locomotief)) { Locomotive = true; } break; /*sorrynotsorry*/ } } if (!cardFound) { Program.logboek.WriteLine("the card you selected isn't available on the visible deck"); if (!(player is IntelligentPlayer)) { MessageBox.Show("the card you selected isn't available on the visible deck"); } } } } break; } i++; } return(true); } // done
protected void btnIncomeEditSave_Click(object sender, EventArgs e) { CashIncomeInfo info = new CashIncomeInfo(); #region 验证 if (Session["editFlag"].Equals("true")) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayEditIncomediv();", true); info.Id = Convert.ToInt32(Request.QueryString["IncomeId"]); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddIncomediv();", true); } if (string.IsNullOrEmpty(this.dropIncomeAddCardNumber.SelectedValue)) { Alert.Show(this, "请选择卡号!"); this.dropIncomeAddCardNumber.Focus(); return; } if (string.IsNullOrEmpty(this.dropIncomeAddInComeType.SelectedValue)) { Alert.Show(this, "请输入收入类型!"); this.dropIncomeAddInComeType.Focus(); return; } if (string.IsNullOrEmpty(this.dropIncomeAddMode.SelectedValue)) { Alert.Show(this, "请输入存款状态!"); this.dropIncomeAddMode.Focus(); return; } if (string.IsNullOrEmpty(this.txtIncomeAddAmount.Text.Trim())) { Alert.Show(this, "请输入收入金额!"); this.txtIncomeAddAmount.Focus(); return; } if (string.IsNullOrEmpty(this.dropIncomeAddRate.SelectedValue)) { Alert.Show(this, "请输入利率!"); this.dropIncomeAddRate.Focus(); return; } if (string.IsNullOrEmpty(this.txtIncomeAddDepositDate.Text.Trim())) { Alert.Show(this, "请输入存款日期!"); this.txtIncomeAddDepositDate.Focus(); return; } if (string.IsNullOrEmpty(this.txtIncomeAddDepositorName.Text.Trim())) { Alert.Show(this, "请输入存款人!"); this.txtIncomeAddDepositDate.Focus(); return; } if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) || !string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim())) { if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) && string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim())) { Alert.Show(this, "请输入到期日期!"); this.txtIncomeAddEDate.Focus(); return; } else if (string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim())) { Alert.Show(this, "请输入定存开始日期!"); this.txtIncomeAddBDate.Focus(); return; } else { bool comparflag = true; comparflag = HelperCommon.ValidDateTime(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim()), string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim())); if (!comparflag) { Alert.Show(this, "到期日期不能小于开始日期"); this.txtIncomeAddEDate.Focus(); return; } comparflag = HelperCommon.ComparDay(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim()), string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim())); if (!comparflag) { Alert.Show(this, "定存日期必须大于等于三个月!"); this.txtIncomeAddEDate.Focus(); return; } } } if (string.IsNullOrEmpty(this.dropIncomeAddStatus.SelectedValue)) { Alert.Show(this, "请选择收入状态!"); this.dropIncomeAddStatus.Focus(); return; } if (string.IsNullOrEmpty(this.dropIncomeAddDepositMode.SelectedValue)) { Alert.Show(this, "请选存款方式!"); this.dropIncomeAddDepositMode.Focus(); return; } if (string.IsNullOrEmpty(this.txtIncomeAddOwner.Text.Trim())) { Alert.Show(this, "请输入资产所有者!"); this.txtIncomeAddOwner.Focus(); return; } #endregion #region 赋值 UserInfo userInfo = UserMethods.GetUserByName(this.txtIncomeAddOwner.Text.Trim()); info.OwnerName = this.txtIncomeAddOwner.Text.Trim(); userInfo = UserMethods.GetUserByName(this.txtIncomeAddOwner.Text.Trim()); if (userInfo.Id > 0) { info.OwnerId = userInfo.Id; } else { info.OwnerId = 0; } CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(this.dropIncomeAddCardNumber.SelectedValue)); info.CardNumber = cardInfo.CardNumber; info.BankCardNumber = cardInfo.CardNumber + " " + StaticRescourse.DisplayBank(cardInfo.BankId); info.CardId = Convert.ToInt32(this.dropIncomeAddCardNumber.SelectedItem.Value); info.IncomeAmount = Convert.ToSingle(this.txtIncomeAddAmount.Text.Trim()); info.PreMode = Convert.ToInt32(this.dropIncomeAddPreMode.SelectedValue); info.Mode = Convert.ToInt32(this.dropIncomeAddMode.SelectedValue); info.PreRate = Convert.ToInt32(this.dropIncomeAddPreRate.SelectedValue); info.Rate = Convert.ToInt32(this.dropIncomeAddRate.SelectedValue); info.DepositDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddDepositDate.Text.Trim())); if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim())) { info.BDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim())); } if (!string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim())) { info.EDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim())); } if (this.checkIncomeAddAutoSave.Checked) { info.AutoSave = 1; } else { info.AutoSave = 0; } userInfo = UserMethods.GetUserByName(this.txtIncomeAddDepositorName.Text.Trim()); if (userInfo.Id > 0) { info.DepositorId = userInfo.Id; } else { info.DepositorId = 0; } info.DepositorName = this.txtIncomeAddDepositorName.Text.Trim(); info.DepositMode = Convert.ToInt32(this.dropIncomeAddDepositMode.SelectedValue); info.Status = Convert.ToInt32(this.dropIncomeAddStatus.SelectedValue); info.IncomeType = Convert.ToInt32(this.dropIncomeAddInComeType.SelectedValue); info.TAmount = info.IncomeAmount; info.Content = !string.IsNullOrEmpty(this.txtIncomeAddContent.Text.Trim()) ? this.txtIncomeAddContent.Text.Trim() : string.Empty; #endregion int iSuccess = CashIncomeMethods.InsertOrUpdatetocashincome(info); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddIncomediv();", true); if (iSuccess > 0) { Alert.Show(this, "新增一条收入成功!"); } else if (iSuccess == -1) { Alert.Show(this, "修改成功!"); } else { Alert.Show(this, "操作失败!"); } InitializeIncomeAdd(new CashIncomeInfo()); queryList = new List <QueryElement>(); BindIncomeListDataGrid(queryList); }
/// <summary> /// 新增提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnExpensesAddSubmit_Click(object sender, EventArgs e) { #region 验证 ExpensesInfo expensesInfo = new ExpensesInfo(); if (Session["expensensEditFlag"].Equals("true")) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayExpensesEditdiv();", true); expensesInfo.Id = Convert.ToInt32(Request.QueryString["ExpensesId"]); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayExpensesAdddiv();", true); } if (string.IsNullOrEmpty(this.dropExpensesAddCardNumber.SelectedValue)) { Alert.Show(this, "请输入卡号!"); this.dropExpensesAddCardNumber.Focus(); return; } if (string.IsNullOrEmpty(this.txtExpensesAddAmount.Text.Trim())) { Alert.Show(this, "请输入支出金额!"); this.txtExpensesAddAmount.Focus(); return; } if (string.IsNullOrEmpty(this.txtExpensesAddSpendDate.Text.Trim())) { Alert.Show(this, "请输入支出日期!"); this.txtExpensesAddSpendDate.Focus(); return; } if (string.IsNullOrEmpty(this.dropExpensesAddOwner.SelectedValue)) { Alert.Show(this, "请输入资产所有者!"); this.dropExpensesAddOwner.Focus(); return; } if (string.IsNullOrEmpty(this.dropExpensesAddSpendType.SelectedValue)) { Alert.Show(this, "请输入消费方式!"); this.dropExpensesAddSpendType.Focus(); return; } if (string.IsNullOrEmpty(this.txtExpensesAddConsumerName.Text.Trim())) { Alert.Show(this, "请输入消费者!"); this.txtExpensesAddConsumerName.Focus(); return; } #endregion #region 赋值 expensesInfo.OwnerId = Convert.ToInt32(this.dropExpensesAddOwner.SelectedValue); expensesInfo.OwnerName = this.dropExpensesAddOwner.SelectedItem.Text; CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(this.dropExpensesAddCardNumber.SelectedValue)); expensesInfo.CardId = Convert.ToInt32(this.dropExpensesAddCardNumber.SelectedValue); expensesInfo.CardNumber = cardInfo.CardNumber; expensesInfo.BankCardNumber = this.dropExpensesAddCardNumber.SelectedItem.Text; expensesInfo.SpendType = Convert.ToInt32(this.dropExpensesAddSpendType.SelectedValue); expensesInfo.HowToUse = this.txtExpensesAddHowToUse.Text.Trim(); if (string.IsNullOrEmpty(this.txtExpensesAddPrice.Text.Trim())) { expensesInfo.Price = 0; } else { expensesInfo.Price = Convert.ToSingle(this.txtExpensesAddPrice.Text.Trim()); } if (string.IsNullOrEmpty(this.txtExpensesAddNumber.Text.Trim())) { expensesInfo.Number = 0; } else { expensesInfo.Number = Convert.ToInt32(this.txtExpensesAddNumber.Text.Trim()); } expensesInfo.Amount = Convert.ToSingle(this.txtExpensesAddAmount.Text.Trim()); expensesInfo.SpendDate = Convert.ToDateTime(this.txtExpensesAddSpendDate.Text.Trim()); expensesInfo.SpendMode = Convert.ToInt32(this.dropExpensesAddSpendMode.SelectedValue); UserInfo userInfo = UserMethods.GetUserByName(this.txtExpensesAddConsumerName.Text.Trim()); if (userInfo.Id > 0) { expensesInfo.ConsumerId = userInfo.Id; } else { expensesInfo.ConsumerId = 0; } expensesInfo.ConsumerName = this.txtExpensesAddConsumerName.Text.Trim(); expensesInfo.Content = this.txtExpensesAddContent.Text.Trim(); #endregion int iSuccess = ExpensesMethods.InsertOrUpdatetoExpenses(expensesInfo); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayExpensesAdddiv();", true); if (iSuccess > 0) { Alert.Show(this, "新增一条收入成功!"); } else if (iSuccess == -1) { Alert.Show(this, "修改成功!"); } else { Alert.Show(this, "操作失败!"); } InitializeExpensesAdd(new ExpensesInfo()); queryList = new List <QueryElement>(); BindExpensesListDataGrid(queryList); }
public IActionResult Index(NewGameApiRequest novoJogador) { if (ModelState.IsValid) { //Novo Jogo HttpClient client = MyHTTPClientNewGame.Client; string path = "/api/NewGame"; HttpResponseMessage response = client.PostAsJsonAsync(path, novoJogador).Result; if (!response.IsSuccessStatusCode) { return(View("Index")); } PlayApiResponse nr = response.Content.ReadAsAsync <PlayApiResponse>().Result; int rd = 0; if (nr.PlayerName == "auto1") { rd = 1; } else if (nr.PlayerName == "auto3") { rd = 3; } else if (nr.PlayerName == "auto10") { rd = 10; } else if (nr.PlayerName == "auto0") { rd = 100; } Repository.ClearRounds(); // Ciclo de rondas while (nr.RoundCount < rd && nr.PlayerCredits >= 10) { RoundSummary rs = new RoundSummary(); rs.Blackjack = false; int initialBet = 0; if (nr.PlayerCredits > 200) { initialBet = 50; } else if (nr.PlayerCredits > 100) { initialBet = 25; } else { initialBet = 10; } rs.InitialCredits = nr.PlayerCredits; PlayApiRequest rq = new PlayApiRequest(nr.GameId, (int)PlayerAction.NewRound, initialBet); response = client.PostAsJsonAsync("/api/Play", rq).Result; if (!response.IsSuccessStatusCode) { return(View("Index")); } nr = response.Content.ReadAsAsync <PlayApiResponse>().Result; rs.Rounds = nr.RoundCount + 1; if (nr.RoundFinalResult == (int)RoundFinalResult.BlackJack) { rs.Blackjack = true; } //Jogadas while (nr.PlayingRound == true && nr.PlayerCredits >= 10) { PlayerAction playerAction; CardMethods card = new CardMethods(); int playerHand = card.ValueHands(nr.PlayerHand); int dealerHand = card.ValueHands(nr.Dealerhand); //if (card.ValueHands(nr.PlayerHand) >= 5 && card.ValueHands(nr.PlayerHand) <= 10) //{ // playerAction = PlayerAction.Double; // rs.Double = true; // rs.Bet = rs.Bet + rs.Bet; //} //else if (card.ValueHands(nr.PlayerHand) < 5 && card.ValueHands(nr.Dealerhand) == 11) // playerAction = PlayerAction.Surrender; //else if (card.ValueHands(nr.PlayerHand) <= 16) // playerAction = PlayerAction.Hit; //else if (card.ValueHands(nr.PlayerHand) >= 17) // playerAction = PlayerAction.Stand; //else // playerAction = PlayerAction.Surrender; if (dealerHand >= 9 && playerHand == 16) { playerAction = PlayerAction.Surrender; } else if (dealerHand == 10 && playerHand == 15) { playerAction = PlayerAction.Surrender; } else if (playerHand >= 17 && playerHand <= 21) { playerAction = PlayerAction.Stand; } else if (playerHand == 16 && dealerHand >= 7 && dealerHand <= 8) { playerAction = PlayerAction.Hit; } else if (playerHand == 16 && dealerHand >= 2 && dealerHand <= 6) { playerAction = PlayerAction.Stand; } else if (playerHand == 15 && dealerHand == 11) { playerAction = PlayerAction.Hit; } else if (playerHand == 15 && dealerHand >= 7 && dealerHand <= 9) { playerAction = PlayerAction.Hit; } else if (playerHand == 15 && dealerHand >= 2 && dealerHand <= 6) { playerAction = PlayerAction.Stand; } else if (playerHand >= 12 && playerHand <= 14 && dealerHand >= 7) { playerAction = PlayerAction.Hit; } else if (playerHand >= 13 && playerHand <= 14 && dealerHand >= 2 && dealerHand <= 6) { playerAction = PlayerAction.Stand; } else if (playerHand == 12 && dealerHand >= 4 && dealerHand <= 6) { playerAction = PlayerAction.Stand; } else if (playerHand == 12 && dealerHand >= 2 && dealerHand <= 3) { playerAction = PlayerAction.Hit; } else if (playerHand == 11 && dealerHand == 11) { playerAction = PlayerAction.Hit; } else if (playerHand == 11) { if (nr.PlayerCredits >= 10) { playerAction = PlayerAction.Double; rs.Double = true; rs.Bet = rs.Bet + rs.Bet; } else { playerAction = PlayerAction.Hit; } } else if (playerHand == 10 && dealerHand >= 10) { playerAction = PlayerAction.Hit; } else if (playerHand == 10) { if (nr.PlayerCredits >= 10) { playerAction = PlayerAction.Double; rs.Double = true; rs.Bet = rs.Bet + rs.Bet; } else { playerAction = PlayerAction.Hit; } } else if (playerHand == 9 && dealerHand >= 7) { playerAction = PlayerAction.Hit; } else if (playerHand == 9 && dealerHand >= 3) { if (nr.PlayerCredits >= 10) { playerAction = PlayerAction.Double; rs.Double = true; rs.Bet = rs.Bet + rs.Bet; } else { playerAction = PlayerAction.Hit; } } else if (playerHand == 9) { playerAction = PlayerAction.Hit; } else { playerAction = PlayerAction.Hit; } PlayApiRequest req = new PlayApiRequest(nr.GameId, (int)playerAction, initialBet); response = client.PostAsJsonAsync("/api/Play", req).Result; if (!response.IsSuccessStatusCode) { return(View("Index")); } nr = response.Content.ReadAsAsync <PlayApiResponse>().Result; if (playerAction == PlayerAction.Double) { rs.Bet = rs.Bet + rs.Bet; } else { rs.Bet = initialBet; } if (card.ValueHands(nr.Dealerhand) == 21 && nr.Dealerhand.Count == 2) { rs.DealerBlackjack = true; } else { rs.DealerBlackjack = false; } } rs.RoundResult = nr.RoundFinalResult; rs.FinalCredits = nr.PlayerCredits; Repository.AddRound(rs); } path = "/api/Play/rGAUUmCfk3vUgfSF/" + nr.GameId; HttpResponseMessage resp = client.GetAsync(path).Result; if (!resp.IsSuccessStatusCode) { return(View("Index")); } nr = resp.Content.ReadAsAsync <PlayApiResponse>().Result; path = "/api/Quit"; QuitApiRequest reqq = new QuitApiRequest(nr.GameId); response = client.PostAsJsonAsync(path, reqq).Result; if (!response.IsSuccessStatusCode) { return(View("Index")); } List <RoundSummary> rounds = Repository.Rounds; GameSummary g = new GameSummary(); g.Rounds = nr.RoundCount; g.Credits = nr.PlayerCredits; foreach (RoundSummary r in rounds) { g.AvgBet = r.Bet + g.AvgBet; if (r.Bet > g.MaxBet) { g.MaxBet = r.Bet; } if (r.Bet < g.MinBet) { g.MinBet = r.Bet; } else { g.MinBet = 10; } if (r.RoundResult == (int)RoundResult.BlackJack) { g.PlayerBlackjack = g.PlayerBlackjack + 1; } if (r.DealerBlackjack == true) { g.DealerBlackjack = g.DealerBlackjack + 1; } } g.AvgBet = g.AvgBet / rounds.Count(); ViewBag.Game = g; return(View("Result", rounds)); } else { return(View()); } }