예제 #1
0
        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);
            }
        }