Beispiel #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");
            }
        }
Beispiel #2
0
        public Client General_Consulta_Cliente(string cedula)
        {
            //CREAR OBJETO VACIO
            Client         objClient    = new Client();
            List <Account> listAccounts = new List <Account>();

            //GET DATOS_EN_clientTable
            clientTableTableAdapter adapterClient   = new clientTableTableAdapter();
            clientTableDataTable    clientDataTable = new clientTableDataTable();

            adapterClient.FillByCedula_Cliente(clientDataTable, cedula);

            //GET DATOS_EN_accountTable
            accountTableTableAdapter adapterAccount   = new accountTableTableAdapter();
            accountTableDataTable    accountDataTable = new accountTableDataTable();

            adapterAccount.FillByCedula_Account(accountDataTable, cedula);

            //Transferir datos de clientTable a ObjClient
            foreach (clientTableRow row in clientDataTable.Rows)
            {
                Client tempClient = new Client();
                objClient.Name               = row.NAME;
                objClient.Last_Name          = row.LAST;
                objClient.ID_Number          = row.IDENTIFIER;
                objClient.Email              = row.EMAIL;
                objClient.Client_State       = row.STATE;
                objClient.Direction          = row.DIRECTION;
                objClient.Pin                = row.PIN;
                objClient.Password           = row.PASSWORD;
                objClient.Number_Of_Accounts = row.ACCOUNTS;
            }
            //Transferir datos de clientTable a ObjClient
            foreach (accountTableRow row in accountDataTable.Rows)
            {
                Account tempAccount = new Account();
                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;
            }
            objClient.Accounts = listAccounts;
            return(objClient);
        }
Beispiel #3
0
        public List <Account> General_Devolver_ListCuenta(string Cedula)
        {
            List <Account>           listAccount      = new List <Account>();
            accountTableTableAdapter adapterAccount   = new accountTableTableAdapter();
            accountTableDataTable    accountDataTable = new accountTableDataTable();

            adapterAccount.FillByCedula_Account(accountDataTable, Cedula);
            //Transferir datos de clientTable a ObjClient
            foreach (accountTableRow row in accountDataTable.Rows)
            {
                Account tempAccount = new Account();
                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;
                listAccount.Add(tempAccount);
            }

            return(listAccount);
        }
Beispiel #4
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");
            }
        }