コード例 #1
0
ファイル: ProcessInvoice.cs プロジェクト: msifi/SBFA
        private void ProcessInvoice_Load(object sender, EventArgs e)
        {
            SBFAApi agent = new SBFAApi();

            using (new OperationContextScope(agent.context))
            {
                //check documents
                sbfa.Invoice invoice = agent.operation.GetInvoice(SBFAMain.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;
                lblFor.Text       = invoice.DocumentType.ToUpper();
                lblReceipt.Text   = invoice.ReceiptNumber;
                due = invoice.AmountTotal - invoice.AmountPaid;
                cur = invoice.Currency;
                Globals.SetPickList(cmbPayMethod, "paymet");
                Globals.SetPickList(cmbBranch, "bra");
                Globals.SetPickList(cmbCurrency, "cur");
                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 == "loan")
                {
                    sbfa.LoanRequest reg = agent.operation.GetLoanRequest(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 == "repayment")
                {
                    sbfa.BusinessRegistration reg = agent.operation.GetBusinessRegistrationByRegistration(invoice.FK_ReferenceNumber.Split('_')[0]);
                    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.InvoiceItem[] items = agent.operation.GetInvoiceItems(SBFAMain.currentInvoiceId);
                foreach (sbfa.InvoiceItem item in items)
                {
                    string[] row          = { item.Id.ToString(), item.Description, item.Amount.ToString() };
                    var      listViewItem = new ListViewItem(row);
                    lstItems.Items.Add(listViewItem);
                }
            }
        }
コード例 #2
0
        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);
                }
            }
        }