public void SaveMachineCode(string machineKey, int BlockedBy) { if (String.IsNullOrEmpty(machineKey)) { return; } BaseCollection.ExecuteSql("Insert into BlockedMachines(MachineKey,CreatedBy,DateCreated) Values('" + machineKey + "'," + BlockedBy + ",'" + DateTime.Now.ToString() + "')"); }
public static TC SelectItems2(string tableName, string sql, params object[] vals) { TC items = new TC(); items.DataTable = BaseCollection.ExecuteSql(tableName, sql, vals); items.DataTable.TableName = tableName; return(items); }
public static TC SelectItems(string tableName, string sql) { TC items = new TC(); items.DataTable = BaseCollection.ExecuteSql(sql); items.DataTable.TableName = tableName; return(items); }
public DataTable UpdateFormula() { UserFormula item; try { string selectQuery; DataTable table; selectQuery = "SELECT TOP 1 * FROM UserFormula WHERE UserID = @p1"; table = BaseCollection.ExecuteSql(InfiChess.UserFormula, selectQuery, UserID); if (table != null && table.Rows.Count > 0) { item = new UserFormula(base.Kv.Cxt, table.Rows[0]); } else { item = new UserFormula(); } item.Cxt = base.Kv.Cxt; item.UserID = UserID; item.IsUnrated = IsUnrated; item.IsRated = IsRated; item.IsDucate = IsDucate; item.IsNoComputer = IsNoComputer; item.IsNoCentaur = IsNoCentaur; item.IsFastInternetOnly = IsFastInternetOnly; item.MinElo = MinElo; item.MaxElo = MaxElo; item.MinTime = MinTime; item.MaxTime = MaxTime; item.MinGainPerMove = MinGainPerMove; item.MaxGainPerMove = MaxGainPerMove; item.RankID = RankID; item.DucatesToOverride = DucatesToOverride; item.IsActive = IsActive; item.Cxt.CurrentUserID = base.Kv.Cxt.CurrentUserID; item.Save(); } catch (Exception ex) { throw ex; } return(Challenges.GetChallengesByRoomID(item.Cxt, base.Kv.GetInt32("RoomID"), item.Cxt.CurrentUserID)); }
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 BaseItems(string sql) { DataTable = BaseCollection.ExecuteSql(sql); }