Пример #1
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult mensagem = MessageBox.Show("Desaja excluir o registro?", "Aviso", MessageBoxButtons.YesNo);

                if (mensagem.ToString().Equals("Yes"))
                {
                    DALConexao con = new DALConexao(DadosConexao.StringConexao);

                    BLLUnidadeMedida um = new BLLUnidadeMedida(con);

                    um.Excluir(Convert.ToInt32(txtCodigo.Text));

                    this.LimparCampos();

                    this.AlteraBotoes(1);
                }
            }
            catch
            {
                MessageBox.Show("Erro ao excluir registro");

                this.AlteraBotoes(3);
            }
        }
Пример #2
0
 private void btExcluir_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo);
         if (d.ToString() == "Yes")
         {
             DALConexao       cx  = new DALConexao(DadosDaConexao.StringDeConexao);
             BLLUnidadeMedida bll = new BLLUnidadeMedida(cx);
             bll.Excluir(Convert.ToInt32(txtCodigo.Text));
             this.LimpaTela();
             this.alteraBotoes(1);
         }
     }
     catch
     {
         MessageBox.Show("Impossivel excluir o registro.\n\nO Registro esta sendo usado em outro local.");
         alteraBotoes(3);
     }
 }
Пример #3
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("Deseja realmente excluir o registro? ", "Aviso", MessageBoxButtons.YesNo);

            if (d.ToString() == "Yes")
            {
                try
                {
                    DALConexao       cx  = new DALConexao(DadosDaConexao.StringDeConexão);
                    BLLUnidadeMedida bll = new BLLUnidadeMedida(cx);
                    bll.Excluir(Convert.ToInt32(txtCodigo.Text));
                    Mensagem("UNIDADE DE MEDIDA EXCLUIDA ", Color.Blue);
                }
                catch (SqlException)
                {
                    Erro("");
                }
                LimpaTela();
                alteraBotoes();
                txtNome.Focus();
            }
        }