Exemplo n.º 1
0
    public int AddTraino(Traini tr)
    {
        Connect();

        SqlCommand sqlComm = new SqlCommand("insertTraino", _sqlConn);

        Log("coop");
        sqlComm.CommandType = System.Data.CommandType.StoredProcedure;
        sqlComm.Parameters.Add("idGiorno", tr.IDGiornata);
        sqlComm.Parameters.Add("idIstr", tr.IDIstruttore);
        sqlComm.Parameters.Add("idAlia", tr.IDAliante);
        sqlComm.Parameters.Add("idPilo", tr.IDPilota);
        sqlComm.Parameters.Add("tempo", tr.TempoOrametro);
        sqlComm.ExecuteNonQuery();
        Close();
        return(-1);
    }
Exemplo n.º 2
0
 public static void ElaboraSessioni(dbInteraction DBI, JSONObject coop)
 {
     bool[] trainiEff = new bool[coop.trainiEff.Count];
     foreach (SessioneGiorno sg in coop.sessioni)
     {
         int idSessione = DBI.AddGiornata(sg);
         for (int i = 0; i < coop.trainiEff.Count; i++)
         {
             if (!trainiEff[i])
             {
                 Traini tr = coop.trainiEff[i];
                 tr.IDGiornata     = idSessione;
                 coop.trainiEff[i] = tr;
                 trainiEff[i]      = true;
             }
         }
     }
 }
Exemplo n.º 3
0
 public static void ElaboraPilotiAlianti(dbInteraction DBI, JSONObject coop)
 {
     bool[] trainiEff = new bool[coop.trainiEff.Count];
     foreach (Pilota p in coop.pilsAli)
     {
         int idPilot = DBI.AddPilotAliante(p);
         if (idPilot != -1)
         {
             for (int i = 0; i < coop.trainiEff.Count; i++)
             {
                 if (!trainiEff[i] && p.id == coop.trainiEff[i].IDPilota)
                 {
                     Traini tr = coop.trainiEff[i];
                     tr.IDPilota       = idPilot;
                     coop.trainiEff[i] = tr;
                     trainiEff[i]      = true;
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 public static void ElaboraIstruttori(dbInteraction DBI, JSONObject coop)
 {
     bool[] trainiEff = new bool[coop.trainiEff.Count];
     foreach (Pilota p in coop.instructors)
     {
         int idPilot = DBI.AddInstructor(p);
         if (idPilot != -1)
         {
             for (int i = 0; i < coop.trainiEff.Count; i++)
             {
                 if (!trainiEff[i] && p.id == coop.trainiEff[i].IDIstruttore)
                 {
                     Traini tr = coop.trainiEff[i];
                     tr.IDIstruttore   = idPilot;
                     coop.trainiEff[i] = tr;
                     trainiEff[i]      = true;
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
 public static void ElaboraAlianti(dbInteraction DBI, JSONObject coop)
 {
     bool[] trainiEff = new bool[coop.trainiEff.Count];
     foreach (ModelloAereo ma in coop.alianti)
     {
         int idAliante = DBI.AddModAliante(ma);
         if (idAliante != -1)
         {
             for (int i = 0; i < coop.trainiEff.Count; i++)
             {
                 if (!trainiEff[i] && ma.id == coop.trainiEff[i].IDAliante)
                 {
                     Traini tr = coop.trainiEff[i];
                     tr.IDAliante      = idAliante;
                     coop.trainiEff[i] = tr;
                     trainiEff[i]      = true;
                 }
             }
         }
     }
 }