private int SalvaMovimento()
        {
            var soldi = GB.HTMLDoubleToDouble(idSoldi.Value);
            var data  = GB.StringHTMLToDateTime(idData.Value);

            using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB))
            {
                var tran = db.BeginTransaction();

                var param1 = new System.Data.Common.DbParameter[] {
                    cDB.NewPar("nome", idNome.Value, System.Data.DbType.String),
                    cDB.NewPar("tipo", idCassa.SelectedValue, System.Data.DbType.String),
                    cDB.NewPar("descrizione", idDescrizione.Value, System.Data.DbType.String),
                    cDB.NewPar("soldi", soldi, System.Data.DbType.Double),
                    cDB.NewPar("data", data, System.Data.DbType.DateTime),
                    cDB.NewPar("MacroArea", idMacroarea.Value, System.Data.DbType.String)
                };

                var m1 = db.EseguiSQLNoQuery(ref tran, IDMovimento > -1 ? cDB.Queries.Movimenti_Aggiorna : cDB.Queries.Movimenti_Inserisci, param1);

                // con giroconto
                if (IDMovimento == -1 && idGiroconto.SelectedIndex > 0)
                {
                    var param2 = new System.Data.Common.DbParameter[] {
                        cDB.NewPar("nome", idNome.Value, System.Data.DbType.String),
                        cDB.NewPar("tipo", idGiroconto.SelectedValue, System.Data.DbType.String),
                        cDB.NewPar("descrizione", idDescrizione.Value, System.Data.DbType.String),
                        cDB.NewPar("soldi", -soldi, System.Data.DbType.Double),
                        cDB.NewPar("data", data, System.Data.DbType.DateTime),
                        cDB.NewPar("MacroArea", idMacroarea.Value, System.Data.DbType.String)
                    };

                    var m2 = db.EseguiSQLNoQuery(ref tran, cDB.Queries.Movimenti_Inserisci, param2);

                    if (m1 + m2 == 2)
                    {
                        tran.Commit();
                        return(2);
                    }
                    else
                    {
                        tran.Rollback();
                        return(0);
                    }
                }
                else
                {
                    tran.Commit();
                    return(m1);
                }
            }
        }
        protected void bElimina_Click(object sender, EventArgs e)
        {
            using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB))
            {
                var param = new System.Data.Common.DbParameter[] {
                    cDB.NewPar("ID", IDMovimento, System.Data.DbType.Int32)
                };

                var r = db.EseguiSQLNoQuery(cDB.Queries.Movimenti_Elimina, param);
                lErrore.Text = $"{r} elementi eliminati!";

                DisableUI();
            }
        }
        protected void bSalva_Click(object sender, EventArgs e)
        {
            try
            {
                using (var db = new cDB(GB.Instance.getCurrentSession(Session).PathDB))
                {
                    var param = new System.Data.Common.DbParameter[] {
                        cDB.NewPar("nome", idNome.Value, System.Data.DbType.String),
                        cDB.NewPar("Nascondi", "1".Equals(idNascondi.Value), System.Data.DbType.Boolean),
                    };

                    var r = db.EseguiSQLNoQuery("".Equals(IDCassa) ? cDB.Queries.Casse_Inserisci : cDB.Queries.Casse_Aggiorna, param);

                    lErrore.Text    = $"{r} elementi salvati!";
                    idNome.Disabled = true;
                }
            }
            catch (Exception ex)
            {
                lErrore.Text = $"Errore: {ex.Message}";
            }
        }