private void btnComprar_Click(object sender, EventArgs e) { try { DTOFornecedor user = cboFornecedor.SelectedItem as DTOFornecedor; DTOPedido pedido = new DTOPedido(); if (produtosItens.Count > 0 && user.IdForncedor > 0 && txtDescri.Text != string.Empty && lblPrecoTotal.Text != "Preço Total") { pedido.IdForncedor = user.IdForncedor; pedido.DtPedido = dtpData.Value; pedido.DsPedido = txtDescri.Text; pedido.Total = decimal.Parse(lblPrecoTotal.Text); CarrinhoBusiness gravar = new CarrinhoBusiness(); gravar.CadastraPedido(pedido, produtosItens); if (gravar.Clear == true) { frmCompraCarrinho x = new frmCompraCarrinho(); MessageBox.Show("PEDIDO REALIZADO COM SUCESSO", "TOPMOVIE", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show("PREENCHA TODOS OS CAMPOS", "TOPMOVIE - ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch { MessageBox.Show("OCORREU UM ERRO!", "TOPMOVIE - ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void nOVOPEDIDOToolStripMenuItem1_Click(object sender, EventArgs e) { frmCompraCarrinho carr = new frmCompraCarrinho(); carr.Carregar(); carr.Show(); }