public Plivac(Stil disciplina, int brzina, int traka, Color bojaTima) { this.Disciplina = disciplina; this.Brzina = brzina; this.Traka = traka; this.PozicijaX = 5; this.Velicina = 10; this.BojaTima = bojaTima; this.Zavrsio = false; switch (this.Disciplina) { case Stil.LEDJNO: slovo = "L"; break; case Stil.PRSNO: slovo = "P"; break; case Stil.DELFIN: slovo = "D"; break; case Stil.SLOBODNO: slovo = "S"; break; } }
public Proba FindOne(int id) { IDbConnection connection = DBUtils.getConnection(props); using (var command = connection.CreateCommand()) { command.CommandText = "select * from Probe where id=@id"; IDbDataParameter paramId = command.CreateParameter(); paramId.ParameterName = "@id"; paramId.Value = id; command.Parameters.Add(paramId); using (var dataReader = command.ExecuteReader()) { if (dataReader.Read()) { int idProba = dataReader.GetInt32(0); string distantaStr = dataReader.GetString(1); string stilStr = dataReader.GetString(2); Distanta distanta = (Distanta)Enum.Parse(typeof(Distanta), distantaStr); Stil stil = (Stil)Enum.Parse(typeof(Stil), stilStr); Proba proba = new Proba(idProba, distanta, stil); return(proba); } } } return(null); }
public IEnumerable <Proba> FindAll() { IDbConnection connection = DBUtils.getConnection(props); IList <Proba> list = new List <Proba>(); using (var command = connection.CreateCommand()) { command.CommandText = "select * from Probe"; using (var dataReader = command.ExecuteReader()) { while (dataReader.Read()) { int idProba = dataReader.GetInt32(0); string distantaStr = dataReader.GetString(1); string stilStr = dataReader.GetString(2); Distanta distanta = (Distanta)Enum.Parse(typeof(Distanta), distantaStr); Stil stil = (Stil)Enum.Parse(typeof(Stil), stilStr); Proba proba = new Proba(idProba, distanta, stil); list.Add(proba); } } } return(list); }
public Proba(int iD, Distanta distanta, Stil stil) { ID = iD; Distanta = distanta; Stil = stil; }