Ejemplo n.º 1
0
        void CarregarCboPeca()
        {
            PecasDTO        dto   = new PecasDTO();
            PecasBusiness   buss  = new PecasBusiness();
            List <PecasDTO> lista = buss.Listar();

            cboPeca.ValueMember   = nameof(dto.Id);
            cboPeca.DisplayMember = nameof(dto.Nome);
            cboPeca.DataSource    = lista;
        }
Ejemplo n.º 2
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            PecasBusiness business = new PecasBusiness();

            business.Gravar(produtosCarrinho.ToList());

            frmAdicionar frm = new frmAdicionar();

            Hide();
            frm.CarregarLabel(lblOrc.Text);
            frm.ShowDialog();
            Close();
        }
Ejemplo n.º 3
0
        private void dgvPecas_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                PecasDTO        dto  = dgvPecas.Rows[e.RowIndex].DataBoundItem as PecasDTO;
                frmAlterarPecas tela = new frmAlterarPecas();
                tela.LoadScreen(dto);
                tela.Show();
            }

            if (e.ColumnIndex == 5)
            {
                PecasDTO dto = dgvPecas.Rows[e.RowIndex].DataBoundItem as PecasDTO;

                DialogResult resposta = MessageBox.Show("Quer mesmo apagar este registro?", "NerdT", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (resposta == DialogResult.Yes)
                {
                    PecasBusiness business = new PecasBusiness();
                    business.Remover(dto.Id);
                    MessageBox.Show("Registro removido com sucesso!", "NerdT", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                }
            }
        }