protected void gvMatch_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "ReturnBet") { var guid = new Guid(e.CommandArgument.ToString()); var m = new Match(guid); m.ReturnBet(); ClientScript.RegisterClientScriptBlock(typeof(string), "success", "alert('投注退还成功');", true); BindData(); } else if (e.CommandName == "CalcBonus") { var guid = new Guid(e.CommandArgument.ToString()); var m = new Match(guid); m.CalcBonus(); ClientScript.RegisterClientScriptBlock(typeof(string), "success", "alert('奖金发放成功');", true); BindData(); } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(typeof(string), "failed", $"alert('{ex.Message}');", true); } }
protected void rptMatchEarning_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { var drv = e.Item.DataItem as DataRowView; if (drv != null) { var m = new Match((Guid) drv["MatchGuid"]); var ltrlMatchInfo = e.Item.FindControl("ltrlMatchInfo") as Literal; if (ltrlMatchInfo != null && m != null) { var tHome = Team.Cache.Load(m.Home); var tAway = Team.Cache.Load(m.Away); var strMatchInfo = "<li class=\"IconTop{0}\"><a href=\"CasinoBetLog.aspx?Match={1}\" title=\"{2} {3}\">{4} <em>vs</em> {5}</a><em title=\"比赛盈余\" class=\"CasinoSys_TopRankEM\">{6}</em></li>"; ltrlMatchInfo.Text = string.Format(strMatchInfo, drv["Rank"], m.MatchGuid, m.LeagueName, m.PlayTime.ToString("yyyy-MM-dd HH:mm"), tHome.TeamDisplayName, tAway.TeamDisplayName, Convert.ToSingle(drv["Earning"]).ToString("N2")); } } } }
protected void Page_Load(object sender, EventArgs e) { var t = Team.Cache.Load(TeamGuid); if (t != null) { var dt = CasinoItem.GetEndViewByTeam(t.ID); var wonCount = 0; var drawCount = 0; var lostCount = 0; if (dt != null) { foreach (DataRow dr in dt.Rows) { var m = new Match((Guid) dr["MatchGuid"]); if (t.ID == m.Home) { if (m.ResultHome > m.ResultAway) wonCount++; else if (m.ResultHome < m.ResultAway) lostCount++; else drawCount++; } else if (t.ID == m.Away) { if (m.ResultHome < m.ResultAway) wonCount++; else if (m.ResultHome > m.ResultAway) lostCount++; else drawCount++; } } var matchCount = wonCount + lostCount + drawCount; ltrlMatchCount.Text = "<em>" + matchCount + "</em>"; ltrlWonCount.Text = "<em>" + wonCount + "</em>"; ltrlDrawCount.Text = "<em>" + drawCount + "</em>"; ltrlLostCount.Text = "<em>" + lostCount + "</em>"; } else pnlHistoryResult.Visible = false; ltrlTeamDisplayName.Text = $"<em>{t.TeamDisplayName}({t.TeamEnglishName})</em>"; ltrlTeamLogo.Text = string.Format("<img src=\"{0}\" alt=\"{1}\" title=\"{1}\" />", t.TeamLogo, t.TeamDisplayName); ltrlTeamCoach.Text = "<em>" + t.Manager + "</em>"; ltrlGround.Text = "<em>" + t.Ground + "</em>"; ltrlCapacity.Text = "<em>" + t.Capacity + "</em>"; } }
protected void btnSave_Click(object sender, EventArgs e) { try { var m = new Match { MatchGuid = Guid.NewGuid(), Home = new Guid(ddlHomeTeam.SelectedValue), Away = new Guid(ddlAwayTeam.SelectedValue), PlayTime = Convert.ToDateTime(tbPlayTime.Text), LeagueGuid = new Guid(ddlLeague.SelectedValue) }; var l = League.Cache.Load(m.LeagueGuid); m.LeagueName = l.LeagueNameInfo; if (!string.IsNullOrEmpty(tbRound.Text)) m.Round = Convert.ToInt16(tbRound.Text); else m.Round = null; if (ddlLeagueGroup.SelectedValue != Guid.Empty.ToString()) m.GroupGuid = new Guid(ddlLeagueGroup.SelectedValue); else m.GroupGuid = null; //var winRate = Convert.ToSingle(tbWinRate.Text); //var drawRate = Convert.ToSingle(tbDrawRate.Text); //var loseRate = Convert.ToSingle(tbLoseRate.Text); m.Insert(userid, username, Convert.ToSingle(tbWinRate.Text), Convert.ToSingle(tbDrawRate.Text), Convert.ToSingle(tbLoseRate.Text)); ClientScript.RegisterClientScriptBlock(typeof (string), "save", "alert('比赛添加成功');", true); } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(typeof (string), "failed", $"alert('{ex.Message}');", true); } }
protected void gvBetLog_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var drv = e.Row.DataItem as DataRowView; if (drv != null) { var m = new Match((Guid) drv["MatchGuid"]); var hlHome = e.Row.FindControl("hlHome") as HyperLink; var hlAway = e.Row.FindControl("hlAway") as HyperLink; var hlVersus = e.Row.FindControl("hlVersus") as HyperLink; if (hlHome != null && hlAway != null && hlVersus != null) { var tHome = Team.Cache.Load(m.Home); var tAway = Team.Cache.Load(m.Away); hlHome.Text = tHome.TeamDisplayName; hlHome.NavigateUrl = $"CasinoTeam.aspx?Team={m.Home}"; hlAway.Text = tAway.TeamDisplayName; hlAway.NavigateUrl = $"CasinoTeam.aspx?Team={m.Away}"; hlVersus.NavigateUrl = $"CasinoTeam.aspx?Match={m.MatchGuid}"; hlVersus.Text = $"<em title=\"{tHome.Ground}{(tHome.Capacity.HasValue ? ("(" + tHome.Capacity.Value + ")") : string.Empty)}\">vs</em>"; } } var ltrlResult = e.Row.FindControl("ltrlResult") as Literal; var ltrlBetResult = e.Row.FindControl("ltrlBetResult") as Literal; var ltrlBetRate = e.Row.FindControl("ltrlBetRate") as Literal; var btnReturnBet = e.Row.FindControl("btnReturnBet") as LinkButton; if (drv != null && ltrlResult != null && ltrlBetResult != null && ltrlBetRate != null && btnReturnBet != null) { var itemGuid = (Guid) drv["CasinoItemGuid"]; var item = CasinoItem.GetCasinoItem(itemGuid); var dt = BetDetail.GetBetDetailByBetId((int) drv["ID"]); if (dt != null) { var dr = dt.Rows[0]; switch (item.ItemType) { case CasinoType.SingleChoice: if (dr["DetailName"].ToString() == MatchChoiceOption.HomeWinValue) ltrlResult.Text = "主队胜"; else if (dr["DetailName"].ToString() == MatchChoiceOption.DrawValue) ltrlResult.Text = "双方平"; else if (dr["DetailName"].ToString() == MatchChoiceOption.AwayWinValue) ltrlResult.Text = "客队胜"; break; case CasinoType.MatchResult: var betDetail = new MatchResultBetDetail(dt); ltrlResult.Text = $"{betDetail.Home}:{betDetail.Away}"; break; } } if (!Convert.IsDBNull(drv["IsWin"])) { ltrlBetResult.Visible = true; btnReturnBet.Visible = false; if (Convert.ToBoolean(drv["IsWin"])) { if (item.ItemType == CasinoType.SingleChoice) ltrlBetResult.Text = "<span class=\"CasinoSys_True\" title=\"猜对输赢\"></span>"; else if (item.ItemType == CasinoType.MatchResult) ltrlBetResult.Text = "<span class=\"CasinoSys_Good\" title=\"猜对比分\"></span>"; e.Row.CssClass = "RowCasinoSys_True"; } else { ltrlBetResult.Text = "<span class=\"CasinoSys_False\" title=\"失败\"></span>"; } } else if (Convert.IsDBNull(drv["IsWin"]) && (CurrentUserId == userid) && (item.CloseTime > DateTime.Now)) { btnReturnBet.Visible = true; btnReturnBet.CommandArgument = drv["ID"].ToString(); } else { ltrlBetResult.Visible = false; btnReturnBet.Visible = false; } } if (drv != null && ltrlBetRate != null) { ltrlBetRate.Text = Convert.IsDBNull(drv["BetRate"]) ? "/" : Convert.ToSingle(drv["BetRate"]).ToString("f2"); } } }
public static void UpdateGroupTeamByGroupMatch(Guid groupGuid, Guid teamGuid, DataTable dtGroupMatch) { var gt = new GroupTeam(); gt.GroupGuid = groupGuid; gt.TeamGuid = teamGuid; gt.PositionNo = 0; foreach (DataRow dr in dtGroupMatch.Rows) { var match = new Match((Guid) dr["MatchGuid"]); if (match != null) { if (match.Home == gt.TeamGuid) { gt.TotalPlayed++; if (match.ResultHome > match.ResultAway) { gt.HomeWon++; gt.HomePoints += 3; } else if (match.ResultHome == match.ResultAway) { gt.HomeDraw++; gt.HomePoints += 1; } else gt.HomeLost++; gt.HomeGoalFor += match.ResultHome; gt.HomeGoalAgainst += match.ResultAway; } else if (match.Away == gt.TeamGuid) { gt.TotalPlayed++; if (match.ResultAway > match.ResultHome) { gt.AwayWon++; gt.AwayPoints += 3; } else if (match.ResultAway == match.ResultHome) { gt.AwayDraw++; gt.AwayPoints += 1; } else gt.AwayLost++; gt.AwayGoalFor += match.ResultAway; gt.AwayGoalAgainst += match.ResultHome; } } } gt.HomeGoalDiff = Convert.ToInt16(gt.HomeGoalFor - gt.HomeGoalAgainst); gt.AwayGoalDiff = Convert.ToInt16(gt.AwayGoalFor - gt.AwayGoalAgainst); gt.TotalPoints = Convert.ToInt16(gt.HomePoints + gt.AwayPoints); gt.Update(); }
protected void gvMatch_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var drv = e.Row.DataItem as DataRowView; if (drv != null) { var m = new Match((Guid)drv["MatchGuid"]); var ltrlLeagueInfo = e.Row.FindControl("ltrlLeagueInfo") as Literal; if (ltrlLeagueInfo != null) { var strLeague = "<a href=\"CasinoGame.aspx?League={0}\" title=\"{1}\"><img src=\"{2}\" alt=\"{1}\" class=\"CasinoSys_CategoryImg\" /></a>"; var strLeagueName = $"{m.LeagueName}{(m.Round.HasValue ? $" 第{m.Round}轮" : string.Empty)}"; ltrlLeagueInfo.Text = string.Format(strLeague, m.LeagueGuid, strLeagueName, League.Cache.Load(m.LeagueGuid).LeagueLogo); } var lblHome = e.Row.FindControl("lblHome") as Label; var lblAway = e.Row.FindControl("lblAway") as Label; var hlVersus = e.Row.FindControl("hlVersus") as HyperLink; if (lblHome != null && lblAway != null && hlVersus != null) { var tHome = Team.Cache.Load(m.Home); var tAway = Team.Cache.Load(m.Away); var strTeamName = "<a class=\"StrongLink\" href=\"CasinoTeam.aspx?Team={0}\" title=\"{1}\">{2}</a> "; var strTeamLogo = "<img src=\"{3}\" alt=\"{1}\" /> "; lblHome.Text = string.Format(strTeamName + strTeamLogo, tHome.ID, tHome.TeamEnglishName, tHome.TeamDisplayName, tHome.TeamLogo); lblAway.Text = string.Format(strTeamLogo + strTeamName, tAway.ID, tAway.TeamEnglishName, tAway.TeamDisplayName, tAway.TeamLogo); hlVersus.NavigateUrl = $"CasinoTeam.aspx?Match={m.MatchGuid}"; hlVersus.Text = $"<em title=\"{tHome.Ground}{(tHome.Capacity.HasValue ? ("(" + tHome.Capacity.Value + ")") : string.Empty)}\">vs</em>"; } var guid = CasinoItem.GetCasinoItemGuidByMatch(m.MatchGuid, CasinoType.SingleChoice); if (guid.HasValue) { var item = CasinoItem.GetCasinoItem(guid.Value); if (item != null) { var options = ((SingleChoice)item).Options; var winOption = options.Find(option => option.OptionValue == MatchChoiceOption.HomeWinValue); var drawOption = options.Find(option => option.OptionValue == MatchChoiceOption.DrawValue); var loseOption = options.Find(option => option.OptionValue == MatchChoiceOption.AwayWinValue); if (!string.IsNullOrEmpty(winOption.OptionValue) && !string.IsNullOrEmpty(drawOption.OptionValue) && !string.IsNullOrEmpty(loseOption.OptionValue) && winOption.OptionRate.HasValue && drawOption.OptionRate.HasValue && loseOption.OptionRate.HasValue) { var ltrlWinRate = e.Row.FindControl("ltrlWinRate") as Literal; var ltrlDrawRate = e.Row.FindControl("ltrlDrawRate") as Literal; var ltrlLoseRate = e.Row.FindControl("ltrlLoseRate") as Literal; if (ltrlWinRate != null) ltrlWinRate.Text = Convert.ToSingle(winOption.OptionRate.Value).ToString("f2"); if (ltrlDrawRate != null) ltrlDrawRate.Text = Convert.ToSingle(drawOption.OptionRate.Value).ToString("f2"); if (ltrlLoseRate != null) ltrlLoseRate.Text = Convert.ToSingle(loseOption.OptionRate.Value).ToString("f2"); } } } //bet for match result guid = CasinoItem.GetCasinoItemGuidByMatch(m.MatchGuid, CasinoType.MatchResult); if (guid.HasValue) { var item = CasinoItem.GetCasinoItem(guid.Value); if (item?.ItemGuid != null) { var bets = Bet.GetUserCasinoItemAllBet(userid, item.ItemGuid.Value); if (bets.Count != 0) { var betDetail = new MatchResultBetDetail(BetDetail.GetBetDetailByBetId(bets[0].ID)); var tbHomeScore = e.Row.FindControl("tbHomeScore") as TextBox; var tbAwayScore = e.Row.FindControl("tbAwayScore") as TextBox; if (tbHomeScore != null) { tbHomeScore.Text = betDetail.Home.ToString(); tbHomeScore.ReadOnly = true; tbHomeScore.Style.Add("border", "none"); tbHomeScore.Style.Add("font-weight", "bold"); tbHomeScore.Style.Add("background", "none"); tbHomeScore.Style.Add("color", "#aa0000"); } if (tbAwayScore != null) { tbAwayScore.Text = betDetail.Away.ToString(); tbAwayScore.ReadOnly = true; tbAwayScore.Style.Add("border", "none"); tbAwayScore.Style.Add("font-weight", "bold"); tbAwayScore.Style.Add("background", "none"); tbAwayScore.Style.Add("color", "#aa0000"); } } else { _itemAvailable = true; } } } } } }
protected void gvBet_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var bet = e.Row.DataItem as Bet; var ltrlHome = e.Row.FindControl("ltrlHome") as Literal; var ltrlAway = e.Row.FindControl("ltrlAway") as Literal; var btnReturnBet = e.Row.FindControl("btnReturnBet") as LinkButton; if (bet != null) { var item = CasinoItem.GetCasinoItem(bet.CasinoItemGuid); if (item.MatchGuid != null) { var m = new Match(item.MatchGuid.Value); { var homeT = Team.Cache.Load(m.Home); var awayT = Team.Cache.Load(m.Away); if (ltrlHome != null) ltrlHome.Text = homeT.TeamDisplayName; if (ltrlAway != null) ltrlAway.Text = awayT.TeamDisplayName; } } var ltrlResult = e.Row.FindControl("ltrlResult") as Literal; var dt = BetDetail.GetBetDetailByBetId(bet.ID); if (dt != null && ltrlResult != null) { var dr = dt.Rows[0]; switch (item.ItemType) { case CasinoType.SingleChoice: if (dr["DetailName"].ToString() == MatchChoiceOption.HomeWinValue) { ltrlResult.Text = "主队胜"; } else if (dr["DetailName"].ToString() == MatchChoiceOption.DrawValue) { ltrlResult.Text = "双方平"; } else if (dr["DetailName"].ToString() == MatchChoiceOption.AwayWinValue) { ltrlResult.Text = "客队胜"; } break; case CasinoType.MatchResult: var betDetail = new MatchResultBetDetail(dt); ltrlResult.Text = $"{betDetail.Home}:{betDetail.Away}"; break; } } } var ltrlBetRate = e.Row.FindControl("ltrlBetRate") as Literal; if (bet != null) { if (ltrlBetRate != null) ltrlBetRate.Text = bet.BetRate.HasValue ? Convert.ToSingle(bet.BetRate).ToString("f2") : "/"; if (btnReturnBet != null) { btnReturnBet.Visible = true; btnReturnBet.CommandArgument = bet.ID.ToString(); } } } }
protected void Page_Load(object sender, EventArgs e) { #region Assign Control Property ctrlLeftPanel.UserId = userid; ctrlLeftPanel.UserName = username; ctrlFieldTooBar.UserId = userid; ctrlMenuTabBar.CurrentMenu = CasinoMenuType.CasinoPortal; ctrlCasinoHeader.UserId = userid; ctrlCasinoHeader.MatchGuid = CurrentMatch; ctrlCasinoHeader.IsHistoryView = true; #endregion var match = new Match(CurrentMatch); // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (match != null) { var dtPlay = match.PlayTime; if (DateTime.Now >= dtPlay) { phBet.Visible = false; pnlClose.Visible = true; } else { phBet.Visible = true; pnlClose.Visible = false; } var guid = CasinoItem.GetCasinoItemGuidByMatch(CurrentMatch, CasinoType.SingleChoice); if (!IsPostBack) { #region 设置其他可投注比赛的下拉框 var dtMatch = CasinoItem.GetMatchCasinoItemView(true); if (dtMatch != null) { dtMatch.Columns.Add("MatchTeamDisplay", typeof(string)); foreach (DataRow drM in dtMatch.Rows) { var m = new Match((Guid)drM["MatchGuid"]); drM["MatchTeamDisplay"] = $"{Team.Cache.Load(m.Home).TeamDisplayName} vs {Team.Cache.Load(m.Away).TeamDisplayName}"; } } ddlCasinoGame.DataSource = dtMatch; ddlCasinoGame.DataTextField = "MatchTeamDisplay"; ddlCasinoGame.DataValueField = "MatchGuid"; ddlCasinoGame.DataBind(); ddlCasinoGame.Items.Insert(0, new ListItem("--选择其他比赛场次--", Guid.Empty.ToString())); #endregion if (guid.HasValue) { var item = CasinoItem.GetCasinoItem(guid.Value); if (item != null) { var options = ((SingleChoice)item).Options; var winOption = options.Find(option => option.OptionValue == MatchChoiceOption.HomeWinValue); var drawOption = options.Find(option => option.OptionValue == MatchChoiceOption.DrawValue); var loseOption = options.Find(option => option.OptionValue == MatchChoiceOption.AwayWinValue); if (string.IsNullOrEmpty(winOption.OptionValue) || string.IsNullOrEmpty(drawOption.OptionValue) || string.IsNullOrEmpty(loseOption.OptionValue)) throw new Exception(); var liWin = rblSingleChoice.Items[0]; liWin.Text = $"<em>主队胜({Convert.ToSingle(winOption.OptionRate).ToString("f2")})</em>"; liWin.Value = MatchChoiceOption.HomeWinValue; var liDraw = rblSingleChoice.Items[1]; liDraw.Text = $"<em>双方平({Convert.ToSingle(drawOption.OptionRate).ToString("f2")})</em>"; liDraw.Value = MatchChoiceOption.DrawValue; var liLose = rblSingleChoice.Items[2]; liLose.Text = $"<em>客队胜({Convert.ToSingle(loseOption.OptionRate).ToString("f2")})</em>"; liLose.Value = MatchChoiceOption.AwayWinValue; } } } BindData(); } }
protected void gvMatch_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var drv = e.Row.DataItem as DataRowView; if (drv != null) { var m = new Match((Guid) drv["MatchGuid"]); var ltrlLeagueInfo = e.Row.FindControl("ltrlLeagueInfo") as Literal; if (ltrlLeagueInfo != null) { var strLeague = "<a href=\"CasinoGame.aspx?League={0}\" title=\"{1}\"><img src=\"{2}\" alt=\"{1}\" class=\"CasinoSys_CategoryImg\" /></a>"; var strLeagueName = $"{m.LeagueName}{(m.Round.HasValue ? $" 第{m.Round}轮" : string.Empty)}"; ltrlLeagueInfo.Text = string.Format(strLeague, m.LeagueGuid, strLeagueName, League.Cache.Load(m.LeagueGuid).LeagueLogo); } var lblHome = e.Row.FindControl("lblHome") as Label; var lblAway = e.Row.FindControl("lblAway") as Label; var hlVersus = e.Row.FindControl("hlVersus") as HyperLink; var ltrlResult = e.Row.FindControl("ltrlResult") as Literal; if (lblHome != null && lblAway != null && hlVersus != null) { var tHome = Team.Cache.Load(m.Home); var tAway = Team.Cache.Load(m.Away); var strTeamName = "<a class=\"StrongLink\" href=\"CasinoTeam.aspx?Team={0}\" title=\"{1}\">{2}</a> "; var strTeamLogo = "<img src=\"{3}\" alt=\"{1}\" /> "; lblHome.Text = string.Format(strTeamName + strTeamLogo, tHome.ID, tHome.TeamEnglishName, tHome.TeamDisplayName, tHome.TeamLogo); lblAway.Text = string.Format(strTeamLogo + strTeamName, tAway.ID, tAway.TeamEnglishName, tAway.TeamDisplayName, tAway.TeamLogo); hlVersus.NavigateUrl = $"CasinoTeam.aspx?Match={m.MatchGuid}"; hlVersus.Text = $"<em title=\"{tHome.Ground}{(tHome.Capacity.HasValue ? ("(" + tHome.Capacity.Value + ")") : string.Empty)}\">vs</em>"; } if (ltrlResult != null && m.ResultHome.HasValue && m.ResultAway.HasValue) { ltrlResult.Text = $"{m.ResultHome.Value} : {m.ResultAway.Value}"; } var ltrlTotalBetCount = e.Row.FindControl("ltrlTotalBetCount") as Literal; var ltrlTotalBetCash = e.Row.FindControl("ltrlTotalBetCash") as Literal; var ltrlTotalWin = e.Row.FindControl("ltrlTotalWin") as Literal; var betList = Bet.GetMatchAllBet(m.MatchGuid); if (ltrlTotalBetCount != null) { ltrlTotalBetCount.Text = betList.Count.ToString(); } if (ltrlTotalBetCash != null) { float totalbetCash = 0; betList.ForEach(delegate(Bet bet) { totalbetCash += bet.BetAmount.GetValueOrDefault(0f); }); ltrlTotalBetCash.Text = totalbetCash.ToString("N0"); } if (ltrlTotalWin != null) { float totalWin = 0; betList.ForEach( delegate(Bet bet) { totalWin += (bet.BetAmount.GetValueOrDefault(0f) - bet.Earning.GetValueOrDefault(0f)); }); ltrlTotalWin.Text = totalWin.ToString("N2"); } } } }
private void BindData() { List<Bet> betList; if (CurrentMatch == Guid.Empty) { //display all based on time diff ddlTimeDiff.Visible = true; betList = Bet.GetAllBetByTimeDiff(TimeDiff); } else { //display all match bet ddlTimeDiff.Visible = false; var m = new Match(CurrentMatch); var homeT = Team.Cache.Load(m.Home); var awayT = Team.Cache.Load(m.Away); _home = homeT.TeamDisplayName; _away = awayT.TeamDisplayName; betList = Bet.GetMatchAllBet(CurrentMatch); } ltrlSingleChoiceCount.Text = betList.FindAll(bet => bet.BetAmount.HasValue).Count.ToString(); ltrlMatchResultCount.Text = betList.FindAll(bet => !bet.BetAmount.HasValue).Count.ToString(); float totalBetCount = 0; betList.ForEach(delegate (Bet bet) { totalBetCount += bet.BetAmount.GetValueOrDefault(0f); }); ltrlTotalBetCount.Text = totalBetCount.ToString("N0"); gvBet.DataSource = betList; gvBet.DataBind(); if (CurrentMatch != Guid.Empty) { gvBet.Columns[2].Visible = false; gvBet.Columns[3].Visible = false; gvBet.Columns[4].Visible = false; } else { gvBet.Columns[2].Visible = true; gvBet.Columns[3].Visible = true; gvBet.Columns[4].Visible = true; } }
protected void gvMatch_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //Match m = e.Row.DataItem as Match; var drv = e.Row.DataItem as DataRowView; if (drv != null) { var m = new Match((Guid)drv["MatchGuid"]); var matchResult = e.Row.FindControl("ltrlMatchResult") as Literal; var btnCalcBonus = e.Row.FindControl("btnCalcBonus") as LinkButton; var btnReturnBet = e.Row.FindControl("btnReturnBet") as LinkButton; var lblBonus = e.Row.FindControl("lblBonus") as Label; var tbPlayTime = e.Row.FindControl("tbPlayTime") as TextBox; var tbRound = e.Row.FindControl("tbRound") as TextBox; var tbHome = e.Row.FindControl("tbHome") as TextBox; var tbAway = e.Row.FindControl("tbAway") as TextBox; if (tbPlayTime != null) tbPlayTime.Text = m.PlayTime.ToString("yyyy-MM-dd HH:mm"); if (tbRound != null) tbRound.Text = m.Round.ToString(); if (tbHome != null && tbAway != null && m.ResultHome.HasValue && m.ResultAway.HasValue) { tbHome.Text = m.ResultHome.ToString(); tbAway.Text = m.ResultAway.ToString(); } if (btnCalcBonus != null && btnReturnBet != null && lblBonus != null) { if (matchResult != null && m.ResultHome.HasValue && m.ResultAway.HasValue) { matchResult.Text = $"{m.ResultHome}:{m.ResultAway}"; var matchGuid = m.MatchGuid; var itemGuid = CasinoItem.GetCasinoItemGuidByMatch(matchGuid, CasinoType.SingleChoice); if (itemGuid.HasValue) { var item = CasinoItem.GetCasinoItem(itemGuid.Value); if (item.Earning.HasValue) { //hide button calc bonus btnCalcBonus.Visible = false; btnReturnBet.Visible = false; lblBonus.Text = item.Earning.Value.ToString("N2"); lblBonus.Visible = true; } else { //show button calc bonus btnCalcBonus.Visible = true; btnReturnBet.Visible = false; lblBonus.Visible = false; //set button command argument btnCalcBonus.CommandArgument = m.MatchGuid.ToString(); } } } else { var betList = Bet.GetMatchAllBet(m.MatchGuid); var betCount = 0; if (betList != null && betList.Count > 0) betCount = betList.Count; btnReturnBet.Text = $"退还:{betCount}注"; btnReturnBet.Visible = true; btnCalcBonus.Visible = false; lblBonus.Visible = false; btnReturnBet.CommandArgument = m.MatchGuid.ToString(); if (betCount <= 0) { btnReturnBet.Enabled = false; } } } } } }
private void BindData() { var dt = CasinoItem.GetMatchCasinoItemView(false); dt.Columns.Add("HomeDisplay", typeof(string)); dt.Columns.Add("AwayDisplay", typeof(string)); foreach (DataRow dr in dt.Rows) { var m = new Match((Guid)dr["MatchGuid"]); dr["HomeDisplay"] = Team.Cache.Load(m.Home).TeamDisplayName; dr["AwayDisplay"] = Team.Cache.Load(m.Away).TeamDisplayName; } gvMatch.DataSource = dt; gvMatch.DataBind(); }
protected void gvMatch_RowUpdating(object sender, GridViewUpdateEventArgs e) { var tbHome = gvMatch.Rows[gvMatch.EditIndex].FindControl("tbHome") as TextBox; var tbAway = gvMatch.Rows[gvMatch.EditIndex].FindControl("tbAway") as TextBox; var tbPlayTime = gvMatch.Rows[gvMatch.EditIndex].FindControl("tbPlayTime") as TextBox; var tbRound = gvMatch.Rows[gvMatch.EditIndex].FindControl("tbRound") as TextBox; var key = gvMatch.DataKeys[gvMatch.EditIndex]; if (tbHome != null && tbAway != null && tbPlayTime != null && tbRound != null && key != null) { try { var guid = (Guid)key.Value; var m = new Match(guid); short rHome; short rAway; if (short.TryParse(tbHome.Text, out rHome) && short.TryParse(tbAway.Text, out rAway)) { m.ResultHome = rHome; m.ResultAway = rAway; } else if (string.IsNullOrEmpty(tbHome.Text) && string.IsNullOrEmpty(tbAway.Text)) { m.ResultHome = null; m.ResultAway = null; } m.PlayTime = Convert.ToDateTime(tbPlayTime.Text); if (!string.IsNullOrEmpty(tbRound.Text)) m.Round = Convert.ToInt16(tbRound.Text); m.Update(); var casinoItemGuid = CasinoItem.GetCasinoItemGuidByMatch(guid, CasinoType.MatchResult); if (casinoItemGuid.HasValue && m.ResultHome.HasValue && m.ResultAway.HasValue) { Match.UpdateMatchResult(casinoItemGuid.Value, m.ResultHome.Value, m.ResultAway.Value); } if (casinoItemGuid.HasValue) CasinoItem.UpdateCasinoItemCloseTime(guid, m.PlayTime); } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(typeof(string), "failed", $"alert('{ex.Message}');", true); } } gvMatch.EditIndex = -1; BindData(); }
protected void gvMatch_RowDeleting(object sender, GridViewDeleteEventArgs e) { var key = gvMatch.DataKeys[e.RowIndex]; if (key != null) { try { var m = new Match((Guid)key.Value); m.Delete(); } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(typeof(string), "failed", $"alert('{ex.Message}');", true); } } BindData(); }
protected void btnSingleChoice_Click(object sender, EventArgs e) { try { var guid = CasinoItem.GetCasinoItemGuidByMatch(CurrentMatch, CasinoType.SingleChoice); if (guid.HasValue) { if (CasinoItem.GetCasinoItem(guid.Value).CloseTime < DateTime.Now) { throw new Exception("已超出投注截止时间"); } //Gambler in Lower could not bet above the SingleBetLimit of DefaultLeague (Contest) var m = new Match(CurrentMatch); if (m.LeagueGuid.Equals(ConfigGlobal.DefaultLeagueID)) { if (Gambler.GetGamblerTotalBetByUserId(userid, m.LeagueGuid) < ConfigGlobal.TotalBetStandard) { var alreadyMatchBet = Bet.GetUserMatchTotalBet(userid, CurrentMatch); float currentMatchBet; if (!string.IsNullOrEmpty(tbBet.Text.Trim()) && float.TryParse(tbBet.Text.Trim(), out currentMatchBet)) { if (ConfigGlobal.SingleBetLimit > 0 && alreadyMatchBet + currentMatchBet > ConfigGlobal.SingleBetLimit) { throw new Exception( $"下半赛区博彩玩家单场投注不能超过{ConfigGlobal.SingleBetLimit.ToString("f2")}博彩币"); } } } } //get selected option var item = (SingleChoice)CasinoItem.GetCasinoItem(guid.Value); var seletedOption = item.Options.Find(option => option.OptionValue == rblSingleChoice.SelectedValue); var bet = new Bet { BetAmount = Convert.ToSingle(tbBet.Text.Trim()), BetRate = seletedOption.OptionRate, CasinoItemGuid = guid.Value, UserID = userid, UserName = username }; bet.Insert(seletedOption.OptionValue); ClientScript.RegisterClientScriptBlock(typeof(string), "succeed", "alert('投注成功'); window.location.href = window.location.href;", true); } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(typeof(string), "failed", $"alert('{ex.Message}')", true); } }
protected void gvMatch_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var drv = e.Row.DataItem as DataRowView; if (drv != null) { var m = new Match((Guid)drv["MatchGuid"]); var ltrlLeagueInfo = e.Row.FindControl("ltrlLeagueInfo") as Literal; if (ltrlLeagueInfo != null) { var strLeague = "<a href=\"CasinoGame.aspx?League={0}\" title=\"{1}\"><img src=\"{2}\" alt=\"{1}\" class=\"CasinoSys_CategoryImg\" /></a>"; var strLeagueName = $"{m.LeagueName}{(m.Round.HasValue ? $" 第{m.Round}轮" : string.Empty)}"; ltrlLeagueInfo.Text = string.Format(strLeague, m.LeagueGuid, strLeagueName, League.Cache.Load(m.LeagueGuid).LeagueLogo); } var lblHome = e.Row.FindControl("lblHome") as Label; var lblAway = e.Row.FindControl("lblAway") as Label; var hlVersus = e.Row.FindControl("hlVersus") as HyperLink; if (lblHome != null && lblAway != null && hlVersus != null) { var tHome = Team.Cache.Load(m.Home); var tAway = Team.Cache.Load(m.Away); var strTeamName = "<a class=\"StrongLink\" href=\"CasinoTeam.aspx?Team={0}\" title=\"{1}\">{2}</a> "; var strTeamLogo = "<img src=\"{3}\" alt=\"{1}\" /> "; lblHome.Text = string.Format(strTeamName + strTeamLogo, tHome.ID, tHome.TeamEnglishName, tHome.TeamDisplayName, tHome.TeamLogo); lblAway.Text = string.Format(strTeamLogo + strTeamName, tAway.ID, tAway.TeamEnglishName, tAway.TeamDisplayName, tAway.TeamLogo); hlVersus.NavigateUrl = $"CasinoTeam.aspx?Match={m.MatchGuid}"; hlVersus.Text = $"<em title=\"{tHome.Ground}{(tHome.Capacity.HasValue ? ("(" + tHome.Capacity.Value + ")") : string.Empty)}\">vs</em>"; } var guid = CasinoItem.GetCasinoItemGuidByMatch(m.MatchGuid, CasinoType.SingleChoice); if (guid.HasValue) { var item = CasinoItem.GetCasinoItem(guid.Value); if (item != null) { var options = ((SingleChoice)item).Options; var winOption = options.Find(option => option.OptionValue == MatchChoiceOption.HomeWinValue); var drawOption = options.Find(option => option.OptionValue == MatchChoiceOption.DrawValue); var loseOption = options.Find(option => option.OptionValue == MatchChoiceOption.AwayWinValue); if (!string.IsNullOrEmpty(winOption.OptionValue) && !string.IsNullOrEmpty(drawOption.OptionValue) && !string.IsNullOrEmpty(loseOption.OptionValue)) { var ltrlWinRate = e.Row.FindControl("ltrlWinRate") as Literal; var ltrlDrawRate = e.Row.FindControl("ltrlDrawRate") as Literal; var ltrlLoseRate = e.Row.FindControl("ltrlLoseRate") as Literal; if (ltrlWinRate != null && ltrlDrawRate != null && ltrlLoseRate != null && winOption.OptionRate.HasValue && drawOption.OptionRate.HasValue && loseOption.OptionRate.HasValue) { ltrlWinRate.Text = $"<em title=\"主队胜赔率\">{Convert.ToSingle(winOption.OptionRate.Value).ToString("f2")}</em>"; ltrlDrawRate.Text = $"<em title=\"双方平赔率\">{Convert.ToSingle(drawOption.OptionRate.Value).ToString("f2")}</em>"; ltrlLoseRate.Text = $"<em title=\"客队胜赔率\">{Convert.ToSingle(loseOption.OptionRate.Value).ToString("f2")}</em>"; var lbWinInfo = e.Row.FindControl("lbWinInfo") as Label; var lbDrawInfo = e.Row.FindControl("lbDrawInfo") as Label; var lbLoseInfo = e.Row.FindControl("lbLoseInfo") as Label; if (lbWinInfo != null && lbDrawInfo != null && lbLoseInfo != null) { lbWinInfo.Text = $"{ChoiceOption.GetOptionTotalCount(guid.Value, winOption.OptionValue)} | {ChoiceOption.GetOptionTotalBet(guid.Value, winOption.OptionValue).ToString("N0")}"; lbDrawInfo.Text = $"{ChoiceOption.GetOptionTotalCount(guid.Value, drawOption.OptionValue)} | {ChoiceOption.GetOptionTotalBet(guid.Value, drawOption.OptionValue).ToString("N0")}"; lbLoseInfo.Text = $"{ChoiceOption.GetOptionTotalCount(guid.Value, loseOption.OptionValue)} | {ChoiceOption.GetOptionTotalBet(guid.Value, loseOption.OptionValue).ToString("N0")}"; } var btnBet = e.Row.FindControl("btnBet") as HyperLink; if (btnBet != null) { var betList = Bet.GetUserMatchAllBet(userid, m.MatchGuid); int betCount; if (betList != null && betList.Count > 0) betCount = betList.Count; else betCount = 0; btnBet.Text = $"投注 <span class=\"CasinoSys_BetInfo\">{betCount} | {Bet.GetUserMatchTotalBet(userid, m.MatchGuid).ToString("N0")}</span>"; btnBet.NavigateUrl = $"CasinoGameBet.aspx?Match={m.MatchGuid}"; } } } } } } } }
public static int[] GetHistoryResultByMatch(Guid matchGuid) { var match = new Match(matchGuid); var intArr = new int[4]; var matchCount = 0; var wonCount = 0; var drawCount = 0; var loseCount = 0; var dt = DataAccess.CasinoItem.GetEndMatchViewByTeams(match.Home, match.Away); if (dt != null) { foreach (DataRow dr in dt.Rows) { var historyMatch = new Match((Guid)dr["MatchGuid"]); if (match.Home == historyMatch.Home && match.Away == historyMatch.Away) { if (historyMatch.ResultHome > historyMatch.ResultAway) wonCount++; else if (historyMatch.ResultHome < historyMatch.ResultAway) loseCount++; else drawCount++; } else if (match.Home == historyMatch.Away && match.Away == historyMatch.Home) { if (historyMatch.ResultHome < historyMatch.ResultAway) wonCount++; else if (historyMatch.ResultHome > historyMatch.ResultAway) loseCount++; else drawCount++; } } matchCount = wonCount + drawCount + loseCount; } intArr[0] = matchCount; intArr[1] = wonCount; intArr[2] = drawCount; intArr[3] = loseCount; return intArr; }
protected void gvBet_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var bet = e.Row.DataItem as Bet; var ltrlHome = e.Row.FindControl("ltrlHome") as Literal; var ltrlAway = e.Row.FindControl("ltrlAway") as Literal; var ltrlVs = e.Row.FindControl("ltrlVS") as Literal; if (bet != null && ltrlHome != null && ltrlAway != null && ltrlVs != null) { var item = CasinoItem.GetCasinoItem(bet.CasinoItemGuid); if (CurrentMatch != Guid.Empty) { ltrlHome.Text = _home; ltrlAway.Text = _away; } else { if (item.MatchGuid != null) { var m = new Match(item.MatchGuid.Value); var homeT = Team.Cache.Load(m.Home); var awayT = Team.Cache.Load(m.Away); ltrlHome.Text = $"<a class=\"StrongLink\" href=\"CasinoTeam.aspx?Team={homeT.ID}\">{homeT.TeamDisplayName}</a>"; ltrlAway.Text = $"<a class=\"StrongLink\" href=\"CasinoTeam.aspx?Team={awayT.ID}\">{awayT.TeamDisplayName}</a>"; ltrlVs.Text = $"<a href=\"CasinoTeam.aspx?Match={m.MatchGuid}\"><em title=\"{homeT.Ground}({homeT.Capacity})\">vs</em></a>"; } } var ltrlResult = e.Row.FindControl("ltrlResult") as Literal; var dt = BetDetail.GetBetDetailByBetId(bet.ID); if (dt != null && ltrlResult != null) { var dr = dt.Rows[0]; switch (item.ItemType) { case CasinoType.SingleChoice: if (dr["DetailName"].ToString() == MatchChoiceOption.HomeWinValue) ltrlResult.Text = "主队胜"; else if (dr["DetailName"].ToString() == MatchChoiceOption.DrawValue) ltrlResult.Text = "双方平"; else if (dr["DetailName"].ToString() == MatchChoiceOption.AwayWinValue) ltrlResult.Text = "客队胜"; break; case CasinoType.MatchResult: var betDetail = new MatchResultBetDetail(dt); ltrlResult.Text = $"{betDetail.Home}:{betDetail.Away}"; break; } } var ltrlBetResult = e.Row.FindControl("ltrlBetResult") as Literal; if (ltrlBetResult != null) { if (!bet.IsWin.HasValue) { ltrlBetResult.Text = string.Empty; } else { if (bet.IsWin != null && bet.IsWin.Value) { if (item.ItemType == CasinoType.SingleChoice) ltrlBetResult.Text = "<span class=\"CasinoSys_True\" title=\"猜对输赢\"></span>"; else if (item.ItemType == CasinoType.MatchResult) ltrlBetResult.Text = "<span class=\"CasinoSys_Good\" title=\"猜对比分\"></span>"; e.Row.CssClass = "RowCasinoSys_True"; } else { ltrlBetResult.Text = "<span class=\"CasinoSys_False\" title=\"失败\"></span>"; } } } var ltrlBetRate = e.Row.FindControl("ltrlBetRate") as Literal; if (ltrlBetRate != null) { ltrlBetRate.Text = bet.BetRate.HasValue ? Convert.ToSingle(bet.BetRate).ToString("f2") : "/"; } } } }
public static DataTable GetHistoryViewByMatch(Guid matchGuid) { var match = new Match(matchGuid); var dt = DataAccess.CasinoItem.GetEndMatchViewByTeams(match.Home, match.Away); return dt; }
protected void gvBonusLog_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var drv = e.Row.DataItem as DataRowView; if (drv != null) { var m = new Match((Guid) drv["MatchGuid"]); var hlHome = e.Row.FindControl("hlHome") as HyperLink; var hlAway = e.Row.FindControl("hlAway") as HyperLink; var hlVersus = e.Row.FindControl("hlVersus") as HyperLink; if (hlHome != null && hlAway != null && hlVersus != null) { var tHome = Team.Cache.Load(m.Home); var tAway = Team.Cache.Load(m.Away); hlHome.Text = tHome.TeamDisplayName; hlHome.NavigateUrl = $"CasinoTeam.aspx?Team={m.Home}"; hlAway.Text = tAway.TeamDisplayName; hlAway.NavigateUrl = $"CasinoTeam.aspx?Team={m.Away}"; hlVersus.NavigateUrl = $"CasinoTeam.aspx?Match={m.MatchGuid}"; hlVersus.Text = $"<em title=\"{tHome.Ground}{(tHome.Capacity.HasValue ? ("(" + tHome.Capacity.Value + ")") : string.Empty)}\">vs</em>"; } var betList = Bet.GetUserMatchAllBet(CurrentUserId, m.MatchGuid); betList.RemoveAll(bet => !bet.IsWin.HasValue); float totalBetCount = 0, totalWin = 0; var rpBonus = false; foreach (var bet in betList) { totalBetCount += bet.BetAmount.GetValueOrDefault(0f); if (bet.Earning != null) totalWin += (bet.Earning.Value - bet.BetAmount.GetValueOrDefault(0f)); if (bet.IsWin != null && (bet.IsWin.Value && !bet.BetAmount.HasValue)) rpBonus = true; } var ltrlResult = e.Row.FindControl("ltrlResult") as Literal; var ltrlBetCount = e.Row.FindControl("ltrlBetCount") as Literal; var ltrWinLose = e.Row.FindControl("ltrWinLose") as Literal; var ltrlExtraBonus = e.Row.FindControl("ltrlExtraBonus") as Literal; ltrlBetCount.Text = totalBetCount.ToString("N0"); ltrWinLose.Text = totalWin.ToString("N2"); ltrlExtraBonus.Text = rpBonus ? "RP+1" : "/"; if (totalWin > 0) { ltrlResult.Text = "<span class=\"CasinoSys_Agree\" title=\"盈余\"></span>"; e.Row.CssClass = "RowCasinoSys_True"; } else { ltrlResult.Text = "<span class=\"CasinoSys_Disagree\" title=\"亏损\"></span>"; } } } }
protected void Page_Load(object sender, EventArgs e) { if (MatchGuid != Guid.Empty) { var m = new Match(MatchGuid); var leagueDisplay = m.LeagueName; if (m.Round.HasValue) leagueDisplay += $" 第{m.Round}轮"; ltrlLeagueSeason.Text = leagueDisplay; var homeGuid = m.Home; var awayGuid = m.Away; HomeTeam = Team.Cache.Load(homeGuid); AwayTeam = Team.Cache.Load(awayGuid); ltrlPlayTime.Text = m.PlayTime.ToString("yyyy-MM-dd HH:mm"); var guid = CasinoItem.GetCasinoItemGuidByMatch(MatchGuid, CasinoType.SingleChoice); var matchTotalBet = 0f; if (guid.HasValue) { var item = CasinoItem.GetCasinoItem(guid.Value); if (item != null) { var options = ((SingleChoice) item).Options; var winOption = options.Find(option => option.OptionValue == MatchChoiceOption.HomeWinValue); var drawOption = options.Find(option => option.OptionValue == MatchChoiceOption.DrawValue); var loseOption = options.Find(option => option.OptionValue == MatchChoiceOption.AwayWinValue); if (string.IsNullOrEmpty(winOption.OptionValue) || string.IsNullOrEmpty(drawOption.OptionValue) || string.IsNullOrEmpty(loseOption.OptionValue)) throw new Exception("该比赛没有赔率"); var txtString = "<em title=\"共有{0}注,总计:{1}博彩币\">{2}</em>"; if (winOption.OptionRate.HasValue && drawOption.OptionRate.HasValue && loseOption.OptionRate.HasValue) { var rateWin = Math.Round(winOption.OptionRate.Value, 2).ToString("f2"); var rateDraw = Math.Round(drawOption.OptionRate.Value, 2).ToString("f2"); var rateLose = Math.Round(loseOption.OptionRate.Value, 2).ToString("f2"); var totalBetWin = ChoiceOption.GetOptionTotalBet(guid.Value, winOption.OptionValue).ToString("N0"); var totalBetDraw = ChoiceOption.GetOptionTotalBet(guid.Value, drawOption.OptionValue).ToString("N0"); var totalBetLose = ChoiceOption.GetOptionTotalBet(guid.Value, loseOption.OptionValue).ToString("N0"); var betCountWin = ChoiceOption.GetOptionTotalCount(guid.Value, winOption.OptionValue).ToString(); var betCountDraw = ChoiceOption.GetOptionTotalCount(guid.Value, drawOption.OptionValue).ToString(); var betCountLose = ChoiceOption.GetOptionTotalCount(guid.Value, loseOption.OptionValue).ToString(); ltrlWin.Text = string.Format(txtString, betCountWin, totalBetWin, rateWin); ltrlDraw.Text = string.Format(txtString, betCountDraw, totalBetDraw, rateDraw); ltrlLose.Text = string.Format(txtString, betCountLose, totalBetLose, rateLose); matchTotalBet = Convert.ToSingle(totalBetWin) + Convert.ToSingle(totalBetDraw) + Convert.ToSingle(totalBetLose); } } var betList = Bet.GetMatchAllBet(MatchGuid); if (betList != null && betList.Count > 0) ltrlMatchBetCount.Text = betList.Count.ToString(); else ltrlMatchBetCount.Text = "0"; ltrlMatchTotalBet.Text = matchTotalBet.ToString("N0"); if (!IsHistoryView) { pnlHistoryResult.Visible = false; if (item?.Earning != null) ltrlEarning.Text = Convert.ToSingle(item.Earning).ToString("N2"); ltrlTopBet.Text = Bet.GetMatchTopBet(MatchGuid).ToString("N0"); ltrlTopEarning.Text = Bet.GetMatchTopEarning(MatchGuid).ToString("N2"); var matchResultGuid = CasinoItem.GetCasinoItemGuidByMatch(MatchGuid, CasinoType.MatchResult); if (matchResultGuid.HasValue) { var matchResultItem = CasinoItem.GetCasinoItem(matchResultGuid.Value); if (((MatchResult) matchResultItem)?.Home != null && ((MatchResult) matchResultItem).Away.HasValue) { pnlMatchResult.Visible = true; ltrlMatchResult.Text = $"{((MatchResult) matchResultItem).Home}:{((MatchResult) matchResultItem).Away}"; } else { pnlMatchResult.Visible = false; ltrlMatchResult.Text = "暂无结果"; ltrlEarning.Text = "暂无结果"; } } } else { pnlHistoryResult.Visible = true; pnlMatchResult.Visible = false; var historyResultArr = CasinoItem.GetHistoryResultByMatch(MatchGuid); ltrlMatchCount.Text = historyResultArr[0].ToString(); ltrlHomeWon.Text = historyResultArr[1].ToString(); ltrlHomeDraw.Text = historyResultArr[2].ToString(); ltrlHomeLost.Text = historyResultArr[3].ToString(); } } } }