private void btnSave_Click(object sender, EventArgs e) { try { if (String.IsNullOrWhiteSpace(txtCode.Text)) { Utils.ShowInformation("You must eneter a Bank Account Code!"); txtCode.Focus(); } else if (String.IsNullOrWhiteSpace(txtName.Text)) { Utils.ShowInformation("You must eneter a Bank Account Name!"); txtName.Focus(); } else if (String.IsNullOrWhiteSpace(txtBIC.Text)) { Utils.ShowInformation("You must eneter a BIC!"); txtBIC.Focus(); } else if (String.IsNullOrWhiteSpace(txtIBAN.Text)) { Utils.ShowInformation("You must eneter an IBAN!"); txtIBAN.Focus(); } else if (String.IsNullOrWhiteSpace(txtOIN.Text)) { Utils.ShowInformation("You must eneter a Originator Id!"); txtOIN.Focus(); } else { if (formMode == Common.FormMode.Add) { if (!ValidateCode(txtCode.Text.Trim())) { if (Utils.AskQuestion(String.Format("Bank Account {0} already exists! Do you want to overwrite?", txtCode.Text.Trim())) == DialogResult.No) { txtCode.Focus(); return; } } } Data_BankAccount.SaveBankAccount(new Data_BankAccount() { BankAccountCode = txtCode.Text.Trim(), BankAccountName = txtName.Text.Trim(), BIC = txtBIC.Text.Trim(), IBAN = txtIBAN.Text.Trim(), OIN = txtOIN.Text.Trim() }); DialogResult = DialogResult.OK; } } catch (Exception ex) { Utils.ShowException(ex); } }
protected override void EditRecord() { try { Data_BankAccount bankAccount = Utils.GetCurrentRecord <Data_BankAccount>(bsRecords); if (bankAccount != null) { Data_BankAccount record = Data_BankAccount.GetBankAccount(bankAccount.BankAccountCode); if (record != null) { BankAccountDialogFrm frm = new BankAccountDialogFrm(Common.FormMode.Edit, bankAccount); if (frm.ShowDialog() == DialogResult.OK) { GetRecords(); } } } } catch (Exception ex) { Utils.ShowException(ex); } }
public PaymentsCtrl() { InitializeComponent(); try { bsSupplierTypes.DataSource = Data_SupplierType.GetSupplierTypes(); bsBankAccounts.DataSource = Data_BankAccount.GetBankAccounts(); txtReference.Text = Data_SystemParameters.GetPaymentRef(); String regAmount = Utils.GetRegistryValue("PaymentAmount") == null ? "0" : Utils.GetRegistryValue("PaymentAmount").ToString(); decimal amount; if (!Decimal.TryParse(regAmount, out amount)) { throw new Exception("Error retrieving Amount from Registry! Invalid decimal type."); } numAmount.Value = amount; GetRecords(); } catch (Exception ex) { Utils.ShowException(ex); } }
public BankAccountDialogFrm(Common.FormMode formMode, Data_BankAccount bankAccount) { InitializeComponent(); try { this.formMode = formMode; if (formMode != Common.FormMode.Add) { BindControls(bankAccount); if (formMode == Common.FormMode.View) { Utils.DisableAllControls(this); this.Text = String.Format("View Bank Account {0}", bankAccount.BankAccountCode); return; } this.Text = String.Format("Edit Bank Account {0}", bankAccount.BankAccountCode); txtCode.ReadOnly = true; txtName.Focus(); } } catch (Exception ex) { Utils.ShowException(ex); } }
private void BindControls(Data_BankAccount bankAccount) { txtCode.Text = bankAccount.BankAccountCode; txtName.Text = bankAccount.BankAccountName; txtBIC.Text = bankAccount.BIC; txtIBAN.Text = bankAccount.IBAN; txtOIN.Text = bankAccount.OIN; }
private bool ValidateCode(String bankAccountCode) { try { Data_BankAccount record = Data_BankAccount.GetBankAccount(txtCode.Text.Trim()); return(record == null); } catch (Exception ex) { throw ex; } }
private void GetRecords() { try { Cursor.Current = Cursors.WaitCursor; bsRecords.DataSource = Data_BankAccount.GetBankAccounts(); } catch (Exception ex) { throw ex; } finally { Cursor.Current = Cursors.Default; } }
protected override void DeleteRecord() { try { Data_BankAccount bankAccount = Utils.GetCurrentRecord <Data_BankAccount>(bsRecords); if (bankAccount != null) { if (Utils.AskQuestion(String.Format("Are you sure you want to delete Bank Account {0}?", bankAccount.BankAccountCode)) == DialogResult.Yes) { Data_BankAccount.DeleteBankAccount(bankAccount.BankAccountCode); GetRecords(); } } } catch (Exception ex) { Utils.ShowException(ex); } }
private void btnViewBankAccount_Click(object sender, EventArgs e) { try { Data_Payment payment = Utils.GetCurrentRecord <Data_Payment>(bsRecords); if (payment != null) { Data_BankAccount bankAccount = Data_BankAccount.GetBankAccount(payment.BankAccountCode); if (bankAccount != null) { BankAccountDialogFrm frm = new BankAccountDialogFrm(Common.FormMode.View, bankAccount); frm.ShowDialog(); } } } catch (Exception ex) { Utils.ShowException(ex); } }
public PaymentEnquiryCtrl() { InitializeComponent(); try { bsSuppliers.DataSource = Data_Supplier.GetSuppliers(); bsSupplierTypes.DataSource = Data_SupplierType.GetSupplierTypes(); bsUsers.DataSource = Data_User.GetUsers(); bsBankAccounts.DataSource = Data_BankAccount.GetBankAccounts(); luSuppliers.SelectedIndex = -1; luSupplierTypes.SelectedIndex = -1; luUsers.SelectedIndex = -1; luBankAccount.SelectedIndex = -1; dtDateFrom.Value = DateTime.Parse(String.Format("01/01/{0}", DateTime.Now.Year)); dtDateTo.Value = DateTime.Now.Date; } catch (Exception ex) { Utils.ShowException(ex); } }