public LoanApplicationPage(AllLoan allLoan) { InitializeComponent(); // iOS Platform On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); LoanApplicationVM = new LoanApplicationPageVM(this.Navigation); this.BindingContext = LoanApplicationVM; AllLoanDetails = allLoan; }
//TODO : To Call Loan Respond Api When Accept... public async Task LoanRespond(AllLoan allLoan) { //Call api.. try { UserDialogs.Instance.ShowLoading(); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.LoanRespondApi(new LoanRespondRequestModel() { usertoken = MonicaLoanApp.Helpers.Settings.GeneralAccessToken, loannumber = allLoan.loannumber, action = Action, declinereasoncode = DeclineReasonCode }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as LoanRespondResponseModel); if (requestList != null) { UserDialogs.Instance.HideLoading(); var alertConfig = new AlertConfig { Title = "", Message = "Your loan responded successfully!", OkText = "OK", OnAction = () => { App.Current.MainPage = new Views.Loans.LoanDetailsPage(); } }; UserDialogs.Instance.Alert(alertConfig); } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
//TODO : To Call Api To Get Loan Details... public async Task GetLoanDetail(AllLoan allLoan) { //Call api.. try { //UserDialogs.Instance.ShowLoading("Loading...", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.LoanSearchApi(new LoanSearchRequestModel() { usertoken = MonicaLoanApp.Helpers.Settings.GeneralAccessToken, loannumber = allLoan.loannumber }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as LoanSearchResponseModel).loans; if (requestList != null) { UserDialogs.Instance.HideLoading(); LoanDetailsList = new ObservableCollection <Schedule>(requestList[0].schedules); Status = requestList[0].statusname; Date = requestList[0].LoanDate; LoanAmount = "N" + requestList[0].loanamount; LoanBalance = "N" + requestList[0].loanbalance; UserCompany = requestList[0].employername; UserSalary = "N" + requestList[0].employeesalarymonthly; EmployeeLoanDate = requestList[0].EmployeeLoanDate; UserName = requestList[0].employeenumber; } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
public ActionResult Get2PartSummary(Guid memberId, Guid medallionId) { TwoPart twoPart = new TwoPart() { Deposits = new List<AllDeposit>(), Loans = new List<AllLoan>(), Receivable = new List<AllReceivable>() }; { //get medallionLoan var loans = loanService.GetLoanListByMemberAndMedallion(memberId, medallionId); var insuranceDeposit = insuranceDepositService.GetByMedallionAndMemberId(memberId, medallionId); var ccsys = ccsystemAirtimeService.GetByMedallionAndMemberId(memberId, medallionId); var accReceivable = accountReceivableService.GetByMedallionAndMemberId(memberId, medallionId); var saveDeposit = savingDepositService.GetByMedallionAndMemberId(memberId, medallionId); if (loans != null && loans.Count > 0) { AllLoan metricloan = new AllLoan(); foreach (Loan l in loans) { metricloan.Balance += l.CurrentBalance; metricloan.InterestedPaid += l.TotalInterestPaid; metricloan.Interest += l.InterestRate; metricloan.PrincipalPaid += l.TotalPrincipalPaid; metricloan.Loan += l.LoanAmount; metricloan.TotalPaid += l.TotalPaid; metricloan.Title = "Loan:"; } twoPart.Loans.Add(metricloan); } else { AllLoan metricMedallion = new AllLoan() { Balance = 0, Interest = 0, InterestedPaid = 0, PrincipalPaid = 0, Loan = 0, TotalPaid = 0, Title = "Loan:" }; twoPart.Loans.Add(metricMedallion); } //Deposit if (insuranceDeposit != null) { AllDeposit metricInsur = new AllDeposit() { Balance = insuranceDeposit.CurrentBalance, Deposit = insuranceDeposit.DepositAmount, TotalPaid = insuranceDeposit.TotalPaid, WeeklyPayment = insuranceDeposit.WeeklyPayment, Title = "Insurance Deposit:" }; twoPart.Deposits.Add(metricInsur); } else { AllDeposit metricInsur = new AllDeposit() { Balance = 0, Deposit = 0, TotalPaid = 0, WeeklyPayment = 0, Title = "Insurance Deposit:" }; twoPart.Deposits.Add(metricInsur); } //CCSystem Airtime //if (ccsys != null) { AllDeposit metricccsys = new AllDeposit() { Title = "CCSystem Airtime:" }; twoPart.Deposits.Add(metricccsys); } //Saving Deposit if (saveDeposit != null) { AllDeposit metricsavingDeposit = new AllDeposit() { TotalPaid = saveDeposit.TotalPaid, Title = "Saving Deposit:" }; twoPart.Deposits.Add(metricsavingDeposit); } else { AllDeposit metricsavingDeposit = new AllDeposit() { TotalPaid = 0, Title = "Saving Deposit:" }; twoPart.Deposits.Add(metricsavingDeposit); } //Account Receivable if (accReceivable != null) { AllReceivable metricaccReceivable = new AllReceivable() { Balance = accReceivable.CurrentBalance, Amount = accReceivable.AccountReceivableAmount, TotalPaid = accReceivable.TotalPaid, MonthlyPayment = accReceivable.MonthlyPayment, Title = "Account Receivable:" }; twoPart.Receivable.Add(metricaccReceivable); } else { AllReceivable metricaccReceivable = new AllReceivable() { Balance = 0, Amount = 0, TotalPaid = 0, MonthlyPayment = 0, Title = "Account Receivable:" }; twoPart.Receivable.Add(metricaccReceivable); } } return Json(twoPart, JsonRequestBehavior.AllowGet); }