コード例 #1
0
        public ActionResult SavingsConfig(SavingsConfig save)
        {
            bool status = false;

            SavingsConfig account = _contextConfig.GetSavingsConfig();

            SavingsConfigurationViewModels viewModel = new SavingsConfigurationViewModels(account)
            {
                ExpenseAccount = _contextGlAccount.GetExpenseAccount()
            };

            var interest    = Request.Form["Interest"];
            var balance     = Request.Form["Balance"];
            var expenseAcct = Request.Form["Expense"];
            var payableAcct = Request.Form["Payable"];

            save.CreditInterestRate         = Math.Round(Convert.ToDecimal(Request.Form["Interest"], CultureInfo.InvariantCulture), 4);
            save.MinBalance                 = Math.Round(Convert.ToDecimal(Request.Form["Balance"], CultureInfo.InvariantCulture), 4);
            save.GlAccountId                = Convert.ToInt32(Request.Form["Expense"]);
            save.SavingsInterestPayableGlId = Convert.ToInt32(Request.Form["Payable"]);
            save.Id = Convert.ToInt32(Request.Form["Id"]);


            if (save.Id == 0)
            {
                save.status = true;

                _contextConfig.Add(save);

                _contextConfig.Save(save);

                TempData["Message"] = "Configurations Added";
                status = true;
            }
            else
            {
                var configInDb = _contextConfig.Get(save.Id);

                configInDb.CreditInterestRate         = Math.Round(Convert.ToDecimal(interest, CultureInfo.InvariantCulture), 4);
                configInDb.MinBalance                 = Math.Round(Convert.ToDecimal(balance, CultureInfo.InvariantCulture), 4);
                configInDb.GlAccountId                = Convert.ToInt32(expenseAcct);
                configInDb.SavingsInterestPayableGlId = Convert.ToInt32(payableAcct);

                if (interest == null || balance == null || expenseAcct == null)
                {
                    configInDb.status = false;
                }

                configInDb.status = true;

                _contextConfig.Update(save);

                TempData["Message"] = "New Configurations Added";
                status = true;
            }


            ViewBag.Status = status;
            return(RedirectToAction("SavingsConfig"));
        }
コード例 #2
0
        //GET: AccountConfiguration/SavingsConfig
        public ActionResult SavingsConfig()
        {
            SavingsConfig config = _contextConfig.GetSavingsConfig();


            SavingsConfigurationViewModels viewModel = new SavingsConfigurationViewModels(config)
            {
                ExpenseAccount = _contextGlAccount.GetExpenseAccount(),
                PayableAccount = _contextGlAccount.GetPayableAccount()
            };

            return(View(viewModel));
        }
コード例 #3
0
 public SavingsConfigurationViewModels(SavingsConfig config)
 {
     if (config == null)
     {
         Id = 0;
     }
     else
     {
         Id                 = config.Id;
         status             = config.status;
         CreditInterestRate = config.CreditInterestRate;
         //GlAccount = config.GlAccount;
         MinBalance  = config.MinBalance;
         GlAccountId = config.GlAccountId;
         SavingsInterestPayableGlId = config.SavingsInterestPayableGlId;
     }
 }
コード例 #4
0
        public SavingsConfig GetBySavingsConfigBranch(int id)
        {
            SavingsConfig savingsConfig = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(LocalhostAddress);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                // HTTP GET
                HttpResponseMessage response = client.GetAsync("api/Savingsconfig/GetByBranch/?id=" + id).Result;
                if (response.IsSuccessStatusCode)
                {
                    savingsConfig = response.Content.ReadAsAsync <SavingsConfig>().Result;
                    return(savingsConfig);
                }
                else
                {
                    string message = response.ReasonPhrase;
                }
            }
            return(savingsConfig);
        }
コード例 #5
0
 public bool CustomerSavingsAccountBalanceConfirmed(CustomerAccounts customerAccounts, SavingsConfig savingsConfig, string accountType, double amount)
 {
     if (accountType == "Withdrawal" && (customerAccounts.Balance < amount + savingsConfig.minimumBalance))
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }