コード例 #1
0
        private void btnDeletar_Click(object sender, EventArgs e)
        {
            PecasBLL pecaBll = new PecasBLL();
            PecasDTO pecaDto = new PecasDTO();

            //pecaDto.PEC_ID = int.Parse(txtcodigo.Text);

            pecaBll.Excluir(pecaDto);

            MessageBox.Show("Peça excluída com sucesso!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //txtcodigo.Text     = "";
            txtfabricante.Text = "";
            txtnome.Text       = "";
            txtqtde.Text       = "";
        }
コード例 #2
0
        private void btnAtualizar_Click(object sender, EventArgs e)
        {
            PecasBLL pecaAtualiza = new PecasBLL();
            PecasDTO pecaDto = new PecasDTO();

            //pecaDto.PEC_ID = int.Parse(txtcodigo.Text);
            pecaDto.PEC_NOME = txtnome.Text;
            pecaDto.PEC_FABRICANTE = txtfabricante.Text;
            pecaDto.PEC_QUANTIDADE = int.Parse(txtqtde.Text);

            pecaAtualiza.AtualizaPeca(pecaDto);

            MessageBox.Show("Peça atualizada com sucesso!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);

               // txtcodigo.Text = "";
            txtnome.Text = "";
            txtfabricante.Text = "";
            txtqtde.Text = "";
        }
コード例 #3
0
        private void btnSalvar_Click_1(object sender, EventArgs e)
        {
            btnDeletar.Enabled = true;
            btnAtualizar.Enabled = true;
            PecasBLL pecas = new PecasBLL();
            PecasDTO pecDto = new PecasDTO();

            if (txtnome.Text == "" || txtfabricante.Text == "" || txtqtde.Text == "")
            {
                MessageBox.Show("Preencha todos os campos.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //pecDto.PEC_ID = Convert.ToInt32(txtCodigo.Text);
                pecDto.PEC_NOME = txtnome.Text;
                pecDto.PEC_FABRICANTE = txtfabricante.Text;
                pecDto.PEC_QUANTIDADE = int.Parse(txtqtde.Text);

                pecas.Salvar(pecDto);

                MessageBox.Show("Cadastro efetuado com sucesso!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);

                txtnome.Text = "";
                txtfabricante.Text = "";
                txtqtde.Text = "";

            }
        }