Ejemplo n.º 1
0
            public static decimal getFeeWithdraw(TypeWithdraw type, decimal amountWihtdraw)
            {
                decimal resultFee = 0;

                switch (type)
                {
                case TypeWithdraw.Cash:
                    if (amountWihtdraw <= 1000)
                    {
                        resultFee = ((amountWihtdraw * feeTo1000) / 100) + feeCash;
                    }
                    else
                    {
                        resultFee = ((amountWihtdraw * feeOver1000) / 100) + feeCash;
                    }
                    break;

                case TypeWithdraw.Cheque:
                    if (amountWihtdraw <= 1000)
                    {
                        resultFee = ((amountWihtdraw * feeTo1000) / 100) + feeCheque;
                    }
                    else
                    {
                        resultFee = ((amountWihtdraw * feeOver1000) / 100) + feeCheque;
                    }
                    break;
                }

                return(resultFee);
            }
Ejemplo n.º 2
0
            public static decimal getPriceWithdraw(TypeWithdraw type,
                                                   decimal balance, decimal withdrawAmount)
            {
                decimal resulBalance = 0;

                if (balance < withdrawAmount)
                {
                    throw new Exception("Тhe amount entered for withdrawal is less than the balance !");
                }

                switch (type)
                {
                case TypeWithdraw.Cash:
                    if (withdrawAmount <= 1000)
                    {
                        resulBalance = (balance - withdrawAmount) -
                                       (((withdrawAmount * feeTo1000) / 100) + feeCash);
                        break;
                    }
                    else
                    {
                        resulBalance = (balance - withdrawAmount) -
                                       (((withdrawAmount * feeOver1000) / 100) + feeCash);
                        break;
                    }

                case TypeWithdraw.Cheque:
                    if (withdrawAmount <= 1000)
                    {
                        resulBalance = (balance - withdrawAmount) -
                                       (((withdrawAmount * feeTo1000) / 100) + feeCheque);
                        break;
                    }
                    else
                    {
                        resulBalance = (balance - withdrawAmount) -
                                       (((withdrawAmount * feeOver1000) / 100) + feeCheque);
                        break;
                    }
                }

                return(resulBalance);
            }