public static List <string> DohvatiDisDatum() { List <Racuni> lista = new List <Racuni>(); List <string> listaDatuma = new List <string>(); string sqlQuery = "SELECT DISTINCT Datum FROM Racuni"; DbDataReader dr = DatabaseConnection.Instance.DohvatiDataReader(sqlQuery); while (dr.Read()) { Racuni racuni = new Racuni(dr, ""); lista.Add(racuni); } dr.Close(); foreach (Racuni row in lista) { string dan = row.datum.Day.ToString(); string mj = row.datum.Month.ToString(); string god = row.datum.Year.ToString(); string cijeliDatum = dan + "." + mj + "." + god; listaDatuma.Add(cijeliDatum); } return(listaDatuma); }
public static List <Racuni> DohvatiSveStavke() { List <Racuni> lista = new List <Racuni>(); string sqlUpit = "SELECT * FROM Stavke_racuna"; DbDataReader dr = DatabaseConnection.Instance.DohvatiDataReader(sqlUpit); while (dr.Read()) { Racuni racuni = new Racuni(dr); lista.Add(racuni); } dr.Close(); return(lista); }