protected void PopolaCampiSpesa(int idSpesa, bool isControlEnabled)
        {
            EnableDisableFields(pnlInsSpese, isControlEnabled);

            //Popolo i textbox
            Spese sp = SpeseDAO.GetDettagliSpesa(idSpesa.ToString());

            txtSpeseDescr.Text  = sp.Descrizione;
            txtSpesePrezzo.Text = sp.Prezzo.ToString("N2");
        }
Ejemplo n.º 2
0
 private void button7_Click(object sender, EventArgs e)  //aggiornamento carte
 {
     Spese.BringToFront();
     //aggiorna le carte
     comboBox1.Items.Clear();
     for (int i = 0; i < astolfo.Carte.Count; i++)
     {
         comboBox1.Items.Add(astolfo.Carte[i].Numero);
     }
     label35.Text = "Restituiti: " + astolfo.Schei;
 }
Ejemplo n.º 3
0
        //UPDATE
        public static bool UpdateSpesa(Spese s)
        {
            bool          ret = false;
            StringBuilder sql = new StringBuilder("UPDATE TblSpese SET Descrizione = @Descrizione, Prezzo = @Prezzo WHERE idSpesa = @idSpesa");

            try
            {
                using (SqlConnection cn = GetConnection())
                {
                    ret = cn.Execute(sql.ToString(), s) > 0;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Errore durante l'aggiornamento di una spesa", ex);
            }
            return(ret);
        }
Ejemplo n.º 4
0
        //INSERT
        public static bool InsertSpesa(Spese s)
        {
            bool          ret = false;
            StringBuilder sql = new StringBuilder("INSERT INTO TblSpese (Descrizione, Prezzo) VALUES (@Descrizione, @Prezzo)");

            try
            {
                using (SqlConnection cn = GetConnection())
                {
                    ret = cn.Execute(sql.ToString(), s) > 0;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Errore durante l'inserimento di una spesa", ex);
            }
            return(ret);
        }
Ejemplo n.º 5
0
        public static Spese GetDettagliSpesa(string idSpesa)
        {
            Spese         ret = new Spese();
            StringBuilder sql = new StringBuilder("SELECT * FROM TblSpese where IdSpesa = @idSpesa");

            try
            {
                using (SqlConnection cn = GetConnection())
                {
                    ret = cn.Query <Spese>(sql.ToString(), new { idSpesa }).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Errore durante la GetSingle in SpeseDAO", ex);
            }
            return(ret);
        }
Ejemplo n.º 6
0
 public double ImpieghiAtDate(DateTime date)
 {
     return(Spese.GetTotalAtDate(date) + Attivita.GetTotalAtDate(date));
 }
Ejemplo n.º 7
0
 public double AvanzoAtDate(DateTime date)
 {
     return(Entrate.GetTotalAtDate(date) - Spese.GetTotalAtDate(date));
 }