private void btnPay_Click(object sender, EventArgs e) { if (txtPayAmount.Text.Equals("")) { ShowValidationError("Please enter the amount to be paid."); return; } if (isNumeric(txtPayAmount.Text) == false) { ShowValidationError("Please enter a valid amount to be paid."); txtFeePayAmount.Focus(); return; } SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.BusinessAccount bus = agent.operation.GetBusinessAccountByAccount(txtAccount.Text); DateTime lDt = GetLastCalculationDate(bus.LastCalculationDate); string rec = agent.operation.ReceiptRepayment(bus.AccountNumber, cmbCurrency.Text, float.Parse(lblDue.Text), float.Parse(txtPayAmount.Text), Globals.GetComboBoxValue(cmbBranch), Globals.GetComboBoxValue(cmbPayMethod), lDt); if (rec != "0") { lblReceipt.Text = rec; btnPrint.Visible = true; } if (rec != "0") { lblReceipt.Text = rec; btnPrint.Visible = false; ShowSuccessMessage("Payment successful. The receipt number for this payment is " + lblReceipt.Text); if (chkPrint.Checked == true) { try { printReceipt(rec); } catch (Exception ex) { ShowError("An error occured in printing. Please install a PDF Reader and try again."); } } } else { ShowErrorMessage("An error occured making the payment!"); } } }
public static bool ValidateLoanField(sbfa.WorkFlowFieldValidations aVal, sbfa.LoanRequest classObject) { if (aVal.ParameterField == "PendingLoanAmount") { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.BusinessAccount bus = agent.operation.GetBusinessAccount(classObject.NIN); if (bus == null) { return(true); } else { return(ValidateField(aVal, bus.AccountBalance)); } } } else { object val = null; bool found = false; FieldInfo[] fields = classObject.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); foreach (FieldInfo f in fields) { if (f.Name == aVal.ParameterField + "Field") { val = f.GetValue(classObject); found = true; break; } else { } } if (found) { return(ValidateField(aVal, val)); } else { return(false); } } }
private void txtAccount_Leave(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.BusinessRegistration reg = agent.operation.GetBusinessRegistrationByRegistration(txtAccount.Text); lblName.Text = reg.FirstNames + " " + reg.LastName; lblNIN.Text = reg.NIN; lblLoc.Text = agent.operation.GetEntityName(reg.FK_ResidenceIslandLocationId, "isl") + "," + agent.operation.GetEntityName(reg.FK_ResidenceDistrictLocationId, "dis"); sbfa.BusinessAccount bus = agent.operation.GetBusinessAccountByAccount(txtAccount.Text); double bal = CalculateBalance(bus.AccountBalance.ToString(), bus.IntrestRate.ToString(), bus.LastCalculationDate); lblTotal.Text = bal.ToString(); lblDue.Text = bal.ToString(); } } catch { // } }
private void txtFeeAccount_TextChanged(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.BusinessRegistration reg = agent.operation.GetBusinessRegistrationByRegistration(txtFeeAccount.Text); lblName.Text = reg.FirstNames + " " + reg.LastName; lblNIN.Text = reg.NIN; lblLoc.Text = agent.operation.GetEntityName(reg.FK_ResidenceIslandLocationId, "isl") + "," + agent.operation.GetEntityName(reg.FK_ResidenceDistrictLocationId, "dis"); sbfa.BusinessAccount bus = agent.operation.GetBusinessAccountByAccount(txtFeeAccount.Text); double bal = bus.Penalty + bus.ProcessingFee + bus.CancellationFee; lblTotal.Text = bal.ToString(); lblDue.Text = bal.ToString(); } } catch { // } }