コード例 #1
0
        private void BtAdd_Click(object sender, EventArgs e)
        {
            inputBox iBox = new inputBox();

            bool bAllow = gtiCore.GetBinaryAccess((int)TAcesso.CadastroPais_Alterar);

            if (!bAllow)
            {
                MessageBox.Show("Acesso não permitido.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            String sCod = iBox.Show("", "Informação", "Digite o nome do país.", 40);

            if (!string.IsNullOrEmpty(sCod))
            {
                Endereco_bll           endereco_class = new Endereco_bll(_connection);
                GTI_Models.Models.Pais reg            = new GTI_Models.Models.Pais {
                    Nome_pais = sCod.ToUpper()
                };
                Exception ex = endereco_class.Incluir_Pais(reg);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", "País já cadastrado.", ex);
                    eBox.ShowDialog();
                }
                else
                {
                    Carrega_Lista();
                }
            }
        }