private void CriarVenda(EnumVenda enumVenda)
        {
            vendaInfo = new VendaInfo
            {
                vendata          = DateTime.Now.Date,
                venidcliente     = infoServ.seridcliente,
                venidfunc        = infoServ.seridtecresp,
                venidstatus      = 1,
                venidunidade     = Form1.Unidade.uniid,
                venquant         = quant,
                venvalor         = total,
                venvip           = 1,
                venmodo          = 1,
                venidturno       = 0,
                venidtipoentrada = 2
            };

            colecaoDetalhes = new VendaDetalhesColecao();

            if (enumVenda == EnumVenda.Taxa)
            {
                VendaDetalhesInfo vendaDetalhesInfo = new VendaDetalhesInfo
                {
                    vendetalhesid        = 0,
                    vendetalhesidprod    = taxa.proId,
                    vendetalhesidvenda   = vendaInfo.venid,
                    vendetalhesquant     = 1,
                    vendetalhesvalordesc = infoServ.sertaxa,
                    vendetalhesvalorunit = infoServ.sertaxa,
                    vendetalhesidfunc    = vendaInfo.venidfunc
                };

                colecaoDetalhes.Add(vendaDetalhesInfo);
            }
            else
            {
                foreach (GridPedidoInfo pedido in gridPedidoColecao)
                {
                    VendaDetalhesInfo vendaDetalhesInfo = new VendaDetalhesInfo
                    {
                        vendetalhesid        = 0,
                        vendetalhesidprod    = pedido.cod,
                        vendetalhesidvenda   = vendaInfo.venid,
                        vendetalhesquant     = pedido.quant,
                        vendetalhesvalordesc = pedido.valorDesc,
                        vendetalhesvalorunit = pedido.valorUnit,
                        vendetalhesidfunc    = vendaInfo.venidfunc
                    };

                    colecaoDetalhes.Add(vendaDetalhesInfo);
                }
            }

            Form1.encerrarThread = true;

            AbrirVenda(enumVenda);
        }
 public FormVenda(VendaInfo venda, VendaDetalhesColecao colecao, string servicoTexto, EnumVenda enumVenda)
 {
     Inicializar();
     OsTexto         = servicoTexto;
     vendaInfo       = venda;
     colecaoDetalhes = colecao;
     PreencherCliente();
     vendaEnum = enumVenda;
     AtivarForm(false);
 }
 private void VendaConcluida(EnumVenda enumVenda)
 {
     if (enumVenda == EnumVenda.Taxa)
     {
         thread = new Thread(InserirTaxa);
         form1.ExecutarThread(thread);
     }
     else
     {
         thread = new Thread(AtualizarServico);
         form1.ExecutarThread(thread);
     }
     this.Activate();
 }
        private bool AbrirVenda(EnumVenda enumVenda)
        {
            string OsTexto = string.Empty;

            OsTexto = "OS: " + string.Format("{0:000000}", infoServ.serid);

            FormVenda formVenda = new FormVenda(vendaInfo, colecaoDetalhes, OsTexto, enumVenda);

            formVenda.ShowDialog(this);
            formVenda.Dispose();

            if (formVenda.DialogResult == DialogResult.Yes)
            {
                servicoOrcamento = formVenda.ServicoTaxa;
                VendaConcluida(enumVenda);
                FormMessage.ShowMessegeInfo("Venda realizada com sucesso.");
                return(true);
            }
            else
            {
                return(false);
            }
        }