public IEnumerable <MarkerModel> GetAllMarkers() { var ret = new List <MarkerModel>(); using (SQLiteCommand com = GamesRepository.DatabaseConnection.CreateCommand()) { com.CommandText = "SElECT id, name, icon, (SELECT id FROM sets WHERE real_id=markers.[set_real_id]) as set_id FROM [markers] WHERE [game_id]=@game_id;"; com.Parameters.AddWithValue("@game_id", Id.ToString()); using (SQLiteDataReader dr = com.ExecuteReader()) { while (dr.Read()) { var did = dr["id"] as string; var setID = dr["set_id"] as string; if (setID == null || did == null) { return(ret); } var result = new MarkerModel( Guid.Parse(did), (string)dr["name"], (string)dr["icon"], GetSet(Guid.Parse(setID)) ); ret.Add(result); } } } return(ret); }
internal static MarkerModel FromDataRow(Game game, IVistaDBRow row) { var result = new MarkerModel { id = (Guid)row["id"].Value, name = (string)row["name"].Value, iconUri = (string)row["icon"].Value, set = game.GetSet((Guid)row["setId"].Value) }; return result; }
public IEnumerable<MarkerModel> GetAllMarkers() { var ret = new List<MarkerModel>(); using (SQLiteCommand com = GamesRepository.DatabaseConnection.CreateCommand()) { com.CommandText = "SElECT id, name, icon, (SELECT id FROM sets WHERE real_id=markers.[set_real_id]) as set_id FROM [markers] WHERE [game_id]=@game_id;"; com.Parameters.AddWithValue("@game_id", Id.ToString()); using (SQLiteDataReader dr = com.ExecuteReader()) { while (dr.Read()) { var did = dr["id"] as string; var setID = dr["set_id"] as string; if (setID == null || did == null) return ret; var result = new MarkerModel( Guid.Parse(did), (string) dr["name"], (string) dr["icon"], GetSet(Guid.Parse(setID)) ); ret.Add(result); } } } return ret; }
internal void AddMarker(MarkerModel model) { AddMarker(model, 1); }
internal void AddMarker(MarkerModel model, ushort count) { Marker marker = _markers.FirstOrDefault(m => m.Model.Equals(model)); if (marker != null) marker.SetCount((ushort) (marker.Count + count)); else if (count > 0) _markers.Add(new Marker(this, model, count)); }
public Marker(Card card, MarkerModel model, ushort count) : this(card, model) { _count = count; }
public Marker(Card card, MarkerModel model) { _card = card; _model = model; }