コード例 #1
0
        public BankIdentifierCodeDlg(Common.FormMode formMode, Data_BankIdentifierCode bic)
        {
            InitializeComponent();

            if (formMode == Common.FormMode.Edit)
            {
                this.Text    = "Edit BIC";
                txtCode.Text = bic.Code;
            }

            BIC = bic;
            txtCode.Focus();
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(txtCode.Text))
            {
                Utils.ShowInformation("You must enter a Code!");
                txtCode.Focus();
            }
            else
            {
                int id = 0;
                if (BIC != null)
                {
                    id = BIC.ID;
                }

                Data_BankIdentifierCode.SaveBankIdentifierCode(new Data_BankIdentifierCode()
                {
                    ID   = id,
                    Code = txtCode.Text.Trim()
                });

                DialogResult = DialogResult.OK;
            }
        }
コード例 #3
0
        private void SaveSupplier()
        {
            try {
                if (String.IsNullOrWhiteSpace(txtFirstName.Text))
                {
                    Utils.ShowInformation("You must enter a First Name!");
                    txtFirstName.Focus();
                }
                else if (String.IsNullOrWhiteSpace(luSupplierType.Text))
                {
                    Utils.ShowInformation("You must select a Supplier Type!");
                    luSupplierType.Focus();
                }
                else if (String.IsNullOrWhiteSpace(Address))
                {
                    Utils.ShowInformation("You must enter an Address!");
                    txtAddress1.Focus();
                }
                else if (String.IsNullOrWhiteSpace(txtBankName.Text))
                {
                    Utils.ShowInformation("You must enter a Bank Name!");
                    txtBankName.Focus();
                }
                else if (String.IsNullOrWhiteSpace(txtSortCode.Text))
                {
                    Utils.ShowInformation("You must enter a Sort Code!");
                    txtSortCode.Focus();
                }
                else if (String.IsNullOrWhiteSpace(txtBIC.Text))
                {
                    Utils.ShowInformation("You must enter a BIC!");
                    txtBIC.Focus();
                }
                else if (String.IsNullOrWhiteSpace(txtIBAN.Text))
                {
                    Utils.ShowInformation("You must enter an IBAN!");
                    txtIBAN.Focus();
                }
                else
                {
                    if (!Data_BankIdentifierCode.ValidateCode(txtBIC.Text.Trim()))
                    {
                        Utils.ShowWarning("WARNING: BIC is not valid!");
                    }

                    // Perform some validation on IBAN
                    String bic      = txtIBAN.Text.Trim().Substring(4, 4);
                    String sortCode = txtIBAN.Text.Trim().Substring(8, 6);

                    if (!txtBIC.Text.Trim().Contains(bic))
                    {
                        Utils.ShowWarning("WARNING: IBAN does not contain BIC entered!");
                    }
                    else if (!txtSortCode.Text.Trim().Contains(sortCode))
                    {
                        Utils.ShowWarning("WARNING: IBAN does not contain Sort Code entered!");
                    }
                    else if (!Utils.ValidIBAN(txtIBAN.Text.Trim()))
                    {
                        Utils.ShowWarning("WARNING: IBAN is not valid!");
                    }

                    Data_Supplier.SaveSupplier(new Data_Supplier()
                    {
                        SupplierID       = supplierID,
                        SupplierTypeCode = luSupplierType.SelectedValue.ToString(),
                        FirstName        = txtFirstName.Text.Trim(),
                        Surname          = txtSurname.Text.Trim(),
                        Address1         = txtAddress1.Text.Trim(),
                        Address2         = txtAddress2.Text.Trim(),
                        Address3         = txtAddress3.Text.Trim(),
                        Address4         = txtAddress4.Text.Trim(),
                        Address5         = txtAddress5.Text.Trim(),
                        Phone            = txtPhone.Text.Trim(),
                        Mobile           = txtMobile.Text.Trim(),
                        PPSVat           = txtPPSVat.Text.Trim(),
                        BankName         = txtBankName.Text.Trim(),
                        BankAddress1     = txtBankAddress1.Text.Trim(),
                        BankAddress2     = txtBankAddress2.Text.Trim(),
                        BankAddress3     = txtBankAddress3.Text.Trim(),
                        BankAddress4     = txtBankAddress4.Text.Trim(),
                        BankAddress5     = txtBankAddress5.Text.Trim(),
                        BankAccNumber    = txtBankAccNumber.Text.Trim(),
                        SortCode         = txtSortCode.Text.Trim(),
                        BIC  = txtBIC.Text.Trim(),
                        IBAN = txtIBAN.Text.Trim()
                    });

                    DialogResult = DialogResult.OK;
                }
            } catch (Exception ex) {
                Utils.ShowException(ex);
            }
        }