コード例 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (is_Validate())
            {
                try
                {
                    string banksortcode = txtBankCode.Text + txtBranchCode.Text;

                    if (!string.IsNullOrEmpty(txtBranchCode.Text))
                    {
                        _BankBranch.BranchCode = txtBranchCode.Text.Trim();
                    }
                    if (!string.IsNullOrEmpty(txtBranchName.Text))
                    {
                        _BankBranch.BranchName = Utils.ConvertFirstLetterToUpper(txtBranchName.Text.Trim());
                    }

                    rep.UpdateBranch(_BankBranch);

                    BanksForm b = (BanksForm)this.Owner;
                    b.RefreshBranchGrid();
                    this.Close();
                }
                catch (Exception ex)
                {
                    Utils.ShowError(ex);
                }
            }
        }
コード例 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (is_validate())
            {
                try
                {
                    if (!string.IsNullOrEmpty(txtBankName.Text))
                    {
                        _bank.BankName = Utils.ConvertFirstLetterToUpper(txtBankName.Text.Trim());
                    }

                    rep.UpdateBank(_bank);

                    BanksForm b = (BanksForm)this.Owner;
                    b.RefreshBankGrid();
                    this.Close();
                }
                catch (Exception ex)
                {
                    Utils.ShowError(ex);
                }
            }
        }
コード例 #3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (is_validate())
            {
                try
                {
                    Bank _Bank = new Bank();
                    if (!string.IsNullOrEmpty(txtBankCode.Text))
                    {
                        _Bank.BankCode = txtBankCode.Text.Trim();
                    }
                    if (!string.IsNullOrEmpty(txtBankName.Text))
                    {
                        _Bank.BankName = Utils.ConvertFirstLetterToUpper(txtBankName.Text.Trim());
                    }

                    if (db.Banks.Any(c => c.BankCode == _Bank.BankCode))
                    {
                        MessageBox.Show("Bank Code Exist!", "SB Payroll", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    if (!db.Banks.Any(c => c.BankCode == _Bank.BankCode))
                    {
                        db.Banks.AddObject(_Bank);
                        db.SaveChanges();


                        BanksForm b = (BanksForm)this.Owner;
                        b.RefreshBankGrid();
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    Utils.ShowError(ex);
                }
            }
        }