public static bool ValidateLoanField(senpa.WorkFlowFieldValidations aVal, senpa.RegistrationRequest classObject) { 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 ProcessInvoice_Load(object sender, EventArgs e) { SenpaApi agent = new SenpaApi(); using (new OperationContextScope(agent.context)) { //check documents senpa.Invoice invoice = agent.operation.GetInvoice(SEnPAMain.currentInvoiceId); lblAmount.Text = invoice.Currency + invoice.Amount.ToString(); lbSur.Text = invoice.Currency + invoice.AmountSurcharge.ToString(); lblDisc.Text = invoice.Currency + invoice.AmountDiscount.ToString(); lblTotal.Text = invoice.Currency + invoice.AmountTotal.ToString(); lblPaid.Text = invoice.CurrencyPaid + invoice.AmountPaid.ToString(); lblDue.Text = invoice.Currency + (invoice.AmountTotal - invoice.AmountPaid); lblReference.Text = invoice.FK_ReferenceNumber; lblReceipt.Text = invoice.ReceiptNumber; lblFor.Text = invoice.DocumentType.ToUpper(); due = invoice.AmountTotal - invoice.AmountPaid; cur = invoice.Currency; Globals.SetPickList(cmbPayMethod, "paymet"); cmbPayMethod.SelectedValue = 1; Globals.SetPickList(cmbBranch, "bra"); cmbBranch.SelectedValue = 1; Globals.SetPickList(cmbCurrency, "cur"); cmbCurrency.SelectedValue = 1; if (due <= 0) { btnOpenPay.Visible = false; pnlPay.Visible = false; btnPrint.Visible = true; } else { btnOpenPay.Visible = true; btnPrint.Visible = false; } //get applicant details if registration if (invoice.DocumentType == "registration") { senpa.RegistrationRequest reg = agent.operation.GetRegistrationRequest(invoice.FK_DocumentId); 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"); } else if (invoice.DocumentType == "renewal") { senpa.RenewalRequest ren = agent.operation.GetRenewalRequest(invoice.FK_DocumentId); senpa.BusinessRegistration reg = agent.operation.GetBusinessRegistration(ren.FK_BusinessRegistrationId, false); 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"); } senpa.InvoiceItem[] items = agent.operation.GetInvoiceItems(SEnPAMain.currentInvoiceId); foreach (senpa.InvoiceItem item in items) { string[] row = { item.Id.ToString(), item.Description, item.Amount.ToString() }; var listViewItem = new ListViewItem(row); lstItems.Items.Add(listViewItem); } } }