Ejemplo n.º 1
0
    public static string Serializzo()
    {
        dbInteraction DBI  = new dbInteraction();
        JSONObject    jObj = new JSONObject();
        DataTable     dt   = DBI.RetrievePiloti("Pilota");

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            jObj.pilsAli.Add(new Pilota(dt.Rows[i][1].ToString(), dt.Rows[i][2].ToString()));
        }
        dt = DBI.RetrievePiloti("Trainatore");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            jObj.pils.Add(new Pilota(dt.Rows[i][1].ToString(), dt.Rows[i][2].ToString()));
        }

        dt = DBI.RetrievePiloti("Istruttore");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            jObj.instructors.Add(new Pilota(dt.Rows[i][1].ToString(), dt.Rows[i][2].ToString()));
        }
        dt = DBI.RetrieveAereo("ModelloAliante");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            jObj.alianti.Add(new ModelloAereo(dt.Rows[i][0].ToString(), dt.Rows[i][1].ToString()));
        }
        dt = DBI.RetrieveAereo("ModelloTrainatore");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            jObj.aereiTrainanti.Add(new ModelloAereo(dt.Rows[i][0].ToString(), dt.Rows[i][1].ToString()));
        }
        return(JsonConvert.SerializeObject(jObj));
    }
Ejemplo n.º 2
0
 public static void ElaboraTraini(dbInteraction DBI, JSONObject coop)
 {
     foreach (Traini tr in coop.trainiEff)
     {
         DBI.AddTraino(tr);
     }
 }
Ejemplo n.º 3
0
    protected void lgnButt_Click(object sender, EventArgs e)
    {
        dbInteraction DBI = new dbInteraction();

        Session["Login"] = DBI.ExecuteLogin(usrName.Text, usrPass.Text);
        Response.Redirect("~/index.aspx");
    }
Ejemplo n.º 4
0
    protected void RetrieveTraini(int idTraino)
    {
        dbInteraction DBI = new dbInteraction();
        DataTable     dt  = DBI.RetrieveTraini(idTraino);

        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DropDownList1.Items.Clear();
         dbInteraction DBI = new dbInteraction();
         DataTable     dt  = DBI.RetrievePiloti("Trainatore");
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             DropDownList1.Items.Add(new ListItem(string.Format("{0} {1}", dt.Rows[i][1], dt.Rows[i][2]), dt.Rows[i][0].ToString()));
         }
     }
 }
Ejemplo n.º 6
0
        public void LoadAppropriatedata()
        {
            DefaultSetting();

            Helper.ClassName    = null;
            dbInteractionObject = new dbInteraction();

            storedclasses = dbInteractionObject.FetchAllStoredClasses();

            if (storedclasses != null)
            {
                classCount = storedclasses.Count;
            }

            //Assembly view disabled for java db. I don't know any other way
            ICollection keysCollection = storedclasses.Keys;

            foreach (string str in keysCollection)
            {
                if (!str.Contains(","))
                {
                    toolStripButtonAssemblyView.Enabled = false;
                    break;
                }
            }

            //Populate the TreeView
            dbtreeviewObject.AddFavouritFolderFromDatabase();
            dbtreeviewObject.AddTreeNode(storedclasses, null);
            SelectFirstClassNode();
            propertiesTab = PropertiesTab.Instance;
            if (classCount == 0)
            {
                propertiesTab.ShowClassProperties   = false;
                toolStripButtonAssemblyView.Enabled = toolStripButtonFlatView.Enabled = false;
            }
            recConnection = dbInteraction.GetCurrentRecentConnection();
            PopulateSearchStrings();

            dbtreeviewObject.Focus();
            dbtreeviewObject.Refresh();
            OMETrace.WriteFunctionEnd();

            instance = this;
        }
Ejemplo n.º 7
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;
             }
         }
     }
 }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["logIn"] == null)
        {
            Label1.Text = "Accesso non consentito!";
            Label2.Text = "Eseguire il login";
        }
        else
        {
            try
            {
                int           scelta = Convert.ToInt32(Request.QueryString["tblInd"]);
                dbInteraction DBI    = new dbInteraction();
                DataTable     dt     = new DataTable();
                switch (scelta)
                {
                case 0: Label1.Text = "Piloti Trainatori"; Label2.Text = "Lista dei pilota trainatori"; Label3.Text = "Aggiungi Trainatore";
                    dt = DBI.RetrievePiloti("Trainatore");; break;

                case 1: Label1.Text = "Piloti Alianti"; Label2.Text = "Lista dei piloti degli alianti"; Label3.Text = "Aggiungi Pilota aliante";
                    dt = DBI.RetrievePiloti("Pilota"); break;

                case 2: Label1.Text = "Istruttori"; Label2.Text = "Lista dei piloti istruttori"; Label3.Text = "Aggiungi Istruttore";
                    dt = DBI.RetrievePiloti("Istruttore"); break;

                case 3: Label1.Text = "Modelli aerei trainanti"; Label2.Text = "Lista dei modelli degli aerei trainanti registrati"; Label3.Text = "Aggiungi Aereo da traino";
                    dt = DBI.RetrieveAereo("ModelloTrainatore"); break;

                case 4: Label1.Text = "Modelli Alianti"; Label2.Text = "Lista dei modelli degli alianti registrati"; Label3.Text = "Aggiungi Aliante";
                    dt = DBI.RetrieveAereo("ModelloAliante"); break;

                default: throw new FormatException(); break;
                }
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            catch (FormatException)
            {
                Label1.Text      = "Scelta errata";
                Label1.ForeColor = Color.Red;
                Label2.Text      = "Si prega di selezionare una voce corretta";
            }
        }
    }
Ejemplo n.º 9
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;
                 }
             }
         }
     }
 }
Ejemplo n.º 10
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;
                 }
             }
         }
     }
 }
Ejemplo n.º 11
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;
                 }
             }
         }
     }
 }
Ejemplo n.º 12
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;
                 }
             }
         }
     }
 }
Ejemplo n.º 13
0
 public static void ElaboraTrainatori(dbInteraction DBI, JSONObject coop)
 {
     bool[] sessioni = new bool[coop.sessioni.Count];
     foreach (Pilota p in coop.pils)
     {
         int idPilot = DBI.AddPilot(p);
         if (idPilot != -1)
         {
             for (int i = 0; i < coop.sessioni.Count; i++)
             {
                 if (!sessioni[i] && coop.sessioni[i].IDTrainatore == p.id)
                 {
                     SessioneGiorno sg = coop.sessioni[i];
                     sg.IDTrainatore  = idPilot;
                     coop.sessioni[i] = sg;
                     sessioni[i]      = true;
                 }
             }
         }
     }
 }
Ejemplo n.º 14
0
    protected void RetrieveSessioni(int idPilota)
    {
        dbInteraction DBI = new dbInteraction();

        DropDownList2.Items.Clear();
        DataTable dt = DBI.RetrieveSessioni(idPilota);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string data = dt.Rows[i][1].ToString().Split(' ')[0];
            DropDownList2.Items.Add(new ListItem(data, dt.Rows[i][0].ToString()));
        }
        if (DropDownList2.Items.Count > 0)
        {
            RetrieveTraini(Convert.ToInt32(DropDownList2.Items[0].Value));
        }
        else
        {
            GridView1.DataSource = null;
            GridView1.DataBind();
        }
    }
Ejemplo n.º 15
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");
    }
Ejemplo n.º 16
0
        public List <ProxyTreeGridRenderer> ExpandTreeGidNode(bool readOnly, object id, bool activate)
        {
            List <TreeGridViewRenderer> list = new dbInteraction().ExpandTreeGidNode(readOnly, id, activate);

            return(ConvertToProxyTreeGridRendererList(list));
        }