private void LoadRemainLoanAmount()
        {
            StoreProRepository facade = new StoreProRepository();
            CashRepaymentRepository cashFacade = new CashRepaymentRepository();
            double remainAmount = 0;
            var amt = facade.StoreProcessor().B_Normal_Loan_GetRemainLoanAmount(tbNewNormalLoan.Text).FirstOrDefault();
            remainAmount = amt == null ? 0 : (double)amt;

            if(normalLoanEntryM!=null && !String.IsNullOrEmpty(normalLoanEntryM.CreditAccount)){
                var cashRepay = cashFacade.FindActiveCashRepayment(normalLoanEntryM.CreditAccount).FirstOrDefault();

                if (cashRepay != null && cashRepay.AmountDeposited != null)
                {
                    remainAmount = remainAmount - (cashRepay.AmountDeposited == null ? 0 : (double)cashRepay.AmountDeposited);
                }

            }

            tbOutstandingAmount.Value = remainAmount;
        }
        private void processDebitCashRepayment()
        {
            StoreProRepository facade = new StoreProRepository();
            CashRepaymentRepository cashFacade = new CashRepaymentRepository();
            if (normalLoanEntryM != null && !String.IsNullOrEmpty(normalLoanEntryM.CreditAccount))
            {
                var cashRepay = cashFacade.FindActiveCashRepayment(normalLoanEntryM.CreditAccount).FirstOrDefault();
                if (cashRepay != null && cashRepay.AmountDeposited != null)
                {
                    facade.StoreProcessor().B_Normal_Loan_CashRepayment_Subtract_To_Account(normalLoanEntryM.CreditAccount, cashRepay.AmountDeposited, normalLoanEntryM.Code, this.UserId);

                }
            }
        }
        private bool isCurrentAmountEnoughtForRequestCash()
        {
            StoreProRepository facade = new StoreProRepository();
            CashRepaymentRepository cashFacade = new CashRepaymentRepository();
            decimal AccRemainAmount = 0;

            if (normalLoanEntryM != null && !String.IsNullOrEmpty(normalLoanEntryM.CreditAccount))
            {
                var cashRepay = cashFacade.FindActiveCashRepayment(normalLoanEntryM.CreditAccount).FirstOrDefault();

                AccRemainAmount = (decimal)facade.StoreProcessor().B_Normal_Loan_Account_GetCurrentAmount(normalLoanEntryM.CreditAccount).FirstOrDefault();

                if (cashRepay != null && cashRepay.AmountDeposited != null)
                {
                    if (AccRemainAmount < cashRepay.AmountDeposited)
                    {
                        return false;
                    }
                }
            }
            else
            {
                return false;
            }
            return true;
        }