Ejemplo n.º 1
0
 public ProbaDTO(int id, float distanta, Stiluri stil, int nrParticipanti)
 {
     Id             = id;
     Distanta       = distanta;
     Stil           = stil;
     NrParticipanti = nrParticipanti;
 }
Ejemplo n.º 2
0
        public Proba Get(int id)
        {
            log.InfoFormat("Se cauta proba cu id-ul {0}", id);
            var con = DBUtils.getConnection();

            using (var comm = con.CreateCommand())
            {
                comm.CommandText = "select * from Probe where id=@id";
                var paramId = comm.CreateParameter();
                paramId.ParameterName = "@id";
                paramId.Value         = id;
                comm.Parameters.Add(paramId);

                using (var dataR = comm.ExecuteReader())
                {
                    if (dataR.Read())
                    {
                        float   distanta = dataR.GetFloat(1);
                        Stiluri stil     = (Stiluri)Enum.Parse(typeof(Stiluri), dataR.GetString(2));
                        Proba   p        = new Proba(id, distanta, stil);
                        log.InfoFormat("S-a gasit {0}", p);
                        return(p);
                    }
                }
            }
            log.InfoFormat("Nu s-a gasit nicio proba cu id-ul {0}", id);
            return(null);
        }
Ejemplo n.º 3
0
        public IEnumerable <Proba> FindAll()
        {
            log.Info("Se incepe conectarea la bd si selectarea tuturor probelor");
            var           con   = DBUtils.getConnection();
            IList <Proba> probe = new List <Proba>();

            using (var comm = con.CreateCommand())
            {
                comm.CommandText = "select * from Probe";
                using (var dataR = comm.ExecuteReader())
                {
                    while (dataR.Read())
                    {
                        int id = dataR.GetInt32(0);
                        Console.WriteLine("proba " + id);
                        float   distanta = dataR.GetFloat(1);
                        Stiluri stil     = (Stiluri)Enum.Parse(typeof(Stiluri), dataR.GetString(2));
                        Proba   p        = new Proba(id, distanta, stil);
                        probe.Add(p);
                    }
                }
            }
            return(probe);
        }
Ejemplo n.º 4
0
 public IEnumerable <Proba> FindProbeDupaStil(Stiluri stil)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 5
0
 public Proba(int id, float distanta, Stiluri stil)
 {
     base.Id  = id;
     Distanta = distanta;
     Stil     = stil;
 }