public RegistrosVenda() { InitializeComponent(); using (var repo = new BaseGeral.Repositorio.Leitura()) { var registros = repo.ObterRegistrosVenda(DefinicoesTemporarias.EmitenteAtivo.Id); int contador = 0, quant = 0; foreach (var(rv, vendedor, cliente, momento) in registros) { quant++; if (!rv.Cancelado && rv.Produtos.Count == 0) { contador++; } (rv.Cancelado ? Canceladas : Validas).Add(new ExibicaoVenda { Base = rv, NomeCliente = cliente, NomeVendedor = vendedor, DataHoraVenda = momento }); } if (contador > 0 && quant > 0) { BaseGeral.Log.Popup.Current.Escrever(BaseGeral.Log.TitulosComuns.Atenção, $"Existem {contador} registros de venda sem produto."); } } }
protected override void OnNavigatedTo(NavigationEventArgs e) { Frame.BackStack.Clear(); using (var repo = new BaseGeral.Repositorio.Leitura()) { var emit = repo.ObterEmitente(); var imagem = emit.Item2?.GetSource(); var brush = new ImageBrush { ImageSource = imagem }; imgLogotipo.Background = brush; txtNomeFantasia.Text = emit.Item1.NomeFantasia; txtNome.Text = emit.Item1.Nome; emitente = emit.Item1; this.imagem = imagem; var vendedores = repo.ObterVendedores().GerarObs(); if (vendedores.Count == 0) { lstVendedores.Visibility = Visibility.Collapsed; chkAdmin.Visibility = Visibility.Collapsed; } else { lstVendedores.ItemsSource = vendedores; } } }
public Visualizacao(RegistroVenda venda) { ID = venda.Id.ToString().ToUpper(); NFeRelacionada = venda.NotaFiscalRelacionada; DataVenda = venda.DataHoraVenda.ToString("dd-MM-yyyy"); Emitente = DefinicoesTemporarias.EmitenteAtivo; TipoFrete = venda.TipoFrete; PrazoEntrega = venda.PrazoEntrega != default(DateTime) ? venda.PrazoEntrega.ToString("dd/MM/yyyy") : null; PrazoPagamento = venda.PrazoPagamento; FormaPagamento = venda.FormaPagamento; CondicaoPagamento = venda.CondicaoPagamento; Observacoes = venda.Observações; using (var repo = new BaseGeral.Repositorio.Leitura()) { Cliente = repo.ObterCliente(venda.Cliente); Comprador = venda.Comprador != Guid.Empty ? repo.ObterComprador(venda.Comprador) : null; Motorista = venda.Motorista != Guid.Empty ? repo.ObterMotorista(venda.Motorista) : null; Vendedor = venda.Vendedor != Guid.Empty ? repo.ObterVendedor(venda.Vendedor) : null; ProdutosCompletos = venda.Produtos.Select(x => repo.ObterProduto(x.IdBase)).ToArray(); if (venda.Cancelado) { Cancelamento = repo.ObterCRV(venda.Id); } } Produtos = venda.Produtos.Select(x => new Produto { Descricao = ProdutosCompletos.First(k => k.Id == x.IdBase).Descricao, Quantidade = x.Quantidade.ToString("N2"), TotalBruto = (x.Quantidade * x.ValorUnitario).ToString("N2") }).ToList(); }
async void Finalizar() { txtAtual.Text = "Sistemas carregados. E obrigado pelo apoio 😃"; await Task.Delay(500); try { MainPage current = MainPage.Current; using (var repo = new BaseGeral.Repositorio.Leitura()) { if (repo.EmitentesCadastrados) { current.Navegar <GeralEmitente>(); } else { current.Navegar <PrimeiroUso>(); } } } catch (Exception e) { txtAtual.Text = e.Message; } }
public AssociarCategoriaFornecedor(CategoriaDI categoria) { Categoria = categoria; using (var leitor = new BaseGeral.Repositorio.Leitura()) FornecedoresDisponiveis = leitor.ObterFornecedores().GerarObs(); Escolhido = FornecedoresDisponiveis[0]; InitializeComponent(); }
public AdicionarComprador() { InitializeComponent(); using (var repo = new BaseGeral.Repositorio.Leitura()) { ClientesDisponiveis = repo.ObterClientes(x => !string.IsNullOrEmpty(x.CNPJ)).GerarObs(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { var comprado = ComprasInApp.Resumo[Compras.NFCe]; hubNFCe.Visibility = comprado ? Visibility.Visible : Visibility.Collapsed; using (var leitura = new BaseGeral.Repositorio.Leitura()) produtosEFornecedoresCadastrados = leitura.ExisteCategoria && leitura.ExisteFornecedor; }
public ControllerCategorias() : base("Inativar", 0) { using (var repo = new BaseGeral.Repositorio.Leitura()) { TodosItens = repo.ObterCategorias().Select(Convert).ToArray(); Itens = TodosItens.GerarObs(); } }
private void VerNFe(object sender, RoutedEventArgs e) { using (var repo = new BaseGeral.Repositorio.Leitura()) { var item = repo.ObterNota(ItemBanco.NotaFiscalRelacionada); var acoes = new AcoesNFe(item); BasicMainPage.Current.Navegar <Fiscal.Visualizacao>(acoes); } }
public int ObterMaiorNumero(ushort serie, bool homologacao) { var cnpj = DefinicoesTemporarias.EmitenteAtivo.CNPJ; using (var repo = new BaseGeral.Repositorio.Leitura()) { return(repo.ObterMaiorNumeroNFCe(cnpj, serie, homologacao)); } }
public ControllerFornecedores() : base("Em breve...", DefinicoesPermanentes.ModoBuscaFornecedor) { using (var repo = new BaseGeral.Repositorio.Leitura()) { TodosItens = repo.ObterFornecedores() .Select(x => new ExibicaoEspecifica <FornecedorDI>(x, x.CNPJ, x.NomeMunicipio, x.Nome)) .ToArray(); Itens = TodosItens.GerarObs(); } }
public ControllerCompradores() : base("Inativar", DefinicoesPermanentes.ModoBuscaComprador) { using (var repo = new BaseGeral.Repositorio.Leitura()) { TodosItens = repo.ObterCompradores() .Select(x => new ExibicaoEspecifica <(string, Comprador)>(x, x.Item1, x.Item2.Telefone, x.Item2.Nome)) .ToArray(); Itens = TodosItens.GerarObs(); } }
void IniciarListas() { using (var leitura = new BaseGeral.Repositorio.Leitura()) { CategoriasDisponiveis = leitura.ObterCategorias().GerarObs(); FornecedoresDisponiveis = leitura.ObterFornecedores().GerarObs(); } CategoriasEscolhidas = new ObservableCollection <CategoriaDI>(); FornecedoresEscolhidos = new ObservableCollection <FornecedorDI>(); }
void IniciarSistemaClassificacao() { using (var leitor = new BaseGeral.Repositorio.Leitura()) { Categorias = leitor.ObterCategorias().GerarObs(); ClassificavelC = Categorias.Count > 0 ? Visibility.Visible : Visibility.Collapsed; Fornecedores = leitor.ObterFornecedores().GerarObs(); ClassificavelF = Fornecedores.Count > 0 ? Visibility.Visible : Visibility.Collapsed; } }
public ControllerClientes() : base("Inativar", DefinicoesPermanentes.ModoBuscaCliente) { using (var repo = new BaseGeral.Repositorio.Leitura()) { TodosItens = repo.ObterClientes() .Select(x => new ExibicaoEspecifica <ClienteDI>(x, x.Documento, x.NomeMunicipio, x.Nome)) .ToArray(); Itens = TodosItens.GerarObs(); } }
async void CriarNFeEntrada() { var caixa = new FileOpenPicker(); caixa.FileTypeFilter.Add(".xml"); var arq = await caixa.PickSingleFileAsync(); if (arq != null) { try { var xml = await ImportacaoDados.ObterXMLNFe(arq); var proc = xml.FromXElement <ProcessoNFe>(); var nfe = proc.NFe; if (nfe.Informacoes.destinatario.CNPJ == DefinicoesTemporarias.EmitenteAtivo.CNPJ) { ClienteDI c; using (var repo = new BaseGeral.Repositorio.Leitura()) { c = repo.ObterClienteViaCNPJ(nfe.Informacoes.Emitente.CNPJ); } if (c != null) { nfe.Informacoes.destinatario = c.ToDestinatario(); nfe.Informacoes.Emitente = DefinicoesTemporarias.EmitenteAtivo.ToEmitente(); nfe.Informacoes.identificacao.TipoOperacao = 0; var analisador = new AnalisadorNFe(ref nfe); analisador.Desnormalizar(); var controle = new ControleNFe(nfe); if (await new Criador(controle).ShowAsync() == ContentDialogResult.Primary) { Popup.Current.Escrever(TitulosComuns.Sucesso, "Nota de entrada criada. Agora verifique se todas as informações estão corretas e se nenhum dado ficou de fora."); } } else { using (var repo = new BaseGeral.Repositorio.Escrita()) { repo.SalvarItemSimples(new ClienteDI(nfe.Informacoes.Emitente), DefinicoesTemporarias.DateTimeNow); } } } else { Popup.Current.Escrever(TitulosComuns.Atenção, "O cliente dessa nota fiscal não é o emitente ativo, por favor, escolha apenas notas fiscais para o emitente ativo."); } } catch (Exception erro) { erro.ManipularErro(); } } }
private async void Analisar(object sender, RoutedEventArgs e) { if (UF == null || string.IsNullOrEmpty(Chave)) { return; } var gerenciador = new GerenciadorGeral <ConsSitNFe, RetConsSitNFe>(UF, Operacoes.Consultar, Homologacao, isNFCe); var envio = new ConsSitNFe(Chave, Homologacao); RetConsSitNFe resultado = default(RetConsSitNFe); X509Certificate2[] certs; using (var loja = new X509Store(StoreName.My, StoreLocation.CurrentUser)) { loja.Open(OpenFlags.ReadOnly); certs = loja.Certificates.Cast <X509Certificate2>().ToArray(); } Progresso progresso = null; progresso = new Progresso(async x => { resultado = await gerenciador.EnviarAsync(envio, false, (X509Certificate2)x); await progresso.Update(5); return(true, resultado.DescricaoResposta); }, certs, "Subject", gerenciador.Etapas.Concat("Analisar resultado no banco de dados")); gerenciador.ProgressChanged += async(x, y) => await progresso.Update(y); await progresso.ShowAsync(); if (resultado.StatusResposta == 100) { NFeDI nota = null; using (var leit = new BaseGeral.Repositorio.Leitura()) { nota = leit.ObterNota($"NFe{resultado.ChaveNFe}"); } if (nota != null && nota.Status < 4) { using (var esc = new BaseGeral.Repositorio.Escrita()) { nota.Status = (int)StatusNota.Emitida; var original = XElement.Parse(nota.XML).FromXElement <NFe>(); var novo = new ProcessoNFe() { NFe = original, ProtNFe = resultado.Protocolo }; nota.XML = novo.ToXElement().ToString(); esc.SalvarItemSimples(nota, DefinicoesTemporarias.DateTimeNow); } } } }
protected override void OnNavigatedTo(NavigationEventArgs e) { Controle = (IControleView)e.Parameter; using (var repo = new BaseGeral.Repositorio.Leitura()) { var(emitidas, outras, canceladas) = repo.ObterNotas( DefinicoesTemporarias.EmitenteAtivo.CNPJ, Controle.IsNFCe); NotasEmitidas = emitidas.GerarObs(); OutrasNotas = outras.GerarObs(); NotasCanceladas = canceladas.GerarObs(); } }
public ControllerVendedores() : base("Inativar", DefinicoesPermanentes.ModoBuscaVendedor) { using (var repo = new BaseGeral.Repositorio.Leitura()) { TodosItens = repo.ObterVendedores() .Select(x => new ExibicaoEspecifica <Vendedor>( x, ExtensoesPrincipal.AplicarMáscaraDocumento(x.CPFStr), null, x.Nome)) .ToArray(); Itens = TodosItens.GerarObs(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { isNFCe = e.Parameter != null ? (bool)e.Parameter : false; using (var repo = new BaseGeral.Repositorio.Leitura()) { Lista = (from imp in repo.ObterInutilizacoes(isNFCe) group imp by imp.Homologacao ? "Homologação" : "Produção").GerarObs(); Itens = new CollectionViewSource() { IsSourceGrouped = true, Source = Lista }.View; } }
public ObservableCollection <ExibicaoProdutoListaGeral> ObterProdutosIniciais() { using (var leitura = new BaseGeral.Repositorio.Leitura()) return((from prod in Venda.Produtos let comp = leitura.ObterProduto(prod.IdBase) select new ExibicaoProdutoListaGeral { Id = comp.Id, Codigo = comp.CodigoProduto, Descricao = comp.Descricao, Quantidade = prod.Quantidade.ToString("N2"), ValorUnitario = prod.ValorUnitario.ToString("C"), TotalLiquidoD = prod.TotalLíquido }).GerarObs()); }
void GerarRelatorio(object sender, RoutedEventArgs e) { var produtos = new Dictionary <ParCategoriaFornecedor, List <ExibicaoProduto> >(); using (var leitura = new BaseGeral.Repositorio.Leitura()) { foreach (var prod in leitura.ObterProdutos().ToArray()) { if (prod.IdCategoria == Guid.Empty && !InserirProdutosSemCategoria || prod.IdFornecedor == Guid.Empty && !InserirProdutosSemFornecedor) { continue; } var estoque = leitura.ObterEstoque(prod.Id); var exib = new ExibicaoProduto(prod, estoque?.Alteracoes.Sum(x => x.Alteração) ?? double.NaN); var categoria = CategoriasEscolhidas.FirstOrDefault(x => x.Id == prod.IdCategoria); if ((prod.IdCategoria != default(Guid) && categoria == null) || (prod.IdCategoria == default(Guid) && !InserirProdutosSemCategoria)) { continue; } var fornecedor = FornecedoresEscolhidos.FirstOrDefault(x => x.Id == prod.IdFornecedor); if ((prod.IdFornecedor != default(Guid) && fornecedor == null) || (prod.IdFornecedor == default(Guid) && !InserirProdutosSemFornecedor)) { continue; } var key = new ParCategoriaFornecedor(categoria, fornecedor); if (produtos.ContainsKey(key)) { produtos[key].Add(exib); } else { produtos.Add(key, new List <ExibicaoProduto> { exib }); } } } if (produtos.Count == 0) { Popup.Current.Escrever(TitulosComuns.Atenção, "Não há nenhum produto que corresponda aos critérios especificados."); return; } BasicMainPage.Current.Navegar <ImpressaoRelatorioProduto01>(produtos); }
void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { ProdutoDI[] produtos; using (var leitor = new BaseGeral.Repositorio.Leitura()) produtos = leitor.ObterProdutos().ToArray(); using (var escritor = new BaseGeral.Repositorio.Escrita()) for (int i = 0; i < produtos.Length; i++) { bool fornVazio = produtos[i].IdFornecedor == default(Guid); if (produtos[i].IdCategoria == Categoria.Id && (fornVazio || AlterarTodosProdutos)) { produtos[i].IdFornecedor = Escolhido.Id; escritor.SalvarItemSimples(produtos[i], DefinicoesTemporarias.DateTimeNow); } } }
async void ControlarEstoque(object sender, RoutedEventArgs e) { if (VerificarClassificacaoEmUso()) { return; } var contexto = ((FrameworkElement)sender).DataContext; var produto = (ProdutoDI)contexto; Estoque estoque = null; using (var leit = new BaseGeral.Repositorio.Leitura()) { estoque = leit.ObterEstoque(produto.Id); } if (estoque == null) { using (var repo = new BaseGeral.Repositorio.Escrita()) { var caixa = new MessageDialog("Essa é uma operação sem volta, uma vez adicionado ao controle de estoque este produto será permanentemente parte dele. Certeza que você realmente quer isso?", "Atenção"); caixa.Commands.Add(new UICommand("Sim", x => { estoque = new Estoque() { Id = produto.Id }; repo.SalvarItemSimples(estoque, DefinicoesTemporarias.DateTimeNow); repo.SalvarComTotalCerteza(); })); caixa.Commands.Add(new UICommand("Não")); if ((await caixa.ShowAsync()).Label == "Não") { return; } } BasicMainPage.Current.Navegar <ControleEstoque>(estoque); } else { BasicMainPage.Current.Navegar <ControleEstoque>(estoque); } }
void AjustarBackground() { MainPage current = MainPage.Current; switch (DefinicoesPermanentes.TipoBackground) { case TiposBackground.Imagem: if (DefinicoesPermanentes.IDBackgroung != default(Guid)) { using (var repo = new BaseGeral.Repositorio.Leitura()) current.ImagemBackground = repo .ProcurarImagem(DefinicoesPermanentes.IDBackgroung)? .Bytes?.GetSource(); } MainPage.Current.DefinirTipoBackground(TiposBackground.Imagem); MainPage.Current.DefinirOpacidadeBackground(DefinicoesPermanentes.OpacidadeBackground); break; case TiposBackground.Cor: current.DefinirTipoBackground(TiposBackground.Cor); current.DefinirOpacidadeBackground(DefinicoesPermanentes.OpacidadeBackground); break; } }
public override async Task Transmitir() { Progresso progresso = null; progresso = new Progresso(async() => { var retTransmissao = await ConsultarRespostaInicial(true); await progresso.Update(1); var status = retTransmissao.StatusResposta; if (status == 103 || status == 104) { if (status == 103) { var tempoResposta = retTransmissao.DadosRecibo.TempoMedioResposta; await Task.Delay(TimeSpan.FromSeconds(tempoResposta + 5)); } await progresso.Update(2); bool homologacao; try { homologacao = ((NFe)ItemCompleto).AmbienteTestes; } catch (Exception e) { throw new AnaliseErro("Erro durante a obtenção do ambiente de testes.", e); } var resultadoResposta = await ConsultarRespostaFinal(retTransmissao, homologacao); await progresso.Update(3); var protocoloResposta = resultadoResposta.Protocolo?.InfProt; if (protocoloResposta?.cStat == 100) { var nfe = (NFe)ItemCompleto; ItemCompleto = new ProcessoNFe() { NFe = nfe, ProtNFe = resultadoResposta.Protocolo }; ItemBanco.Status = (int)StatusNota.Emitida; AtualizarDI(ItemCompleto); OnStatusChanged(StatusNota.Emitida); await progresso.Update(4); using (var opEx = new BaseGeral.Repositorio.OperacoesExtras()) { var rvVinculado = opEx.GetRVVinculado(nfe.Informacoes.Id); if (rvVinculado != null) { if (rvVinculado.Cancelado) { var dialog = new MessageDialog("Um registro de venda já cancelado está vinculado a esta nota fiscal, você ainda deseja aplicar as alterações no estoque?", "Aviso"); dialog.Commands.Add(new UICommand("Sim", x => AtualizarEstoques())); dialog.Commands.Add(new UICommand("Não")); await dialog.ShowAsync(); } else { var dialog = new MessageDialog("Um registro de venda válido está vinculado a esta nota fiscal, você ainda deseja aplicar as alterações no estoque?", "Aviso"); dialog.Commands.Add(new UICommand("Sim", x => AtualizarEstoques())); dialog.Commands.Add(new UICommand("Não")); await dialog.ShowAsync(); } } else { AtualizarEstoques(); } } void AtualizarEstoques() { var tpOp = nfe.Informacoes.identificacao.TipoOperacao; if (tpOp == 1 && DefinicoesPermanentes.ConfiguracoesEstoque.NFeS) { using (var leit = new BaseGeral.Repositorio.Leitura()) using (var escr = new BaseGeral.Repositorio.Escrita()) { escr.AtualizarEstoques(DefinicoesTemporarias.DateTimeNow, (from prod in nfe.Informacoes.produtos let orig = leit.ObterProduto(prod.Produto.CodigoProduto) where orig != null select(orig.Id, prod.Produto.QuantidadeComercializada * -1)).ToArray()); } } else if (tpOp == 0 && DefinicoesPermanentes.ConfiguracoesEstoque.NFeE) { using (var leit = new BaseGeral.Repositorio.Leitura()) using (var escr = new BaseGeral.Repositorio.Escrita()) { escr.AtualizarEstoques(DefinicoesTemporarias.DateTimeNow, (from prod in nfe.Informacoes.produtos let orig = leit.ObterProduto(prod.Produto.CodigoProduto) where orig != null select(orig.Id, prod.Produto.QuantidadeComercializada)).ToArray()); } } } return(true, protocoloResposta.xMotivo); } else if (protocoloResposta != null) { return(false, $"{protocoloResposta.cStat}: {protocoloResposta.xMotivo}"); } else { return(false, $"{resultadoResposta.StatusResposta}: {resultadoResposta.DescricaoResposta}"); } } else { return(false, $"{retTransmissao.StatusResposta}: {retTransmissao.DescricaoResposta}"); } }, "Processar e enviar requisição inicial", "Aguardar tempo médio de resposta", "Processar e enviar requisição final", "Processar e analisar resposta final"); progresso.Start(); await progresso.ShowAsync(); }
public async Task <bool> Cancelar(NFeDI nota) { bool retorno = true; var processo = XElement.Parse(nota.XML).FromXElement <ProcessoNFCe>(); var informacoes = processo.NFe.Informacoes; var protNFe = processo.ProtNFe; var estado = informacoes.identificacao.CódigoUF; var cnpj = informacoes.Emitente.CNPJ; var chave = informacoes.ChaveAcesso; var tipoAmbiente = protNFe.InfProt.tpAmb; var nProtocolo = protNFe.InfProt.nProt; var entrada = new CancelarNFe(); if (await entrada.ShowAsync() == ContentDialogResult.Primary) { var infoEvento = new InformacoesEvento(estado, cnpj, chave, nProtocolo, entrada.Motivo, tipoAmbiente); var envio = new EnvEvento(infoEvento); AssinaFacil assinador = new AssinaFacil(); var gerenciador = new GerenciadorGeral <EnvEvento, RetEnvEvento>(estado, Operacoes.RecepcaoEvento, tipoAmbiente == 2, true); Progresso progresso = null; progresso = new Progresso(async x => { var cert = (X509Certificate2)x; var resultado = await envio.PrepararEventos(assinador, cert); if (!resultado.Item1) { retorno = resultado.Item1; return(resultado); } await progresso.Update(1); var resposta = await gerenciador.EnviarAsync(envio); if (resposta.ResultadorEventos[0].InfEvento.CStat == 135) { using (var repo = new BaseGeral.Repositorio.Escrita()) { var xml = new ProcEventoCancelamento() { Eventos = envio.Eventos, RetEvento = resposta.ResultadorEventos, Versao = resposta.Versao }.ToXElement <ProcEventoCancelamento>(); repo.SalvarItemSimples(new RegistroCancelamento() { ChaveNFe = chave, DataHoraEvento = resposta.ResultadorEventos[0].InfEvento.DhRegEvento, TipoAmbiente = tipoAmbiente, XML = xml.ToString() }, DefinicoesTemporarias.DateTimeNow); nota.Status = (int)StatusNota.Cancelada; repo.SalvarItemSimples(nota, DefinicoesTemporarias.DateTimeNow); await progresso.Update(6); using (var opEx = new BaseGeral.Repositorio.OperacoesExtras()) { var rvVinculado = opEx.GetRVVinculado(informacoes.Id); if (rvVinculado != null) { if (rvVinculado.Cancelado) { var dialog = new MessageDialog("Um registro de venda já cancelado está vinculado a esta nota fiscal, você ainda deseja aplicar as alterações no estoque?", "Aviso"); dialog.Commands.Add(new UICommand("Sim", y => AtualizarEstoques())); dialog.Commands.Add(new UICommand("Não")); await dialog.ShowAsync(); } else { var dialog = new MessageDialog("Um registro de venda válido está vinculado a esta nota fiscal, você ainda deseja aplicar as alterações no estoque?", "Aviso"); dialog.Commands.Add(new UICommand("Sim", y => AtualizarEstoques())); dialog.Commands.Add(new UICommand("Não")); await dialog.ShowAsync(); dialog = new MessageDialog("Esta nota foi cancelada com sucesso, você deseja também cancelar o registro de venda?", "Aviso"); dialog.Commands.Add(new UICommand("Sim", y => { using (var escr = new BaseGeral.Repositorio.Escrita()) { escr.CancelarRV(rvVinculado, new CancelamentoRegistroVenda() { Id = rvVinculado.Id, MomentoCancelamento = DefinicoesTemporarias.DateTimeNow, Motivo = "Cancelamento decorrente de cancelamento da nota fiscal correspondente." }, DefinicoesTemporarias.DateTimeNow); } })); dialog.Commands.Add(new UICommand("Não")); await dialog.ShowAsync(); } } else { AtualizarEstoques(); } } void AtualizarEstoques() { using (var leit = new BaseGeral.Repositorio.Leitura()) { repo.AtualizarEstoques(DefinicoesTemporarias.DateTimeNow, (from prod in informacoes.produtos let orig = leit.ObterProduto(prod.Produto.CodigoProduto) where orig != null select(orig.Id, prod.Produto.QuantidadeComercializada)).ToArray()); } } } retorno = true; return(true, "NFe cancelada com sucesso."); } else { retorno = false; return(false, resposta.ResultadorEventos[0].InfEvento.XMotivo); } }, assinador.CertificadosDisponiveis, "Subject", "Preparar eventos com assinatura do emitente", "Preparar conexão", "Obter conteúdo da requisição", "Enviar requisição", "Processar resposta", "Salvar registro de cancelamento no banco de dados"); gerenciador.ProgressChanged += async(x, y) => await progresso.Update(y + 1); await progresso.ShowAsync(); } return(retorno); }