private void treeUserGroups_AfterSelect(object sender, TreeViewEventArgs e) { try { treeSystemRoles.Nodes["systemRoles"].Nodes.Clear(); treeUserRoles.Nodes["userSystemRoles"].Nodes.Clear(); SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { //get application user roles sbfa.ApplicationRoles[] roles = agent.operation.GetApplicationRoles("default"); foreach (sbfa.ApplicationRoles role in roles) { string currentRole = role.Name; treeSystemRoles.Nodes["systemRoles"].Nodes.Add(currentRole, currentRole); treeSystemRoles.Nodes["systemRoles"].Nodes[currentRole].Nodes.Add(role.Description); } //get selected user roles sbfa.ApplicationRoles[] userRoles = agent.operation.GetApplicationUserGroupRoles(treeUserGroups.SelectedNode.Text); foreach (sbfa.ApplicationRoles role in userRoles) { string currentRole = role.Name; treeUserRoles.Nodes["userSystemRoles"].Nodes.Add(currentRole, currentRole); treeUserRoles.Nodes["userSystemRoles"].Nodes[currentRole].Nodes.Add(role.Description); //remove from system roles treeSystemRoles.Nodes["systemRoles"].Nodes[currentRole].Remove(); } } } catch { ShowErrorMessage("Failed to retrieve configuration"); } }
private void btnAdd_Click(object sender, EventArgs e) { if (txtGroup.Text == "") { ShowErrorMessage("Provide the group name"); return; } try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { //get application user roles sbfa.UserRoleActionResponse response = agent.operation.AddUserGroup(txtGroup.Text, txtDescription.Text); if (response.actionStatus) { string currentRole = txtGroup.Text; treeUserGroups.Nodes["userGroups"].Nodes.Add(currentRole, currentRole); treeUserGroups.Nodes["userGroups"].Nodes[currentRole].Nodes.Add(txtDescription.Text); } } } catch { ShowErrorMessage("Failed to add group"); } }
private void ReceiveOldRepayment_Load(object sender, EventArgs e) { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { Globals.SetPickList(cmbPayMethod, "paymet"); Globals.SetPickList(cmbBranch, "bra"); Globals.SetPickList(cmbCurrency, "cur"); Globals.SetPickList(cmbFeePayMethod, "paymet"); Globals.SetPickList(cmbFeeBranch, "bra"); Globals.SetPickList(cmbFeeCurrency, "cur"); if (SBFAMain.oldAccount != "" && SBFAMain.oldLoan != "") { txtAccount.Text = SBFAMain.oldAccount; txtLoan.Text = SBFAMain.oldLoan; sbfa.BusinessRegistration reg = agent.operation.GetOldBusinessRegistrationByRegistration(txtAccount.Text, txtLoan.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.BusinessAccountOld bus = agent.operation.GetOldBusinessAccountByAccount(txtAccount.Text, txtLoan.Text); double bal = bus.AccountBalance;// CalculateBalance(bus.AccountBalance.ToString(), bus.IntrestRate.ToString(), bus.LastCalculationDate); lblTotal.Text = bal.ToString(); lblDue.Text = bal.ToString(); } } }
private void ManageUserGroupProperties_Load(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { //get application user roles sbfa.ApplicationRoles[] roles = agent.operation.GetApplicationRoles("default"); foreach (sbfa.ApplicationRoles role in roles) { string currentRole = role.Name; treeSystemRoles.Nodes["systemRoles"].Nodes.Add(currentRole, currentRole); treeSystemRoles.Nodes["systemRoles"].Nodes[currentRole].Nodes.Add(role.Description); } //get user group roles //get application user group roles sbfa.ApplicationRoleGroups[] rolesGroup = agent.operation.GetApplicationGroupRoles("default"); foreach (sbfa.ApplicationRoleGroups role in rolesGroup) { string currentRole = role.Name; treeUserGroups.Nodes["userGroups"].Nodes.Add(currentRole, currentRole); treeUserGroups.Nodes["userGroups"].Nodes[currentRole].Nodes.Add(role.Description); } } } catch { ShowErrorMessage("Failed to load configuration"); } }
private void txtPayback_Leave(object sender, EventArgs e) { if (txtPayback.Text == "") { ShowErrorMessage("Enter a valid period"); txtPayback.Focus(); return; } if (float.Parse(txtPayback.Text) <= 0) { ShowErrorMessage("Enter a valid period"); txtPayback.Focus(); return; } try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { float val = agent.operation.CalculateMonthlyRepayment(int.Parse(txtPayback.Text), SBFAMain.currentId); txtMonthly.Text = val.ToString(); } } catch { ShowErrorMessage("Error processing"); } }
private void SendEmail_Load(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { //get user group roles //get application user group roles sbfa.ApplicationRoleGroups[] rolesGroup = agent.operation.GetApplicationGroupRoles("default"); foreach (sbfa.ApplicationRoleGroups role in rolesGroup) { string currentRole = role.Name; treeSystemRoles.Nodes["systemGroupRoles"].Nodes.Add(currentRole, currentRole); treeSystemRoles.Nodes["systemGroupRoles"].Nodes[currentRole].Nodes.Add(role.Description); } if (SBFAMain.forAccount) { lblName.Text = SBFAMain.name; txtDestination.Enabled = false; txtDestination.Text = SBFAMain.email; } else { lblName.Text = "Send messages"; } } } catch { ShowErrorMessage("Failed to initialize email form"); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtValue.Text == "" || txtValueMax.Text == "") { ShowErrorMessage("please set the value and max value"); return; } try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { long save = agent.operation.SaveValidation(((chkNew.Checked) ? 0 : currentId), currentDoc, cmbField.SelectedValue.ToString(), cmbDataType.SelectedValue.ToString(), txtText.Text, txtValue.Text, txtValueMax.Text, cmbEvaluationType.SelectedValue.ToString(), chkActive.Checked); if (save > 0) { currentId = save; chkNew.Checked = false; string[] row = { save.ToString(), cmbField.SelectedText, txtText.Text, cmbDataType.SelectedText, txtValue.Text, txtValueMax.Text, cmbEvaluationType.SelectedText, ((chkActive.Checked) ? "Yes" : "No") }; var listViewItem = new ListViewItem(row); lstRules.Items.Add(listViewItem); } } } catch { ShowErrorMessage("Error saving rule"); } }
private void btnSave_Click(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { try { long save = agent.operation.SaveFeeRule(currentTypeId, txtName.Text, cmbDataType.SelectedValue.ToString(), cmbField.SelectedValue.ToString(), cmbExecutiontype.SelectedValue.ToString(), txtValue.Text, cmbEvalField.SelectedValue.ToString(), cmbEvalDataType.SelectedValue.ToString(), cmbEvaluationType.SelectedValue.ToString(), txtEvalValue.Text, txtEvalValueMax.Text, chkActive.Checked); if (save > 0) { currentId = save; string[] row = { save.ToString(), txtName.Text, cmbDataType.SelectedText, cmbField.SelectedText, cmbExecutiontype.SelectedText, txtValue.Text, cmbEvalField.SelectedText, cmbEvalDataType.SelectedText, cmbEvaluationType.SelectedText, txtEvalValue.Text, txtEvalValueMax.Text, ((chkActive.Checked) ? "Yes" : "No") }; var listViewItem = new ListViewItem(row); lstRules.Items.Add(listViewItem); } } catch { } } } catch { ShowErrorMessage("Failed to save your Rule, Please make sure all fields are valid"); } }
private void treeDocuments_AfterSelect(object sender, TreeViewEventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { if (treeDocuments.SelectedNode.Text.ToLower() != "documents") { currentDoc = treeDocuments.SelectedNode.Name; Globals.SetFieldsPickList(cmbField, currentDoc); lstRules.Items.Clear(); sbfa.WorkFlowFieldValidations[] response = agent.operation.GetValidationsList(currentDoc); foreach (sbfa.WorkFlowFieldValidations rule in response) { string[] row = { rule.Id.ToString(), rule.ParameterField, rule.ParameterFieldName, rule.ParameterDataType, rule.ParameterValue, rule.ParameterMaxValue, rule.ParameterEvaluationType, ((rule.Active) ? "Yes" : "No") }; var listViewItem = new ListViewItem(row); lstRules.Items.Add(listViewItem); } } } } catch { ShowErrorMessage("Failed to retrieve details"); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string loginResponse = SBFAApi.SignIn(username, password); signInSuccessful = loginResponse; if (loginResponse.Equals("successful")) { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { //get user group roles sbfa.ApplicationRoleGroups[] accessGroupRoles = agent.operation.GetApplicationGroupRoles(Globals.userLogged); foreach (sbfa.ApplicationRoleGroups roleName in accessGroupRoles) { Globals.userGroupRoles.Add(roleName.Name); } //get user roles sbfa.ApplicationRoles[] accessRoles = agent.operation.GetApplicationRoles(Globals.userLogged); foreach (sbfa.ApplicationRoles roleName in accessRoles) { Globals.userRoles.Add(roleName.Name); } } } }
private void txtFeeLoan_Leave(object sender, EventArgs e) { if (txtFeeAccount.Text == "") { return; } try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.BusinessRegistration reg = agent.operation.GetOldBusinessRegistrationByRegistration(txtFeeAccount.Text, txtFeeLoan.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.BusinessAccountOld bus = agent.operation.GetOldBusinessAccountByAccount(txtFeeAccount.Text, txtFeeLoan.Text); double bal = bus.Penalty + bus.ProcessingFee + bus.CancellationFee; lblTotal.Text = bal.ToString(); lblDue.Text = bal.ToString(); } } catch { // } }
private void btnSave_Click(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { long wrk = agent.operation.CreateWorkFlowStagesAutoDocument(ManageStages.currentWorkFlowStage, cmbTemplate.SelectedValue.ToString(), Globals.GetComboBoxValue(cmbEmail), Globals.GetComboBoxValue(cmbSMS), chkActive.Checked); if (wrk > -1) { lstDocuments.Items.Clear(); sbfa.WorkFlowStagesAutoDocuments[] response = agent.operation.GetWorkFlowStagesAutoDocuments(ManageStages.currentWorkFlowStage); foreach (sbfa.WorkFlowStagesAutoDocuments wrkFlow in response) { string[] row = { wrkFlow.Id.ToString(), wrkFlow.FK_AutoDocumentName, ((wrkFlow.SendEmail) == -1 ? "No" : ((wrkFlow.SendEmail) == 0 ? "On Enter" : "On Leave")), ((wrkFlow.SendSMS) == -1 ? "No" : ((wrkFlow.SendSMS) == 0 ? "On Enter" : "On Leave")) }; var listViewItem = new ListViewItem(row); lstDocuments.Items.Add(listViewItem); } } } } catch { ShowErrorMessage("Error saving your stage document config"); } }
private void printReceipt(string rec) { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { Byte[] doc = agent.operation.GetAutoDocument("receipt", long.Parse(rec)); string filePath = Application.StartupPath + "\\filer\\" + rec + ".pdf"; FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write); fs.Write(doc, 0, doc.Length); fs.Flush(); fs.Close(); System.Diagnostics.Process newProcess = new System.Diagnostics.Process(); newProcess.StartInfo = new System.Diagnostics.ProcessStartInfo(filePath); newProcess.Start(); newProcess.WaitForExit(); try { System.IO.File.Delete(filePath); } catch { } this.Close(); } }
private void simpleButton1_Click(object sender, EventArgs e) { if (txtRemark.Text == "") { return; } if (lbltext.Text != "") { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { bool save = agent.operation.SetWarningStage(SBFAMain.currentRepaymentId, lbltext.Text, txtRemark.Text, chkRemark.Checked); if (save) { ShowSuccessMessage("Saved!!"); } else { ShowErrorMessage("Error updating remarks!!"); } } } catch { ShowErrorMessage("Error saving"); } } }
private void lstRules_SelectedIndexChanged(object sender, EventArgs e) { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { try { currentId = long.Parse(lstRules.SelectedItems[0].SubItems[0].Text); sbfa.FeeRules response = agent.operation.GetFeeRule(currentId); Globals.SetPickListValue(cmbField, response.RuleField); chkActive.Checked = response.Active; txtName.Text = response.RuleName; Globals.SetPickListValue(cmbDataType, response.RuleType); Globals.SetPickListValue(cmbExecutiontype, response.RuleExecutionType); txtValue.Text = response.RuleExecutionValue; Globals.SetPickListValue(cmbEvalField, response.RuleEvaluationField); Globals.SetPickListValue(cmbEvalDataType, response.RuleEvaluationDataType); Globals.SetPickListValue(cmbEvaluationType, response.RuleEvaluationType); txtEvalValue.Text = response.RuleEvaluationValue; txtEvalValueMax.Text = response.RuleEvaluationMaxValue; } catch { } } }
private void treeStakeholder_AfterSelect(object sender, TreeViewEventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { if (treeStakeholder.SelectedNode.Text.ToLower() != "stakeholders") { currentStakeholder = int.Parse(treeStakeholder.SelectedNode.Name.Split('_')[1]); sbfa.Stakeholder stake = agent.operation.GetStakeholder(currentStakeholder); txtName.Text = stake.Name; txtDescription.Text = stake.Description; txtMobile.Text = stake.Mobile; txtEmail.Text = stake.Email; chkActive.Checked = stake.Active; lstBusiness.Items.Clear(); sbfa.ReferenceTable[] response = agent.operation.GetStakeholderBusinessTypes(currentStakeholder); foreach (sbfa.ReferenceTable busType in response) { string[] row = { busType.Id.ToString(), busType.Name, busType.Description }; var listViewItem = new ListViewItem(row); lstBusiness.Items.Add(listViewItem); } } } } catch { ShowErrorMessage("Error retrieving stakeholder record"); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtName.Text == "") { ShowErrorMessage("Please specify the name"); return; } try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { long stake = agent.operation.SaveStakeholder(txtName.Text, txtDescription.Text, txtMobile.Text, txtEmail.Text, chkActive.Checked); if (stake > 0) { lstBusiness.Items.Clear(); string currentStake = "_" + stake.ToString(); treeStakeholder.Nodes["stakeHolder"].Nodes.Add(currentStake, txtName.Text); } } } catch { ShowErrorMessage("Error saving stakeholder"); } }
private void ManageStages_Load(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.WorkFlowStages[] response = agent.operation.GetWorkFlowStages(SBFAMain.currentWorkFlow); foreach (sbfa.WorkFlowStages wrkFlow in response) { string currentFlow = "_" + wrkFlow.Id.ToString(); treeStages.Nodes["workStages"].Nodes.Add(currentFlow, wrkFlow.StageName); } Globals.SetPickList(cmbGroup, "rolgro"); Globals.SetPickList(cmbDocType, "doctyp"); } Globals.SetStageMessagingPickList(cmbEmail); Globals.SetStageMessagingPickList(cmbSMS); Globals.SetAutoDocumentPickList(cmbTemplate); cmbAssign.SelectedIndex = 0; } catch { ShowErrorMessage("Error initializing stage configuration"); } }
private void btnDocs_Click(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { bool wrk = agent.operation.CreateWorkFlowStageDocument(currentWorkFlowStage, Globals.GetComboBoxValue(cmbDocType), chkRequired.Checked); if (wrk) { lstDocuments.Items.Clear(); sbfa.WorkFlowStageDocuments[] response = agent.operation.GetWorkFlowStageDocuments(currentWorkFlowStage); foreach (sbfa.WorkFlowStageDocuments wrkFlow in response) { string[] row = { wrkFlow.Id.ToString(), agent.operation.GetDocumentTypeName(wrkFlow.FK_DocumentTypeId), ((wrkFlow.DocumentRequired) ? "Yes" : "No") }; var listViewItem = new ListViewItem(row); lstDocuments.Items.Add(listViewItem); } } } } catch { ShowErrorMessage("Error refreshing documents"); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtName.Text == "") { ShowErrorMessage("Please name is required"); return; } try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { long wrk = agent.operation.CreateWorkFlowStage(SBFAMain.currentWorkFlow, 0, txtName.Text, txtDescription.Text, Globals.GetComboBoxValue(cmbGroup), cmbAssign.SelectedIndex, chkOptional.Checked, chkDoc.Checked, chkPay.Checked, chkSite.Checked, chkReco.Checked, cmbTemplate.SelectedValue.ToString(), Globals.GetComboBoxValue(cmbEmail), Globals.GetComboBoxValue(cmbSMS)); if (wrk > 0) { lstDocuments.Items.Clear(); string currentFlow = "_" + wrk.ToString(); treeStages.Nodes["workStages"].Nodes.Add(currentFlow, txtName.Text); } else if (wrk == -1) { ;//error msg } } } catch { ShowErrorMessage("Failed to save your details"); } }
private void gridViewGuarantors_Click(object sender, EventArgs e) { try { string currentNIN = (gridViewGuarantors.GetRowCellValue(gridViewGuarantors.FocusedRowHandle, gridViewGuarantors.Columns[0]).ToString()); SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { //check from local db first for details sbfa.Guarantor guarantor = agent.operation.GetLoanRequestGuarantor(currentNIN, SBFAMain.currentId); // guarantor.GuarantorNIN = txtDonorNIN.Text; txtDonorName.Text = guarantor.GuarantorName; txtDonorSurname.Text = guarantor.GuarantorSurname; dtDonorDOB.DateTime = guarantor.GuarantorDOB; txtDonorAddress.Text = guarantor.GuarantorAddress; txtDonorContactNo.Text = guarantor.GuarantorContactNo; cmbDonorMaritalStatus.Text = guarantor.GuarantorMaritalStatus; txtDonorNoOfDependents.Text = guarantor.GuarantorNoOfDependents; cmbDonorEmploymentStatus.Text = guarantor.GuarantorEmploymentStatus; txtDonorEmployerAddress.Text = guarantor.GuarantorEmployersAddress; txtDonorEmployerName.Text = guarantor.GuarantorEmployersName; txtDonorCurrentPosition.Text = guarantor.GuarantorCurrentPosition; txtDonorYearsOfEmployment.Text = guarantor.GuarantorNoOfYears.ToString(); txtDonorMonthlyIncome.Text = guarantor.GuarantorTotalMonthlyIncome.ToString(); txtDonorMonthlyExpenditure.Text = guarantor.GuarantorTotalMonthlyExpenditure.ToString(); } } catch (Exception ex) { ShowErrorMessage("Error loading guarantor"); } }
private void btnRemoveRole_Click(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.UserRoleActionResponse response = agent.operation.RemoveUserGroupRole(treeUserGroups.SelectedNode.Text, treeUserRoles.SelectedNode.Text); if (response.actionStatus) { TreeNode temp = treeUserRoles.SelectedNode; treeUserRoles.SelectedNode.Remove(); treeSystemRoles.Nodes["systemRoles"].Nodes.Add(temp); } else { ; } } } catch { ShowErrorMessage("Failed to update configuration"); } }
private void Guarantor_Load(object sender, EventArgs e) { txtDonorNoOfDependents.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; txtDonorYearsOfEmployment.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; txtDonorMonthlyIncome.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; txtDonorMonthlyExpenditure.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.Guarantor[] gua = agent.operation.GetGuarantors(SBFAMain.currentId); gridGuarantors.DataSource = gua; gridGuarantors.RefreshDataSource(); sbfa.WorkFlowStages currentStage = agent.operation.GetDocumentWorkFlowStage(SBFAMain.currentId, "loan"); if (currentStage.StageName == "Complete") { btnAddGuarantor.Visible = false; } else { btnAddGuarantor.Visible = true; } } } catch { ShowErrorMessage("Error initializing guarantors"); } }
private void LoanAssesment_Load(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.LoanAssesment ass = agent.operation.GetLoanAssesment(SBFAMain.currentId); txtAmount.Text = ass.LoanAmount.ToString(); txtAnanlysis.Text = ass.Analysis; txtCondition.Text = ass.Condition; txtFee.Text = ass.ProcessingFee.ToString(); txtFinancial.Text = ass.FinancialCommitment; txtGrace.Text = ass.GracePeriod.ToString(); txtMonthly.Text = ass.MonthlyRepayment.ToString(); txtPayback.Text = ass.PaybackPeriod.ToString(); txtTotal.Text = (ass.LoanAmount - ass.ProcessingFee).ToString(); txtProposedLoanAmount.Text = ass.ProposedLoanAmount.ToString(); gridSuppliers.DataSource = ass.Supplier; gridSuppliers.RefreshDataSource(); } } catch { ShowErrorMessage("Error initializing assesment"); } }
private void ManageStageAutoDocuments_Load(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { lstDocuments.Items.Clear(); sbfa.WorkFlowStagesAutoDocuments[] response = agent.operation.GetWorkFlowStagesAutoDocuments(ManageStages.currentWorkFlowStage); foreach (sbfa.WorkFlowStagesAutoDocuments wrkFlow in response) { string[] row = { wrkFlow.Id.ToString(), wrkFlow.FK_AutoDocumentName, ((wrkFlow.SendEmail) == -1 ? "No" : ((wrkFlow.SendEmail) == 0 ? "On Enter" : "On Leave")), ((wrkFlow.SendSMS) == -1 ? "No" : ((wrkFlow.SendSMS) == 0 ? "On Enter" : "On Leave")) }; var listViewItem = new ListViewItem(row); lstDocuments.Items.Add(listViewItem); } } Globals.SetStageMessagingPickList(cmbEmail); Globals.SetStageMessagingPickList(cmbSMS); Globals.SetAutoDocumentPickList(cmbTemplate); } catch { ShowErrorMessage("Failed to properly initialize documents config"); } }
private void btnUpload_Click(object sender, EventArgs e) { try { Control control = (Control)sender; uploadDocuments.ShowDialog(); string fileName = uploadDocuments.SafeFileName; //MessageBox.Show(fileName); byte[] buffer = File.ReadAllBytes(uploadDocuments.FileName); SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { bool done = agent.operation.UploadTemplateDocument(txtName.Text, fileName, buffer); if (done) { sbfa.DocumentTemplateLibrary[] response = agent.operation.GetDocumentTemplates(); gridTemplates.DataSource = response; gridTemplates.RefreshDataSource(); } else { ShowErrorMessage("Not done !!!"); } } } catch (Exception ex) { ShowErrorMessage("Failed to upload document"); } }
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); } } }
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."); txtPayAmount.Focus(); return; } SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { string response = agent.operation.PayInvoice(SBFAMain.currentInvoiceId, cmbCurrency.Text, float.Parse(txtPayAmount.Text), float.Parse(lblChange.Text), Globals.GetComboBoxValue(cmbBranch), Globals.GetComboBoxValue(cmbPayMethod)); if (response != "0") { lblReceipt.Text = response; pnlPay.Visible = false; btnOpenPay.Visible = false; btnPrint.Visible = true; } if (response != "0") { lblReceipt.Text = response; pnlPay.Visible = false; btnOpenPay.Visible = false; btnPrint.Visible = false; ShowSuccessMessage("Payment successful. The receipt number for this payment is " + lblReceipt.Text); if (chkPrint.Checked == true) { try { printReceipt(); } 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!"); } } }
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.BusinessAccountOld bus = agent.operation.GetOldBusinessAccountByAccount(txtAccount.Text, txtLoan.Text); // DateTime lDt = GetLastCalculationDate(bus.LastCalculationDate); DateTime lDt = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString().PadLeft(2, '0') + "-01 06:00:00.000"); string rec = agent.operation.OldReceiptRepayment(bus.AccountNumber, bus.LoanNumber, 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!"); } } }
private void WarningLetter_Load(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.WarningLetter sch = agent.operation.GetWarningStage(SBFAMain.currentRepaymentId); if (sch.WarningStage == "First" || sch.WarningStage == "Second" || sch.WarningStage == "Final") { if (sch.Responded) { ShowSuccessMessage(sch.FirstRemark + "\n\n" + sch.SecondRemark + "\n\n" + sch.FinalRemark); this.Close(); } else { lbltext.Text = ((sch.WarningStage == "First") ? "" : ((sch.WarningStage == "Second") ? "First" : "Second")); if (sch.WarningStage == "Final" && sch.FinalRemark != "") { lbltext.Text = ""; btnPay.Enabled = false; lblAccount.Text = "None"; } else { lblAccount.Text = sch.WarningStage; } lblRemarks.Text = sch.FirstRemark + "\n\n" + sch.SecondRemark + "\n\n" + sch.FinalRemark; } } else { //check last payment period bool save = agent.operation.SetWarningStage(SBFAMain.currentRepaymentId, Globals.Warning[0], "", false); if (!save) { ShowErrorMessage("Not yet due for warning letter"); this.Close(); } if (save) { lblAccount.Text = Globals.Warning[0]; } } } } catch { ShowErrorMessage("There has been a problem initializing form"); } }