Exemplo n.º 1
0
        public void EmptyCurrentAccount(int client_id, int destinaryAccount)
        {
            string          queryString = $"SELECT amount FROM CurrentAccounts WHERE client_id = {client_id};";
            double          amount      = (double)ConnectionDB.ReturnDecimal(queryString);
            string          queryStringGetCurrentAccountId = $"SELECT id FROM CurrentAccounts WHERE client_id = {client_id};";
            int             currentAccountId = ConnectionDB.ReturnID(queryStringGetCurrentAccountId);
            InstantTransfer instant          = new InstantTransfer();

            instant.RecordTransferFromCurrentToCurrent(currentAccountId, destinaryAccount, amount);
        }
Exemplo n.º 2
0
        public void EmptySavingAccount(int client_id)
        {
            List <int> idSavingAccount = ConnectionDB.GetSavingAccountIds(client_id);
            string     queryStringGetCurrentAccountId = $"SELECT id FROM CurrentAccounts WHERE client_id = {client_id}";
            int        currentAccountId = ConnectionDB.ReturnID(queryStringGetCurrentAccountId);

            foreach (int id in idSavingAccount)
            {
                string          queryString = $"SELECT amount FROM SavingAccounts WHERE id = {id};";
                double          amount      = (double)ConnectionDB.ReturnDecimal(queryString);
                InstantTransfer instant     = new InstantTransfer();
                instant.RecordTransferFromSavingToCurrent(id, currentAccountId, amount);
            }
        }
Exemplo n.º 3
0
        static void RunInstantTransferOptions(InstantTransferOptions options)
        {
            InstantTransfer instantTransfer = new InstantTransfer();

            if (Person.ID == options.IdClient)
            {
                if (options.CurrentToCurrent)
                {
                    instantTransfer.RecordTransferFromCurrentToCurrent(options.EmitterId, options.BeneficiaryId, options.Amount);
                }
                if (options.CurrentToSaving)
                {
                    instantTransfer.RecordTransferFromCurrentToSaving(options.EmitterId, options.BeneficiaryId, options.Amount);
                }
                if (options.SavingToCurrent)
                {
                    instantTransfer.RecordTransferFromSavingToCurrent(options.EmitterId, options.BeneficiaryId, options.Amount);
                }
            }
            else
            {
                Console.WriteLine("Wrong id");
            }
        }