コード例 #1
0
ファイル: Buch.cs プロジェクト: SebMertz/Buechereiverwaltung
 public Buch(string titel, string autor, IKategorie eingeordneteKategorie, string barcode, string stichwort)
 {
     Titel = titel;
     Autor = autor;
     EingeordneteKategorie = eingeordneteKategorie;
     Barcode = barcode;
     Stichwort = stichwort;
 }
コード例 #2
0
        //Verknüpfung zu Kategorie über Tabelle BücherInKategorie muss noch erfolgen
        public bool BuchAnlegen(string titel, string autor, IKategorie kategorie, string barcode, string stichwort = "")
        {
            IBuch newBuch = _factory.CreateBuch(titel, autor, kategorie, barcode, stichwort);
            BuchInKategorieLegen(newBuch, kategorie);

            string data = titel + ", " + autor + ", " + barcode + ", " + stichwort;

            _dbAnbindung.InsertNewRow(ExistingTables.Bücher, data);

            string[] sqlret = _dbAnbindung.SelectRows(ExistingTables.Bücher);

            int key = -1;
            foreach (string str in sqlret)
            {
                string[] args = str.Split(' ');
                int id = int.Parse(args[0]);
                if (!_bücherei.BücherListe.ContainsKey(id))
                {
                    if (args[1] == titel && args[2] == autor && args[3] == kategorie.Name && args[4] == barcode && args[5] == stichwort)
                    {
                        key = id;
                        break;
                    }
                }
            }

            if (key > 0)
            {
                _bücherei.BücherListe.Add(key, newBuch);
                return true;
            }
            return false;
        }
コード例 #3
0
 public bool BuchInKategorieLegen(IBuch buch, IKategorie kategorie)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
        public bool KategorieLöschen(IKategorie kategorie)
        {
            int id = -1;
            foreach (int key in _bücherei.Kategorien.Keys)
            {
                if (_bücherei.Kategorien[key].Equals(kategorie))
                {
                    id = key;
                    break;
                }
            }

            if (id > 0)
            {
                string data = id.ToString();
                _dbAnbindung.DeleteRow(ExistingTables.Kategorie, data);
                return true;
            }
            return false;
        }
コード例 #5
0
 IBuch IClassFactory.CreateBuch(string titel, string autor, IKategorie kategorie, string barcode, string stichwort)
 {
     return new Buch(titel, autor, kategorie, barcode, stichwort);
 }