Beispiel #1
0
        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);
        }
Beispiel #2
0
 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;
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
 internal void AddMarker(MarkerModel model)
 {
     AddMarker(model, 1);
 }
Beispiel #5
0
 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));
 }
Beispiel #6
0
 public Marker(Card card, MarkerModel model, ushort count)
     : this(card, model)
 {
     _count = count;
 }
Beispiel #7
0
 public Marker(Card card, MarkerModel model)
 {
     _card = card;
     _model = model;
 }