//从数据库获取技术统计推算的比分 public static object dbGetScoreFromStat(bool bTeamA) { String strSql = String.Format("select dbo.func_VB_ScoreByStat({0}, {1}, {2}, {2})", g_nMatchID, g_Game.GetCurSet(), bTeamA ? 1 : 2); return(dbGetValue(strSql)); }
public bool dgvMatchScoreRefresh(GameGeneralBall gameObj = null) { if (gameObj == null) { gameObj = Common.g_Game; } dgvMatchScore[2, 1].Value = gameObj.IsServeTeamB() ? "" : "●"; dgvMatchScore[2, 2].Value = gameObj.IsServeTeamB() ? "●" : ""; dgvMatchScore[3, 1].Value = gameObj.GetScoreSetStr(false, 1); dgvMatchScore[3, 2].Value = gameObj.GetScoreSetStr(true, 1); dgvMatchScore[4, 1].Value = gameObj.GetScoreSetStr(false, 2); dgvMatchScore[4, 2].Value = gameObj.GetScoreSetStr(true, 2); dgvMatchScore[5, 1].Value = gameObj.GetScoreSetStr(false, 3); dgvMatchScore[5, 2].Value = gameObj.GetScoreSetStr(true, 3); dgvMatchScore[6, 1].Value = gameObj.GetScoreSetStr(false, 4); dgvMatchScore[6, 2].Value = gameObj.GetScoreSetStr(true, 4); dgvMatchScore[7, 1].Value = gameObj.GetScoreSetStr(false, 5); dgvMatchScore[7, 2].Value = gameObj.GetScoreSetStr(true, 5); dgvMatchScore[8, 1].Value = gameObj.GetScoreMatchStr(false); dgvMatchScore[8, 2].Value = gameObj.GetScoreMatchStr(true); dgvMatchScore[3, 1].Style.ForeColor = gameObj.GetWinSet(1) == EGbTeam.emTeamA ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[3, 2].Style.ForeColor = gameObj.GetWinSet(1) == EGbTeam.emTeamB ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[4, 1].Style.ForeColor = gameObj.GetWinSet(2) == EGbTeam.emTeamA ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[4, 2].Style.ForeColor = gameObj.GetWinSet(2) == EGbTeam.emTeamB ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[5, 1].Style.ForeColor = gameObj.GetWinSet(3) == EGbTeam.emTeamA ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[5, 2].Style.ForeColor = gameObj.GetWinSet(3) == EGbTeam.emTeamB ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[6, 1].Style.ForeColor = gameObj.GetWinSet(4) == EGbTeam.emTeamA ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[6, 2].Style.ForeColor = gameObj.GetWinSet(4) == EGbTeam.emTeamB ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[7, 1].Style.ForeColor = gameObj.GetWinSet(5) == EGbTeam.emTeamA ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[7, 2].Style.ForeColor = gameObj.GetWinSet(5) == EGbTeam.emTeamB ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[8, 1].Style.ForeColor = gameObj.GetWinMatch() == EGbTeam.emTeamA ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[8, 2].Style.ForeColor = gameObj.GetWinMatch() == EGbTeam.emTeamB ? ClrScr_Win : ClrScr_Nor; dgvMatchScore[3, 3].Value = gameObj.GetTimeSetStr(1); dgvMatchScore[4, 3].Value = gameObj.GetTimeSetStr(2); dgvMatchScore[5, 3].Value = gameObj.GetTimeSetStr(3); dgvMatchScore[6, 3].Value = gameObj.GetTimeSetStr(4); dgvMatchScore[7, 3].Value = gameObj.GetTimeSetStr(5); dgvMatchScore[8, 3].Value = gameObj.GetTimeMatchStr(); Int32 nCurSet = gameObj.GetCurSet(); dgvMatchScore[3, 0].Value = (nCurSet == 1) ? "●" : ""; dgvMatchScore[4, 0].Value = (nCurSet == 2) ? "●" : ""; dgvMatchScore[5, 0].Value = (nCurSet == 3) ? "●" : ""; dgvMatchScore[6, 0].Value = (nCurSet == 4) ? "●" : ""; dgvMatchScore[7, 0].Value = (nCurSet == 5) ? "●" : ""; DataTable tblMatchInfo = Common.dbGetMatchInfo(Common.g_nMatchID, Common.g_strLanguage); if (tblMatchInfo != null) { dgvMatchScore[1, 1].Value = tblMatchInfo.Rows[0]["F_IRMCodeA"].ToString(); dgvMatchScore[1, 2].Value = tblMatchInfo.Rows[0]["F_IRMCodeB"].ToString(); } dgvMatchScore[8, 0].Value = gameObj.GetPointInfo().GetCountStr() + ' ' + gameObj.GetPointInfo().GetPointStr(); return(true); }
public static bool dbGameObj2Db(Int32 nMatchID, GameGeneralBall gameObj) { if (nMatchID <= 0) { Debug.Assert(false); return(false); } StringBuilder strWin = new StringBuilder(); StringBuilder strTime = new StringBuilder(); StringBuilder strPoint = new StringBuilder(); StringBuilder strScoreIntA = new StringBuilder(); StringBuilder strScoreIntB = new StringBuilder(); StringBuilder strScoreStrA = new StringBuilder(); StringBuilder strScoreStrB = new StringBuilder(); //先往字符串里装入总的信息 Int32 nWin = 0; EGbTeam eTeam = gameObj.GetWinMatch(); if (eTeam == EGbTeam.emTeamA) { nWin = 1; } else if (eTeam == EGbTeam.emTeamB) { nWin = 2; } else { nWin = 0; } strWin.Append(nWin); strTime.Append(gameObj.GetTimeMatch() / 1000 / 60); //获取Point信息 { SGbPointInfo ePoint = gameObj.GetPointInfo(); if (ePoint.m_ePoint == EGbPointInfo.emPointSet) { strPoint.Append("1,"); } else if (ePoint.m_ePoint == EGbPointInfo.emPointGame || ePoint.m_ePoint == EGbPointInfo.emPointMatch) { strPoint.Append("2,"); } else { strPoint.Append("0,"); } if (ePoint.m_eTeam == EGbTeam.emTeamA) { strPoint.Append("1,"); } else if (ePoint.m_eTeam == EGbTeam.emTeamB) { strPoint.Append("2,"); } else { strPoint.Append("0,"); } strPoint.Append(ePoint.m_byCount.ToString()); strPoint.Append(","); } strScoreIntA.Append(gameObj.GetScoreMatch(false)); strScoreIntB.Append(gameObj.GetScoreMatch(true)); strScoreStrA.Append(gameObj.GetScoreMatchStr(false)); strScoreStrB.Append(gameObj.GetScoreMatchStr(true)); strWin.Append(','); strTime.Append(','); strScoreIntA.Append(','); strScoreIntB.Append(','); strScoreStrA.Append(','); strScoreStrB.Append(','); //再循环装入每局信息 for (int nCycSet = 1; nCycSet < GameGeneralBall.MAX_SET; nCycSet++) { Int32 nSetWin = 0; EGbTeam eSetTeam = gameObj.GetWinSet(nCycSet); if (eSetTeam == EGbTeam.emTeamA) { nSetWin = 1; } else if (eSetTeam == EGbTeam.emTeamB) { nSetWin = 2; } else { nSetWin = 0; } strWin.Append(nSetWin); strTime.Append(gameObj.GetTimeSet(nCycSet) / 1000 / 60); strScoreIntA.Append(gameObj.GetScoreSet(false, nCycSet)); strScoreIntB.Append(gameObj.GetScoreSet(true, nCycSet)); strScoreStrA.Append(gameObj.GetScoreSetStr(false, nCycSet)); strScoreStrB.Append(gameObj.GetScoreSetStr(true, nCycSet)); strWin.Append(','); strTime.Append(','); strScoreIntA.Append(','); strScoreIntB.Append(','); strScoreStrA.Append(','); strScoreStrB.Append(','); } SqlCommand dbCmd = new SqlCommand("proc_VB_PRG_MatchSetScore", g_DataBaseCon); dbCmd.CommandType = CommandType.StoredProcedure; dbCmd.Parameters.AddWithValue("@MatchID", nMatchID); dbCmd.Parameters.AddWithValue("@SetCount", 5); dbCmd.Parameters.AddWithValue("@CurSet", gameObj.GetCurSet()); dbCmd.Parameters.AddWithValue("@ServeTeamB", gameObj.IsServeTeamB() ? 1 : 0); dbCmd.Parameters.AddWithValue("@PointInfo", strPoint.ToString()); dbCmd.Parameters.AddWithValue("@SetWinList", strWin.ToString()); dbCmd.Parameters.AddWithValue("@SetTimeList", strTime.ToString()); dbCmd.Parameters.AddWithValue("@SetScoreListA", strScoreIntA.ToString()); dbCmd.Parameters.AddWithValue("@SetScoreListB", strScoreIntB.ToString()); dbCmd.Parameters.AddWithValue("@SetScoreListStrA", strScoreStrA.ToString()); dbCmd.Parameters.AddWithValue("@SetScoreListStrB", strScoreStrB.ToString()); dbCmd.Parameters.AddWithValue("@Result", DBNull.Value); dbCmd.Parameters["@Result"].Size = 4; dbCmd.Parameters["@Result"].SqlDbType = SqlDbType.Int; dbCmd.Parameters["@Result"].Direction = ParameterDirection.Output; if (!dbExecuteNonQuery(ref dbCmd)) { MessageBox.Show("proc_VB_PRG_MatchSetScore exec failed!"); return(false); } if ((int)dbCmd.Parameters["@Result"].Value <= 0) { MessageBox.Show("proc_VB_PRG_MatchSetScore return failed!"); return(false); } return(true); }