Exemple #1
0
        // TODO4: Uradi i ekipni plasman.

        private void loadCommonData(KonacanPlasman kp, SqlCeDataReader rdr)
        {
            kp.TakmicenjeId            = (int)rdr["takmicenje_id"];
            kp.RezultatskoTakmicenjeId = (int)rdr["rez_takmicenje_id"];
            kp.NazivTakmicenja         = (string)rdr["naziv_tak"];
            kp.MestoTakmicenja         = (string)rdr["mesto"];
            kp.DatumTakmicenja         = (DateTime)rdr["datum"];
            kp.NazivKategorije         = (string)rdr["naziv_kat"];

            kp.Ime        = (string)rdr["ime"];
            kp.Prezime    = (string)rdr["prezime"];
            kp.SrednjeIme = Convert.IsDBNull(rdr["srednje_ime"]) ? null : (string)rdr["srednje_ime"];
            kp.DanRodj    = Convert.IsDBNull(rdr["dan_rodj"]) ? null : (Nullable <byte>)rdr["dan_rodj"];
            kp.MesecRodj  = Convert.IsDBNull(rdr["mesec_rodj"]) ? null : (Nullable <byte>)rdr["mesec_rodj"];
            kp.GodRodj    = Convert.IsDBNull(rdr["god_rodj"]) ? null : (Nullable <short>)rdr["god_rodj"];
        }
Exemple #2
0
        private void loadSprava(KonacanPlasman kp, SqlCeDataReader rdr)
        {
            Sprava           sprava = (Sprava)(byte)rdr["sprava"];
            Nullable <short> rank   = Convert.IsDBNull(rdr["rank"]) ? null : (Nullable <short>)rdr["rank"];

            switch (sprava)
            {
            case Sprava.Parter:
                kp.Parter = rank;
                break;

            case Sprava.Konj:
                kp.Konj = rank;
                break;

            case Sprava.Karike:
                kp.Karike = rank;
                break;

            case Sprava.Preskok:
                kp.Preskok = rank;
                break;

            case Sprava.Razboj:
                kp.Razboj = rank;
                break;

            case Sprava.Vratilo:
                kp.Vratilo = rank;
                break;

            case Sprava.DvovisinskiRazboj:
                kp.DvovisinskiRazboj = rank;
                break;

            case Sprava.Greda:
                kp.Greda = rank;
                break;
            }
        }
Exemple #3
0
        public List <KonacanPlasman> findSpraveFinaleKupa(string ime, string prezime)
        {
            SqlCeCommand cmd = new SqlCeCommand(findSpraveFinaleKupaSQL);

            cmd.Parameters.Add("@ime", SqlDbType.NVarChar).Value     = ime;
            cmd.Parameters.Add("@prezime", SqlDbType.NVarChar).Value = prezime;
            SqlCeDataReader rdr = SqlCeUtilities.executeReader(cmd, Strings.DATABASE_ACCESS_ERROR_MSG, ConnectionString);

            List <KonacanPlasman> result = new List <KonacanPlasman>();

            while (rdr.Read())
            {
                KonacanPlasman kp = new KonacanPlasman();
                loadCommonData(kp, rdr);
                loadSprava(kp, rdr);
                kp.TipTakmicenja = TipTakmicenja.FinaleKupa;
                result.Add(kp);
            }

            rdr.Close();
            return(result);
        }
Exemple #4
0
        public List <KonacanPlasman> findPreskokTak3(string ime, string prezime)
        {
            SqlCeCommand cmd = new SqlCeCommand(findPreskokTak3SQL);

            cmd.Parameters.Add("@ime", SqlDbType.NVarChar).Value     = ime;
            cmd.Parameters.Add("@prezime", SqlDbType.NVarChar).Value = prezime;
            SqlCeDataReader rdr = SqlCeUtilities.executeReader(cmd, Strings.DATABASE_ACCESS_ERROR_MSG, ConnectionString);

            List <KonacanPlasman> result = new List <KonacanPlasman>();

            while (rdr.Read())
            {
                KonacanPlasman kp = new KonacanPlasman();
                loadCommonData(kp, rdr);
                kp.Preskok       = Convert.IsDBNull(rdr["rank"]) ? null : (Nullable <short>)rdr["rank"];
                kp.TipTakmicenja = TipTakmicenja.StandardnoTakmicenje;
                result.Add(kp);
            }

            rdr.Close();
            return(result);
        }
Exemple #5
0
        public List <KonacanPlasman> findVisebojZbirViseKola(string ime, string prezime)
        {
            SqlCeCommand cmd = new SqlCeCommand(findVisebojZbirViseKolaSQL);

            cmd.Parameters.Add("@ime", SqlDbType.NVarChar).Value     = ime;
            cmd.Parameters.Add("@prezime", SqlDbType.NVarChar).Value = prezime;
            SqlCeDataReader rdr = SqlCeUtilities.executeReader(cmd, Strings.DATABASE_ACCESS_ERROR_MSG, ConnectionString);

            List <KonacanPlasman> result = new List <KonacanPlasman>();

            while (rdr.Read())
            {
                KonacanPlasman kp = new KonacanPlasman();
                loadCommonData(kp, rdr);
                kp.Viseboj       = Convert.IsDBNull(rdr["rank"]) ? null : (Nullable <short>)rdr["rank"];
                kp.TipTakmicenja = TipTakmicenja.ZbirViseKola;
                result.Add(kp);
            }

            rdr.Close(); // obavezno, da bi se zatvorila konekcija otvorena u executeReader
            return(result);
        }
Exemple #6
0
        public List <KonacanPlasman> findSpraveTak1(string ime, string prezime)
        {
            SqlCeCommand cmd = new SqlCeCommand(findSpraveTak1SQL);

            cmd.Parameters.Add("@ime", SqlDbType.NVarChar).Value     = ime;
            cmd.Parameters.Add("@prezime", SqlDbType.NVarChar).Value = prezime;
            SqlCeDataReader rdr = SqlCeUtilities.executeReader(cmd, Strings.DATABASE_ACCESS_ERROR_MSG, ConnectionString);

            List <KonacanPlasman> result = new List <KonacanPlasman>();

            while (rdr.Read())
            {
                // NOTE: Vracam sve rezultate koji postoje (ne proveravam postojiTak3 i odvojenoTak3).
                KonacanPlasman kp = new KonacanPlasman();
                loadCommonData(kp, rdr);
                loadSprava(kp, rdr);
                kp.TipTakmicenja = (TipTakmicenja)rdr["tip_takmicenja"];
                result.Add(kp);
            }

            rdr.Close();
            return(result);
        }