public void Load(int id) { if (TableName == InfiChess.Unknown) { return; } DataTable table = BaseCollection.Select(TableName, PrimaryKey, id); SetRow(table); }
public void SaveIp(Cxt cxt, string IPAddress, int BlockedBy) { if (IPAddress == "") { return; } try { BaseCollection.ExecuteSql("Insert into BlockedIP (IPAddress,CreatedBy,DateCreated) values ('" + IPAddress + "'," + BlockedBy + ",'" + DateTime.Now.ToString() + "')"); } catch (Exception ex) { Log.Write(cxt, ex); } }
public void SendMessage() { UserMessage item = new UserMessage(); try { string selectQuery; DataTable table; selectQuery = "SELECT UserID FROM [User] WHERE UserName = '******'"; table = BaseCollection.ExecuteSql(selectQuery); if (table != null && table.Rows.Count > 0) { UserIDTo = UData.ToInt32(table.Rows[0][0]); } else { UserIDTo = 0; } item.Cxt = base.Kv.Cxt; item.UserIDFrom = UserIDFrom; item.UserIDTo = UserIDTo; item.EmailTime = DateTime.Now; item.Text = Text; item.Subject = Subject; item.StatusIDFrom = StatusIDFrom; item.StatusIDTo = StatusIDTo; item.Size = Size; item.Cxt.CurrentUserID = base.Kv.Cxt.CurrentUserID; item.Save(); } catch (Exception ex) { throw ex; } }
public DataTable AddChallenge() { Challenge item; try { string selectQuery; DataTable table; if (OpponentUserID != 0) { selectQuery = "SELECT TOP 1 * FROM Challenge WHERE ChallengerUserID = @p1 AND OpponentUserID = @p2 AND ChallengeStatusID = 1 AND StatusID = 1"; table = BaseCollection.ExecuteSql(InfiChess.Challenge, selectQuery, ChallengerUserID, OpponentUserID); } else { selectQuery = "SELECT TOP 1 * FROM Challenge WHERE ChallengerUserID = @p1 AND OpponentUserID IS NULL AND ChallengeStatusID = 1 AND StatusID = 1"; table = BaseCollection.ExecuteSql(InfiChess.Challenge, selectQuery, ChallengerUserID, null); } if (table != null && table.Rows.Count > 0) { item = new Challenge(base.Kv.Cxt, table.Rows[0]); } else { item = new Challenge(); } item.Cxt = base.Kv.Cxt; item.ChallengerUserID = ChallengerUserID; item.ChallengeTypeID = ChallengeTypeID; item.ChessTypeID = ChessTypeID; item.ColorID = ColorID; item.IsRated = IsRated; item.WithClock = WithClock; item.IsChallengerSendsGame = IsChallengerSendsGame; item.Description = Description; item.GameTypeID = GameTypeID; if (OpponentUserID > 0) { item.OpponentUserID = OpponentUserID; } item.RoomID = RoomID; item.StatusID = StatusID; item.TimeMin = TimeMin; item.GainPerMoveMin = GainPerMoveMin; item.ChallengeStatusIDE = ChallengeStatusE.Seeking; item.Stake = Stake; item.Flate = Flate; item.Cxt.CurrentUserID = Kv.Cxt.CurrentUserID; item.Save(); } catch (Exception ex) { throw ex; } return(Challenges.GetChallengesByRoomID(item.Cxt, RoomID, item.Cxt.CurrentUserID)); }
public FilterItems(Cxt cxt, BaseCollection items) { Cxt = cxt; DataTable = items.DataTable; }
public BaseItems(string sql) { DataTable = BaseCollection.ExecuteSql(sql); }
public static Team GetTeamById(Cxt cxt, int teamID) { return(new Team(cxt, BaseCollection.SelectItem(InfiChess.Team, teamID))); }
public static TournamentPrize GetTournamentPrizeID(Cxt cxt, int TournamentPrizeID) { return(new TournamentPrize(cxt, BaseCollection.SelectItem(InfiChess.TournamentPrize, TournamentPrizeID))); }