Beispiel #1
0
        /// <summary>
        /// Calculate deposit monthly interest
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public double[] DepositInfo(int clientId, string depType, int depRate)
        {
            double[] months = new double[12];

            double deposit = SqlQueries.GetDepositAmount(clientId);

            // simple interest
            if (depType == "Simple")
            {
                for (int i = 0; i < months.Length; i++)
                {
                    if (i == 0)
                    {
                        months[i] = (((double)deposit / 100 * depRate) / 12) + deposit;
                        Math.Round(months[i], 2);
                        months[i] = Math.Round(months[i], 2);
                        continue;
                    }

                    months[i] = (((double)deposit / 100 * depRate) / 12) + months[i - 1];
                    Math.Round(months[i], 2);
                    months[i] = Math.Round(months[i], 2);
                }
            }

            // capitalized interest
            else
            {
                for (int i = 0; i < months.Length; i++)
                {
                    if (i == 0)
                    {
                        months[i] = (((double)deposit / 100 * depRate) / 12) + deposit;
                        Math.Round(months[i], 2);
                        months[i] = Math.Round(months[i], 2);
                        continue;
                    }

                    months[i] = ((months[i - 1] / 100 * depRate) / 12) + months[i - 1];
                    months[i] = Math.Round(months[i], 2);
                }
            }

            return(months);
        }
Beispiel #2
0
        public bool HasDeposit(int clientId)
        {
            double result = SqlQueries.GetDepositAmount(clientId);

            return(result != 0);
        }