Exemple #1
0
        public void LoadOperatii()
        {
            if (_operatii != null)
            {
                _operatii.Clear();
            }
            const string stringSql = "SELECT * FROM Operatii";

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                var command = new SqlCommand(stringSql, connection);

                using (SqlDataReader sqlReader = command.ExecuteReader())
                {
                    while (sqlReader.Read())
                    {
                        int    id   = (int)sqlReader["Id"];
                        string nume = (string)sqlReader["Nume"];
                        if (nume.Contains("Inchidere"))
                        {
                            InchidereCont inchidere = new InchidereCont(id, nume);

                            _operatii.Add(inchidere);
                        }
                        else
                        {
                            ModificaSuma modifica = new ModificaSuma(id, nume);
                            _operatii.Add(modifica);
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void Button2_Click(object sender, EventArgs e)
        {
            string       nume       = "Modificare " + _cont.Id.ToString() + tbNumeOp.Text;
            long         suma       = Convert.ToInt64(tbSuma.Text.ToString());
            ModificaSuma modificare = new ModificaSuma();

            InitOperatie(nume);
            modificare.EfOperatie(nume, _cont, suma);
        }