コード例 #1
0
ファイル: PilotaTest.cs プロジェクト: ccuuqw/IRF_Project
        //true: felvesszük a pilotak listába
        //false: nem vesszük fel a listába
        public void TestValidatePilota(int pontszam, int legjobb, int egyeb, int szerzodes, bool expectedResult)
        {
            var pilota       = new Pilota();
            var actualResult = pilota.ValidatePilota(pontszam, legjobb, egyeb, szerzodes);

            Assert.AreEqual(expectedResult, actualResult);
        }
コード例 #2
0
        static public void Megoldasok()
        {
            FileBeolvas   beolvas = new FileBeolvas("pilotak.csv");
            List <Pilota> lista   = Pilota.PilotaListaLetrehozas(beolvas.Feltolt(';'));

            HarmadikFeladat.Megoldas(lista);
            NegyedikFeladat.Megoldas(lista);
            OtodikFeladat.Megoldas(lista);
            HatodikFeladat.Megoldas(lista);
            HetedikFeladat.Megoldas(lista);

            Console.ReadKey(true);
        }
コード例 #3
0
    private int ChkPilot(Pilota pilo, string tabella)
    {
        SqlCommand    sqlComm = new SqlCommand("Select * from " + tabella + " where nome like '" + pilo.nome + "' and cognome like '" + pilo.cognome + "'", _sqlConn);
        SqlDataReader sqr     = sqlComm.ExecuteReader();

        if (sqr.HasRows)
        {
            sqr.Read();
            int id = (int)sqr[0];
            sqr.Close();
            return(id);
        }
        sqr.Close();
        return(-1);
    }
コード例 #4
0
ファイル: Form1.cs プロジェクト: ccuuqw/IRF_Project
 private void Feltoltes()
 {
     for (int i = 0; i < pilots.Count; i++)
     {
         if ((pilots[i].C18f2 == 0 || pilots[i].C18f2 > 15) &&
             (pilots[i].C19f2 == 0 || pilots[i].C19f2 > 15) &&
             (pilots[i].C20f2 == 0 || pilots[i].C20f2 > 15) &&
             (pilots[i].C18f3 == 0 || pilots[i].C18f3 > 15) &&
             (pilots[i].C19f3 == 0 || pilots[i].C19f3 > 15) &&
             (pilots[i].C20f3 == 0 || pilots[i].C20f3 > 15) &&
             (pilots[i].C18g3 == 0 || pilots[i].C18g3 > 15) &&
             (pilots[i].C18fe == 0 || pilots[i].C18fe > 15) &&
             (pilots[i].C19fe == 0 || pilots[i].C19fe > 15) &&
             (pilots[i].C20fe == 0 || pilots[i].C20fe > 15))
         {
             if (pilots[i].egyéb != 1)
             {
                 continue;
             }
         }
         if (pilots[i].Kor == 0)
         {
             continue;
         }
         Pilota P = new Pilota();
         P.Nev      = pilots[i].Név;
         P.Nem      = (int)pilots[i].Nem;
         P.Kor      = (int)pilots[i].Kor;
         P.Pontszam = (int)(pilots[i].Place1.f2 + pilots[i].Place2.f2 + pilots[i].Place3.f2 +
                            pilots[i].Place4.f3 + pilots[i].Place5.f3 + pilots[i].Place6.f3 +
                            pilots[i].Place7.gp3 + pilots[i].Place8.fe + pilots[i].Place9.fe +
                            pilots[i].Place.fe);
         if (P.Pontszam < 40 && pilots[i].egyéb == 1)
         {
             P.Pontszam = 40;
         }
         P.Szerzodes = (int)pilots[i].szerződés;
         P.Verseny   = (int)pilots[i].verseny;
         P.Teszt     = (int)pilots[i].teszt;
         if (P.Szerzodes == 1)
         {
             continue;
         }
         pilotak.Add(P);
     }
 }
コード例 #5
0
    public int AddInstructor(Pilota pilo)
    {
        Connect();
        int id = ChkPilot(pilo, "Istruttore");

        if (id != -1)
        {
            return(id);
        }
        SqlCommand sqlComm = new SqlCommand("insertIstruttore", _sqlConn);

        sqlComm.CommandType = System.Data.CommandType.StoredProcedure;

        sqlComm.Parameters.Add("nome", pilo.nome);
        sqlComm.Parameters.Add("cognome", pilo.cognome);
        sqlComm.ExecuteNonQuery();
        id = ChkPilot(pilo, "Istruttore");
        Close();
        return(id);
    }