Esempio n. 1
0
        public string General_DepositoCuenta(string cedula, string account_name, decimal balance_to_deposit)
        {
            try
            {
                //Prove Account has Funds
                accountTableTableAdapter adapterAccount   = new accountTableTableAdapter();
                accountTableDataTable    accountDataTable = new accountTableDataTable();
                adapterAccount.FillByCedula_Account(accountDataTable, cedula);
                //Create Account
                Account tempAccount = new Account();
                //Transfer Data to Local Object
                foreach (accountTableRow row in accountDataTable.Rows)
                {
                    tempAccount.Client_ID     = row.IDENTIFIER;
                    tempAccount.Account_Name  = row.ACCOUNT_NAME;
                    tempAccount.Account_State = row.ACCOUNT_STATE;
                    tempAccount.Account_Type  = row.ACCOUNT_TYPE;
                    tempAccount.Balance       = row.BALANCE;
                }
                //Calculo de balances
                decimal balance_actual = 0;
                balance_actual += tempAccount.Balance;
                balance_actual += balance_to_deposit;

                adapterAccount.DepositoCuenta_Normal(balance_actual, cedula, account_name);
                return("El deposito fue exitoso");
            }
            catch
            {
                return("Datos Erroneos");
            }
        }
Esempio n. 2
0
        public string General_RetiroCuenta(string cedula, string account_name, decimal balance_to_withdraw)
        {
            try
            {
                //Prove Account has Funds
                accountTableTableAdapter adapterAccount   = new accountTableTableAdapter();
                accountTableDataTable    accountDataTable = new accountTableDataTable();
                adapterAccount.FillByCedula_Account(accountDataTable, cedula);
                //Create Account
                Account tempAccount = new Account();
                //Transfer Data to Local Object
                foreach (accountTableRow row in accountDataTable.Rows)
                {
                    tempAccount.Client_ID     = row.IDENTIFIER;
                    tempAccount.Account_Name  = row.ACCOUNT_NAME;
                    tempAccount.Account_State = row.ACCOUNT_STATE;
                    tempAccount.Account_Type  = row.ACCOUNT_TYPE;
                    tempAccount.Balance       = row.BALANCE;
                }

                //Calculo de balances
                decimal Balance_Actual = tempAccount.Balance;

                if (Balance_Actual > balance_to_withdraw)
                {
                    decimal balance_despuesDeRetiro = 0;
                    balance_despuesDeRetiro = Balance_Actual - balance_to_withdraw;
                    adapterAccount.DepositoCuenta_Normal(balance_despuesDeRetiro, cedula, account_name);
                    return("Retiro Exitoso!");
                }
                else
                {
                    return("Fondos insuficientes");
                }
            }
            catch
            {
                return("Datos Erroneos");
            }
        }