public static DataTable GetTournamentLosersByRound(int toutnamentId, int round) { DataTable dt = BaseCollection.Execute("GetTournamentPlayersByRound", toutnamentId, round, false); dt.TableName = InfiChess.TournamentRound.ToString(); return(dt); }
public static DataTable GetTournamentRoundByPlayers(int toutnamentId, int round, int whiteUserId, int blackUserId) { DataTable dt = BaseCollection.Execute("GetTournamentRoundByPlayers", toutnamentId, round, whiteUserId, blackUserId); dt.TableName = InfiChess.TournamentRound.ToString(); return(dt); }
public static void DeleteTournamentTeams(Cxt cxt, TournamentTeams TournamentTeams) { SqlTransaction trans = null; try { trans = SqlHelper.BeginTransaction(Config.ConnectionString); for (int i = 0; i < TournamentTeams.Count; i++) { //TournamentTeams.Delete(InfiChess.TournamentTeam, Convert.ToInt32(TournamentTeams.DataTable.Rows[i]["TournamentTeamID"])); BaseCollection.ExecuteSql2(trans, "update TournamentTeam statusid = @p1 where TournamentTeamID = @p2", (int)StatusE.Deleted, Convert.ToInt32(TournamentTeams.DataTable.Rows[i]["TournamentTeamID"])); } for (int i = 0; i < TournamentTeams.Count; i++) { BaseCollection.Execute(trans, "UpdateTournamentUserStatusByTeamID", Convert.ToInt32(TournamentTeams.DataTable.Rows[i]["TeamID"]), TournamentTeams.TournamentID, cxt.CurrentUserID, DateTime.Now, (int)StatusE.Deleted); } SqlHelper.CommitTransaction(trans); } catch (Exception ex) { SqlHelper.RollbackTransaction(trans); Log.Write(cxt, ex); } }
public static void DeleteTournamentTeams(Cxt cxt, SqlTransaction trans, int tournamentID) { BaseCollection.Execute(trans, "UpdateTournamentTeamStatus", tournamentID, (int)StatusE.Deleted, cxt.CurrentUserID, DateTime.Now); }
/// <summary> /// online client /// </summary> /// <param name="cxt"></param> /// <param name="items"></param> /// <param name="dtTournamentWantin"></param> private static void SaveWantinUsers(SqlTransaction trans, Cxt cxt, int statusID, int tournamentUserStatusID, int tournamentID, string userIDs, string tournamentWantinUserIDs, int teamID, int eloBefore) { string[] userIDArr = userIDs.Split(','); int uId = -1; foreach (string userID in userIDArr) { if (!Int32.TryParse(userID, out uId)) { continue; } BaseCollection.Execute(trans, "CreateTournamentRegisterUser", tournamentID, uId, statusID, teamID, eloBefore, cxt.CurrentUser.UserID, DateTime.Now); } string[] tournamentWantinUserIDArr = tournamentWantinUserIDs.Split(','); BaseCollection.Execute(trans, "UpdateWantinUserStatusByUserID", userIDs, tournamentID, tournamentUserStatusID, cxt.CurrentUserID, DateTime.Now); }
public static void CreateServerStatistics(Cxt cxt) { try { BaseCollection.Execute("CreateServerStatistics"); } catch (Exception ex) { Log.Write(cxt, ex); } }
public static DataTable GetTournamentUsers(int TournamentID, int TeamID, UserStatusE UserStatusID, TournamentEntityTypeE TournamentEntityTypeID) { if (TournamentEntityTypeID == TournamentEntityTypeE.RegisteredUser) { return(BaseCollection.Execute("GetTournamentRegisteredUsers", TournamentID, TeamID)); //ExecuteSql("GetTournamentRegisteredUsers @p", ); } else { return(BaseCollection.Execute("GetTournamentUsers", TournamentID, TeamID, UserStatusID.ToString("d"))); } }
public static void CreateRegisterUsers(Cxt cxt, SqlTransaction sqlTrans, DataTable dt) { foreach (DataRow dr in dt.Rows) { TournamentUser tournamentUser = new TournamentUser(cxt, dr); BaseCollection.Execute(sqlTrans, "CreateTournamentRegisterUser", tournamentUser.TournamentID, tournamentUser.UserID, tournamentUser.StatusID, tournamentUser.TeamID, tournamentUser.EloBefore, cxt.CurrentUser.UserID, DateTime.Now); } }
public static bool GetTournamentMatchByTournamentUserID(Cxt cxt, int tournamentID, int userID) { bool result = false; DataTable dt = BaseCollection.Execute("GetTournamentMatchByTournamentUserID", tournamentID, userID); if (dt.Rows.Count > 0) { result = true; } else { result = false; } return(result); }
//public static void UpdateWantinUsers(Cxt cxt, UpdateTournamentUsersS UpdateTournamentUsersS) //{ // SqlTransaction sqltrans = null; // try // { // sqltrans = SqlHelper.BeginTransaction(Config.ConnectionString); // BaseCollection.Execute(sqltrans, "UpdateTournamentUserStatus", // UpdateTournamentUsersS.TournamentUserIDs, // UpdateTournamentUsersS.TournamentID, // UpdateTournamentUsersS.UserId, // DateTime.Now, // UpdateTournamentUsersS.statusID.ToString("d")); // BaseCollection.Execute(sqltrans, "UpdateTournamentWantinUserStatus", // "", // UpdateTournamentUsersS.TournamentWantinUserIDs, // UpdateTournamentUsersS.tournamentUserStatusID.ToString("d"), // (int)StatusE.Active, // UpdateTournamentUsersS.UserId, DateTime.Now); // //BaseCollection.Execute(sqltrans, "DeleteTournamentMatchByUserID", // // UpdateTournamentUsersS.TournamentUserIDs, // // UpdateTournamentUsersS.TournamentID , // // 1); // SqlHelper.CommitTransaction(sqltrans); // } // catch (Exception ex) // { // SqlHelper.RollbackTransaction(sqltrans); // Log.Write(cxt, ex); // } //} /// <summary> /// Online client wantin user update /// </summary> /// <param name="cxt"></param> /// <param name="statusID"></param> /// <param name="tournamentUserStatusID"></param> /// <param name="tournamentID"></param> /// <param name="userIDs"></param> /// <param name="tournamentWantinUserIDs"></param> public static void SaveWantinUsers(Cxt cxt, int statusID, int tournamentUserStatusID, int tournamentID, string userIDs, string tournamentWantinUserIDs, int teamID, int eloBefore) { SqlTransaction sqltrans = null; try { sqltrans = SqlHelper.BeginTransaction(Config.ConnectionString); StatusE StatusIDE = (StatusE)Enum.ToObject(typeof(StatusE), statusID); if (StatusIDE == StatusE.Active) { SaveWantinUsers(sqltrans, cxt, statusID, tournamentUserStatusID, tournamentID, userIDs, tournamentWantinUserIDs, teamID, eloBefore); } else { BaseCollection.Execute(sqltrans, "UpdateTournamentUserStatus", userIDs, tournamentID, cxt.CurrentUserID, DateTime.Now, statusID); BaseCollection.Execute(sqltrans, "UpdateWantinUserStatusByUserID", userIDs, tournamentID, tournamentUserStatusID, cxt.CurrentUserID, DateTime.Now); } SqlHelper.CommitTransaction(sqltrans); } catch (Exception ex) { SqlHelper.RollbackTransaction(sqltrans); Log.Write(cxt, ex); } }
public static void UpdateStatus(SqlTransaction trans, Cxt cxt, TournamentMatchStatusE tournamentMatchStatusID, string tournamentMatchIDs, GameResultE gameResultID) { StringBuilder sb = new StringBuilder(); BaseCollection.Execute(trans, "UpdateTournamentMatchStatus", tournamentMatchIDs, tournamentMatchStatusID.ToString("d"), gameResultID.ToString("d"), cxt.CurrentUserID ); if (tournamentMatchStatusID != TournamentMatchStatusE.Scheduled && tournamentMatchStatusID != TournamentMatchStatusE.Absent) { BaseCollection.Execute(trans, "UpdateTournamentChallengeStatus", tournamentMatchIDs, StatusE.Deleted.ToString("d"), cxt.CurrentUserID); } }
public static Kv UpdateReplacePlayer(Cxt cxt, int tournamentID, int userID, int userID2) { Kv kv = new Kv(); SqlTransaction trans = null; try { trans = SqlHelper.BeginTransaction(Config.ConnectionString); bool result = TournamentMatch.GetTournamentMatchByTournamentUserID(cxt, tournamentID, userID); if (result) { kv.Set("Result", (int)MsgE.ErrorTournamentPlayerReplaceUser); return(kv); } TournamentUser tu = GetTournamentUserById(cxt, tournamentID, userID); BaseCollection.Execute(trans, "UpdateTournamentMatchWithUser", tournamentID, userID, userID2, cxt.CurrentUserID, 3); if (tu.UserID2 > 0) { userID = tu.UserID2; } BaseCollection.Execute(trans, "UpdateTournamentMatchWithUser", tournamentID, userID, userID2, cxt.CurrentUserID, 0); BaseCollection.Execute(trans, "UpdateTournamentMatchWithUser", tournamentID, userID, userID2, cxt.CurrentUserID, 1); SqlHelper.CommitTransaction(trans); kv.Set("Result", 0); } catch (Exception ex) { SqlHelper.RollbackTransaction(trans); Log.Write(cxt, ex); } return(kv); }
public static void DeleteTournamentTeams(Cxt cxt, string tournamentTeamIDs, int tournamentID) { string[] tournamentTeamIDsArr = tournamentTeamIDs.Split(','); SqlTransaction trans = null; try { trans = SqlHelper.BeginTransaction(Config.ConnectionString); foreach (string itemID in tournamentTeamIDsArr) { if (string.IsNullOrEmpty(itemID)) { continue; } BaseCollection.ExecuteSql2(trans, "update TournamentTeam set StatusID = @p1 where TeamID = @p2 and TournamentID = @p3", (int)StatusE.Deleted, Convert.ToInt32(itemID), tournamentID); //TournamentTeams.DeleteInfiChess.TournamentTeam, Convert.ToInt32(itemID)); } BaseCollection.Execute(trans, "UpdateTournamentUserStatusByTeamID", tournamentTeamIDs, tournamentID, cxt.CurrentUserID, DateTime.Now, (int)StatusE.Deleted); BaseCollection.Execute(trans, "UpdateTournamentWantinUserStatus", tournamentTeamIDs, tournamentID, (int)TournamentUserStatusE.Declined, (int)StatusE.Deleted, cxt.CurrentUserID, DateTime.Now); SqlHelper.CommitTransaction(trans); } catch (Exception ex) { SqlHelper.RollbackTransaction(trans); Log.Write(cxt, ex); } }
public static DataTable GetChallengesByRoomID(Cxt cxt, int roomID, int userID) { return(BaseCollection.Execute("GetChallengesByRoomID", roomID, userID)); }
public static DataTable GetAllUser(int roomId) { return(BaseCollection.Execute("GetUsersByRoomID", roomId)); }
public static DataTable GetUsersByGameType(Cxt cxt, ChessTypeE ChessTypeE, GameType GameTypeE) { return(BaseCollection.Execute("GetTopRatingByGameType", ChessTypeE.ToString("d"), GameTypeE.ToString("d"))); }
public static void UpdateGameStatusWithTournamentMatchID(Cxt cxt, SqlTransaction trans, string gameIDs, GameResultE gameResultID) { BaseCollection.Execute(trans, "UpdateGameStatusWithTournamentMatchID", gameIDs, gameResultID.ToString("d"), cxt.CurrentUserID, DateTime.Now); }
public static DataTable GetAllGamesByTournamentID(Cxt cxt, int tournamentID) { return(BaseCollection.Execute("GetAllGamesByTournamentID", tournamentID)); }
public static DataTable GetGamesByUserName(Cxt cxt, string userName) { User user = User.GetUser(cxt, userName); return(BaseCollection.Execute("GetGamesByUserID", user.UserID)); }
public static void DeleteTournamentUser(Cxt cxt, SqlTransaction trans, int tournamentID) { BaseCollection.Execute(trans, "UpdateTournamentUserStatusByTeamID", "0", tournamentID, cxt.CurrentUserID, DateTime.Now, (int)StatusE.Deleted); }
public static DataTable GetGamesByRoomID(Cxt cxt, int roomID) { return(BaseCollection.Execute("GetGamesByRoomID", roomID)); }
public static void UpdateAllChallenges(SqlTransaction t, int challengeID, int currentUserID, int ChallengerUserID) { BaseCollection.Execute(t, "UpdateAllChallengesByID", challengeID, currentUserID, ChallengerUserID); }
public static DataTable GetTournamentsMatchByTournamentID(int tournamentID) { return(BaseCollection.Execute("GetTournamentMatchByTournamentID", tournamentID)); }
public static DataTable GetuserMessages(Cxt cxt, int userID) { return(BaseCollection.Execute("GetuserMessages", userID)); }
public static DataTable GetAllTournaments(TournamentStatusE TournamentStatusID) { return(BaseCollection.Execute("GetAllTournament", TournamentStatusID.ToString("d"))); }
public static DataTable GetHighestRankingPlayerGame(Cxt cxt) { return(BaseCollection.Execute("GetHighestRankingPlayerGame", cxt.CurrentUserID)); }
public static DataTable GetUserByName(Cxt cxt, string userName) { return(BaseCollection.Execute("GetUserInfoByUserID", 0, userName)); }
public static DataTable GetGamesByUserID(Cxt cxt, int userID) { return(BaseCollection.Execute("GetGamesByUserID", userID)); }
public static DataTable GetSchTournamentWantinUsers(int TournamentID) { return(BaseCollection.Execute("GetSchTournamentWantinUsers", TournamentID)); }
public static DataTable GetTournamentUsersByRound(int tournamentID, int round) { return(BaseCollection.Execute("GetTournamentUsersByRound", tournamentID, round)); }