public static List <UlovStavka> DohvatiSveUlovStavkeIRibeUkupno() { List <UlovStavka> listaStavki = new List <UlovStavka>(); SQLiteCommand c = Bazapodataka.con.CreateCommand(); c.CommandText = @"SELECT UlovStavka.id_riba, Riba.naziv, SUM(UlovStavka.kolicina) as kolicina FROM UlovStavka LEFT JOIN Riba ON UlovStavka.id_riba = Riba.id GROUP BY UlovStavka.id_riba"; SQLiteDataReader reader = c.ExecuteReader(); while (reader.Read()) { Riba r = new Riba(); UlovStavka k = new UlovStavka(); r.id = (long)reader["id_riba"]; r.Naziv = (string)reader["naziv"]; k.Kolicina = Convert.ToDouble(reader["kolicina"]); k.Riba = r; listaStavki.Add(k); } reader.Dispose(); c.Dispose(); return(listaStavki); }
public static List <UlovStavka> DohvatiOdDoSveUlovStave(DateTime pocetakdatum, DateTime krajdatum) { List <UlovStavka> listaStavki = new List <UlovStavka>(); SQLiteCommand c = Bazapodataka.con.CreateCommand(); c.CommandText = String.Format(@"SELECT UlovStavka.id_riba, Riba.naziv, SUM(UlovStavka.kolicina) as kolicina, Ulov.id_kapetan FROM UlovStavka LEFT JOIN Riba ON UlovStavka.id_riba = Riba.id LEFT JOIN Ulov ON UlovStavka.id_ulov = Ulov.id WHERE Ulov.datum BETWEEN '{0}' and '{1}' GROUP BY UlovStavka.id_riba", pocetakdatum.ToFileTime(), krajdatum.ToFileTime()); SQLiteDataReader reader = c.ExecuteReader(); while (reader.Read()) { Riba r = new Riba(); UlovStavka k = new UlovStavka(); r.id = (long)reader["id_riba"]; r.Naziv = (string)reader["naziv"]; k.Kolicina = Convert.ToDouble(reader["kolicina"]); k.Riba = r; listaStavki.Add(k); } reader.Dispose(); c.Dispose(); return(listaStavki); }
public static void DodajStavku(UlovStavka a, long b) { SQLiteCommand c = Bazapodataka.con.CreateCommand(); string kolicina = a.Kolicina.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); c.CommandText = String.Format(@"INSERT INTO UlovStavka (kolicina, id_riba, id_ulov) VALUES ({0}, {1}, {2})", kolicina, a.Riba.Id_ribe, b); c.ExecuteNonQuery(); c.Dispose(); }
public static List <UlovStavka> DohvatiSveUlovStavke() { List <UlovStavka> listaStavki = new List <UlovStavka>(); SQLiteCommand c = Bazapodataka.con.CreateCommand(); c.CommandText = "SELECT id_ulov FROM UlovStavka"; SQLiteDataReader reader = c.ExecuteReader(); while (reader.Read()) { UlovStavka k = new UlovStavka(); k.Id_ulova = (long)reader["id_ulov"]; listaStavki.Add(k); } reader.Dispose(); c.Dispose(); return(listaStavki); }
public void DodajStavku(UlovStavka stavka) { UlovList.Add(stavka); }
public StavkaPresenter(UlovStavka stavka) { this.model = stavka; }