public List <IOpstiDomenskiObjekat> Select(IOpstiDomenskiObjekat objekat) { try { connection.Open(); SqlCommand command = new SqlCommand(); command.Transaction = transaction; command.Connection = connection; if (objekat is Profaktura) { command.CommandText = $"select *, procenti.Depozit as depozit, procenti.BrojTelefona as stopa from Profaktura2 p join Trebovanje t on (t.trebovanjeId = p.trebovanjeId) join Komitent2 ko on (ko.komitentId = p.komitentId)"; } else { command.CommandText = $"select * from {objekat.Table2()} {objekat.Join()}"; } SqlDataReader reader = command.ExecuteReader(); return(objekat.GetReaderResult(reader)); } catch (Exception e) { Console.WriteLine(e.Message); return(null); } finally { connection.Close(); } }