Example #1
0
 public static void ElaboraAereiDaTraino(dbInteraction DBI, JSONObject coop)
 {
     bool[] sessione = new bool[coop.sessioni.Count];
     foreach (ModelloAereo ma in coop.aereiTrainanti)
     {
         int idAereo = DBI.AddModTrainatore(ma);
         if (idAereo == -1)
         {
             for (int i = 0; i < coop.sessioni.Count; i++)
             {
                 if (!sessione[i] && ma.id == coop.sessioni[i].IDModTrainatore)
                 {
                     SessioneGiorno sg = coop.sessioni[i];
                     sg.IDModTrainatore = idAereo;
                     coop.sessioni[i]   = sg;
                     sessione[i]        = true;
                 }
             }
         }
     }
 }
Example #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        dbInteraction DBI = new dbInteraction();

        if (txtPara1.Text != "" && txtpara2.Text != "")
        {
            switch (c)
            {
            case 0: Session["result"] = DBI.AddPilot(new Pilota(txtPara1.Text, txtpara2.Text)); break;

            case 1: Session["result"] = DBI.AddPilotAliante(new Pilota(txtPara1.Text, txtpara2.Text)); break;

            case 2: Session["result"] = DBI.AddInstructor(new Pilota(txtPara1.Text, txtpara2.Text)); break;

            case 3: Session["result"] = DBI.AddModTrainatore(new ModelloAereo(txtPara1.Text, txtpara2.Text)); break;

            case 4: Session["result"] = DBI.AddModAliante(new ModelloAereo(txtPara1.Text, txtpara2.Text)); break;

            default: break;
            }
        }
        Response.Redirect("~/aggiungiElemento.aspx");
    }