public Posten(object nr, object str, object amount, Produktgruppe pr) { _id = Convert.ToInt32(nr); _bezeichnung = str.ToString(); _betrag = Convert.ToDouble(amount); _kategorie = pr; }
public List <Produktgruppe> GetKategorien() { List <Produktgruppe> temp = new List <Produktgruppe>(); command.CommandText = "SELECT * FROM produktgruppe"; Reader = command.ExecuteReader(); while (Reader.Read()) { Produktgruppe p = new Produktgruppe(Reader[0], Reader[1], Reader[2]); temp.Add(p); } Reader.Close(); return(temp); }
public Hauptbuch() { try { connection = new MySqlConnection(dbconnectstring); command = connection.CreateCommand(); connection.Open(); command.CommandText = "SELECT * FROM familienmitglied"; Reader = command.ExecuteReader(); while (Reader.Read()) { Person p = new Person(Reader["ID"], Reader["vorname"], Reader["nachname"]); _familienmitglied.Add(p); } Reader.Close(); command.CommandText = "SELECT * FROM laden"; //connection.Open(); Reader = command.ExecuteReader(); while (Reader.Read()) { Shop l = new Shop(Reader[0], Reader[1], Reader[2]); alleLaeden.Add(l); } Reader.Close(); command.CommandText = "SELECT * FROM produktgruppe"; // connection.Open(); Reader = command.ExecuteReader(); while (Reader.Read()) { Produktgruppe p = new Produktgruppe(Reader[0], Reader[1], Reader[2]); kategorien.Add(p); } Reader.Close(); //_ausgaben = listeBauen("SELECT * FROM rechnung"); //_dieseWoche = listeBauen("SELECT * FROM rechnung WHERE WEEK(rechnung.datum,1)=WEEK(CURRENT_DATE(),1)"); //_letzteWoche = listeBauen("SELECT * FROM rechnung WHERE WEEK(rechnung.datum,1)=WEEK(CURRENT_DATE(),1)-1"); command.CommandText = "SELECT * FROM einkommen"; // connection.Open(); Reader = command.ExecuteReader(); while (Reader.Read()) { Einkommen e = new Einkommen(Reader[0], Reader[1], Reader[2], _familienmitglied[Convert.ToInt32(Reader[3]) - 1], Reader[4]); _einnahmen.Add(e); } Reader.Close(); // connection.Close(); } catch (MySqlException e) { string str = e.Message; } IstVerbunden = connection.State == System.Data.ConnectionState.Open; }