public List <predstava> izpisuserocene(int idu) { List <predstava> predstave = new List <predstava>(); using (NpgsqlConnection con = new NpgsqlConnection(connect)) { con.Open(); NpgsqlCommand com = new NpgsqlCommand("SELECT * FROM izpisocenjenihuporanik(" + idu + ") ", con); NpgsqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { string Ime = reader.GetString(0); string Zvrst = reader.GetString(1); string Lokacija = reader.GetString(2); string Kraj = reader.GetString(3); int ocena = reader.GetInt32(4); predstava nova = new predstava(Ime, Zvrst, Lokacija, Kraj, ocena); predstave.Add(nova); } con.Close(); return(predstave); } }
public List <predstava> iscipredstavo(string neki) { List <predstava> predstave = new List <predstava>(); using (NpgsqlConnection con = new NpgsqlConnection(connect)) { con.Open(); NpgsqlCommand com = new NpgsqlCommand("SELECT * FROM isciPredstavo('" + neki + "') ", con); NpgsqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { int Id = reader.GetInt32(0); string Ime = reader.GetString(1); string Zvrst = reader.GetString(2); string Datum = reader.GetString(3); string Opis = reader.GetString(4); string Lokacija = reader.GetString(5); string Kraj = reader.GetString(6); predstava nova = new predstava(Id, Ime, Zvrst, Datum, Opis, Lokacija, Kraj); predstave.Add(nova); } con.Close(); return(predstave); } }
public List <predstava> filmocena(int id) { List <predstava> ocena1 = new List <predstava>(); using (NpgsqlConnection con = new NpgsqlConnection(connect)) { con.Open(); NpgsqlCommand com = new NpgsqlCommand("SELECT * FROM avgocene(" + id + ") ", con); NpgsqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { double Ocena = reader.GetDouble(0); predstava nova = new predstava(Convert.ToInt32(Ocena)); ocena1.Add(nova); //MessageBox.Show(Ocena.ToString()); } con.Close(); return(ocena1); } }