Esempio n. 1
0
        //metodo para ingresar el deposito, recibe la conexion y un objeto cliente que contiene todos los datos necesarios
        //el metodo retorna un numero
        // 1 = ingresado correctamente
        public static int addDeposit(MySqlConnection Connection, DepositWithoutAccount deposit)
        {
            MySqlCommand command = new MySqlCommand(
                String.Format("INSERT INTO DepositWithoutAccount (Employee_idEmployee, DestinyAccount, Date, Quantity, Name, CancelTransaction) VALUES ({0}, {1}, '{2}', {3}, '{4}', false)", deposit.idEmployee, deposit.destinyAccount, deposit.date, deposit.quantity, deposit.name), Connection);
            int OK = command.ExecuteNonQuery();

            /// if OK = 1 it's ok
            /// if OK = 0 error
            return(OK);
        }
Esempio n. 2
0
        public static IList <DepositWithoutAccount> showCanceled(MySqlConnection Connection)
        {
            List <DepositWithoutAccount> depositList = new List <DepositWithoutAccount>();
            MySqlCommand    command = new MySqlCommand(String.Format("SELECT * FROM DepositWithoutAccount WHERE CancelTransaction = true"), Connection);
            MySqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                DepositWithoutAccount deposit = new DepositWithoutAccount(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetString(3), reader.GetFloat(4), reader.GetString(5), reader.GetBoolean(6));
                depositList.Add(deposit);
            }

            return(depositList);
        }