public Answer(Question question, Game game, string value) : this() { this.Question = question; this.Game = game; this.Value = value; }
public void Delete(Question question) { try { StatementValue where = new StatementValue (); where.Item1 = "id = @StatementValue0"; where.Item2 = new List<string> (); where.Item2.Add (question.Id.ToString ()); this.Delete (where); } catch (MySqlException ex) { switch (ex.Number) { case 0: throw new DatabaseException ("Cannot connect to server. Contact administrator", ex); case 1045: throw new DatabaseException ("Invalid username/password, please try again", ex); default: throw new DatabaseException (ex.Message, ex); } } }
public void Add(Question question) { try { int tid = entity.BeginTransaction (); List<ColumnValue> columns = new List<ColumnValue> (); columns.Add (new ColumnValue () { Item1 = "id", Item2 = question.Id.ToString() }); columns.Add (new ColumnValue () { Item1 = "question", Item2 = question.Value }); question.Id = (int)this.Insert (columns).LastInsertedId; entity.Commit (tid); } catch (MySqlException ex) { switch (ex.Number) { case 0: throw new DatabaseException ("Cannot connect to server. Contact administrator", ex); case 1045: throw new DatabaseException ("Invalid username/password, please try again", ex); default: throw new DatabaseException (ex.Message, ex); } } }
public void Save(Question question) { if (question.Id < 0) { this.Add (question); return; } try { int tid = entity.BeginTransaction (); List<ColumnValue> columns = new List<ColumnValue> (); columns.Add (new ColumnValue () { Item1 = "question", Item2 = question.Value }); StatementValue where = new StatementValue (); where.Item1 = "id = @StatementValue0"; where.Item2 = new List<string> (); where.Item2.Add (question.Id.ToString ()); this.Update (columns, where); entity.Commit (tid); } catch (MySqlException ex) { switch (ex.Number) { case 0: throw new DatabaseException ("Cannot connect to server. Contact administrator", ex); case 1045: throw new DatabaseException ("Invalid username/password, please try again", ex); default: throw new DatabaseException (ex.Message, ex); } } }
public Answer(int id, Question question, Game game, Player player, string value) : this(question, game, player, value) { this.Id = id; }
public Answer(Question question, Game game, Player player, string value) : this(question, game, value) { this.Player = player; }