private void setLoanDetails(loan _loan)
 {
     CustomerLabel.Content = LetterHandller.UppercaseFirst(_loan.customer.FIRST_NAME) + " " + LetterHandller.UppercaseFirst(_loan.customer.LAST_NAME);
     CustomerCodeLabel.Content = _loan.customer.FullCustomerCode;
     LoanIDTextBox.Text = _loan.LOAN_ID;
     EmployeeLabel.Content = LetterHandller.UppercaseFirst(_loan.employee.FULLNAME);
 }
        private loan getLoanData()
        {
            try
            {
                loan _loan = new loan();
                if(_viewmode.Equals(Mode.NEW))
                {
                    _loan.ID = IDHandller.generateID("loan");
                    _loan.STATUS = true;
                    _loan.INSERT_USER_ID = Session.LoggedEmployee.ID;
                    _loan.INSERT_DATETIME = System.DateTime.Now;
                }
                else if(_viewmode.Equals(Mode.EDIT))
                {
                    _loan.ID = IDHandller.generateID("loan");
                    _loan.STATUS = true;
                    _loan.UPDATE_USER_ID = Session.LoggedEmployee.ID;
                    _loan.UPDATE_DATETIME = System.DateTime.Now;
                }
                _loan.FK_EMPLOYEE_ID = SelectedEmployee.ID;
                _loan.FK_CUSTOMER_ID = SelectedCustomer.ID;
                _loan.FK_LOAN_TYPE_ID = SelectedLoan_Type.ID;
                _loan.FK_BRANCH_ID = "1";

                _loan.LOAN_ID = LoanCodeTextBox.Text;
                _loan.AMOUNT = Convert.ToDecimal(AmountTextBox.Text);
                _loan.INSTALLMENT = Convert.ToDecimal(InstalmentTextBox.Text);
                _loan.START_DATE = Convert.ToDateTime(StartDateDatePicker.SelectedDate);
                _loan.END_DATE = Convert.ToDateTime(EndDateDatePicker.SelectedDate);

                _loan.REMARK = RemarkTextBox.Text;
                _loan.LOAN_STATUS = true;

                

                return _loan;
            }
            catch
            {
                return null;
            }
        }
 private async void LoginByLoanID(loan _loan)
 {
     if (_loan!=null)
     {
         loan selected = LoanList.Single(ln => ln.ID == _loan.ID );
         Session.SelectedLoan = selected;
     }
     else
     {
         await MainWindow.Instance.ShowMessageAsync(Messages.TTL_MSG, Messages.MSG_SELECT_LOAN, MessageDialogStyle.Affirmative);
     }
 }
 private void clearData()
 {
     _selectedCustomer = null;
     _selectedEmployee = null;
     _selectedLoanType = null;
     _selectedLoan = null;
 }
 public static void LogOutSelectedLoan()
 {
     if (LoanPage.Instance != null)
     {
         LoanPage.Instance.SelectedLoan.Content = "No Loan Selected";
         LoanPage.Instance.SelectedLoanLogOutButton.Visibility = Visibility.Hidden;
         LoanPage.Instance.ContentFrame.Content = QuickSearchPageLoan.Instance;
         QuickSearchPageLoan.Instance.RefreshPage();
         LoanPage.ViewMode = Mode.LIST;
     }
     SelectedLoan = null;
 }