示例#1
0
        private async void Incluir()
        {
            var novoAluno   = new Aluno(Aluno.Nome, Aluno.Endereco, Aluno.Bairro, Aluno.Cidade);
            var alunoCriado = alunoService.Incluir(novoAluno);

            if (!alunoService.Validar)
            {
                var linq = alunoService.Notifications.Select(msg => msg.Mensagem);
                await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", linq));

                alunoService.ClearNotifications();
            }
            if (alunoCriado != null)
            {
                Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Incluindo dados do aluno. Aguarde...");

                Progresso.SetIndeterminate();
                var   t = Task.Factory.StartNew(() => { BuscarAlunos(); });
                await t;
                await Progresso?.CloseAsync();

                await this.dialog.ShowMessageAsync(this, "Atenção", "Aluno cadastrado com sucesso !!!");

                Limpar();
            }
        }
        private async void Inativar()
        {
            if (View != null && View.Id > 0)
            {
                var caixinhaDada = caixinhaService.ObterPorId(View.Id);
                if (caixinhaDada != null)
                {
                    var inativarCaixinha = await MessageBoxQuestion("Atenção!", "Deseja mesmo inativar esta caixinha para este(a) dealer <S/N>?");

                    if (inativarCaixinha)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Inativando registro de caixinha para dealer. Aguarde...");

                        Progresso.SetIndeterminate();
                        var   t = Task.Factory.StartNew(() => { caixinhaService.Inativar(View.Id, "Carlosg"); });
                        await t;
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Registro de caixinha para dealer inativado com sucesso !!!");

                        Limpar();
                    }
                }
                else
                {
                    await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", caixinhaDada.Notificacoes.Select(s => s.Mensagem)));

                    caixinhaService.LimparNotificacoes();
                }
            }
        }
示例#3
0
        private async void Inativar()
        {
            if (View != null && View.Id > 0)
            {
                var cursoExistente = cursoService.ObterPorId(View.Id);
                if (cursoExistente != null)
                {
                    Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Inativando curso. Aguarde...");

                    Progresso.SetIndeterminate();
                    var   t = Task.Factory.StartNew(() => { cursoService.Inativar(View.Id, "Carlosg"); });
                    await t;
                    await Progresso?.CloseAsync();

                    await this.dialog.ShowMessageAsync(this, "Atenção", "Curso inativado com sucesso !!!");

                    Limpar();
                    BuscarCursos();
                }
                else
                {
                    await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", cursoExistente.Notificacoes.Select(s => s.Mensagem)));

                    cursoService.LimparNotificacoes();
                }
            }
        }
        private async void Incluir()
        {
            Request.Id        = View.Id;
            Request.IdCliente = ClienteView.Id;
            Request.Data      = View.Data;
            Request.Valor     = View.Valor;
            var compraEfetuada = comprarFichaService.Incluir(Request, "Carlosg");

            if (!comprarFichaService.Validar)
            {
                var linq = comprarFichaService.Notificacoes.Select(msg => msg.Mensagem);
                await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", linq));

                comprarFichaService.LimparNotificacoes();
            }
            if (compraEfetuada != null)
            {
                Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Efetuando compra de fichas. Aguarde...");

                Progresso.SetIndeterminate();
                var   t = Task.Factory.StartNew(() => { Limpar(); });
                await t;
                await Progresso?.CloseAsync();

                await this.dialog.ShowMessageAsync(this, "Atenção", "Compra efetuada com sucesso !!!");

                //Limpar();
            }
        }
        private async void Inativar()
        {
            if (View != null && View.Id > 0)
            {
                var clienteExistente = clienteService.ObterPorId(View.Id);
                if (clienteExistente != null)
                {
                    var inativarCliente = await MessageBoxQuestion("Atenção!", "Deseja mesmo inativar este cliente <S/N>?");

                    if (inativarCliente)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Inativando cliente. Aguarde...");

                        Progresso.SetIndeterminate();
                        var   t = Task.Factory.StartNew(() => { clienteService.Inativar(View.Id, "Carlosg"); });
                        await t;
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Cliente inativado com sucesso !!!");

                        Limpar();
                        //BuscarClientes();
                    }
                }
                else
                {
                    await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", clienteExistente.Notificacoes.Select(s => s.Mensagem)));

                    clienteService.LimparNotificacoes();
                }
            }
        }
        private async void Incluir()
        {
            Request.Id       = View.Id;
            Request.Nome     = View.Nome;
            Request.Telefone = View.Telefone;
            var clienteCriado = clienteService.Incluir(Request, "Carlosg");

            if (!clienteService.Validar)
            {
                var linq = clienteService.Notificacoes.Select(msg => msg.Mensagem);
                await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", linq));

                clienteService.LimparNotificacoes();
            }
            if (clienteCriado != null)
            {
                Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Incluindo dados do cliente. Aguarde...");

                Progresso.SetIndeterminate();
                var   t = Task.Factory.StartNew(() => { Limpar(); });
                await t;
                await Progresso?.CloseAsync();

                await this.dialog.ShowMessageAsync(this, "Atenção", "Cliente cadastrado com sucesso !!!");

                //Limpar();
            }
        }
        private async void Alterar()
        {
            if (View != null && View.Id > 0)
            {
                var clienteExistente = clienteService.ObterPorId(View.Id);
                if (clienteExistente != null)
                {
                    Request.Id       = View.Id;
                    Request.Telefone = View.Telefone;
                    clienteExistente = clienteService.Alterar(Request, "Carlosg");
                    if (clienteService.Validar)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Alterando dados do cliente. Aguarde...");

                        Progresso.SetIndeterminate();
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Cliente alterado com sucesso !!!");

                        Limpar();
                    }
                    else
                    {
                        await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", clienteService.Notificacoes.Select(s => s.Mensagem)));

                        clienteService.LimparNotificacoes();
                        BuscarClientes();
                    }
                }
            }
        }
示例#8
0
        private async void Inativar()
        {
            if (View != null && View.Id > 0)
            {
                var retiradaEfetuada = rakeService.ObterPorId(View.Id);
                if (retiradaEfetuada != null)
                {
                    var inativarRake = await MessageBoxQuestion("Atenção!", "Deseja mesmo inativar esta retirada de rake <S/N>?");

                    if (inativarRake)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Inativando a retirada de rake. Aguarde...");

                        Progresso.SetIndeterminate();
                        var   t = Task.Factory.StartNew(() => { rakeService.Inativar(View.Id, "Carlosg"); });
                        await t;
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Retirada de rake inativado com sucesso !!!");

                        Limpar();
                    }
                }
                else
                {
                    await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", retiradaEfetuada.Notificacoes.Select(s => s.Mensagem)));

                    rakeService.LimparNotificacoes();
                }
            }
        }
        public void CarregarListaDiretorios(Importar importar,
                                            DiretorioOrdem dirOrdem, List <Diretorio> listaDiretorio,
                                            IProgressoLog progressoLog)
        {
            Arquivo   arquivo;
            Diretorio diretorio;
            Progresso pb = new Progresso();

            arquivo            = new Arquivo();
            arquivo.Nome       = importar.RotuloRaiz;
            arquivo.Tamanho    = 0;
            arquivo.Modificado = DateTime.Now;
            arquivo.Atributos  = "[DIR]";

            diretorio = DiretorioBO.Instancia.atribuiDiretorio(
                importar.Aba, importar.CodDirRaiz,
                importar.NomeDirRaiz, "", true, listaDiretorio,
                arquivo, dirOrdem);

            listaDiretorio.Add(diretorio);
            pb.Log = importar.Caminho;

            DiretorioBO.Instancia.ImportarDiretorio(importar.Aba,
                                                    importar.CodDirRaiz, importar.NomeDirRaiz,
                                                    importar.Caminho, listaDiretorio, dirOrdem, progressoLog);

            if (progressoLog != null)
            {
                progressoLog.ProgressoLog(pb);
            }
        }
示例#10
0
        private async void Alterar()
        {
            if (View != null && View.Id > 0)
            {
                var alimentoExistente = alimentoService.ObterPorId(View.Id);
                if (alimentoExistente != null)
                {
                    Request.Id          = View.Id;
                    Request.Peso        = View.Peso;
                    Request.Proteina    = View.Proteina;
                    Request.Carboidrato = View.Carboidrato;
                    Request.Gordura     = View.Gordura;
                    Request.Caloria     = View.Caloria;
                    alimentoExistente   = alimentoService.Alterar(Request, "Carlosg");
                    if (alimentoService.Validar)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Alterando dados do alimento. Aguarde...");

                        Progresso.SetIndeterminate();
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Alimento alterado com sucesso !!!");

                        Limpar();
                    }
                    else
                    {
                        await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", alimentoService.Notificacoes.Select(s => s.Mensagem)));

                        alimentoService.LimparNotificacoes();
                    }
                    BuscarAlimentos();
                }
            }
        }
示例#11
0
        private async void Excluir()
        {
            if (Aluno != null && Aluno.Id > 0)
            {
                var alunoExistente = alunoService.ObterPorId(Aluno.Id);
                if (alunoExistente.Validar)
                {
                    Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Excluindo dados do aluno. Aguarde...");

                    Progresso.SetIndeterminate();
                    var   t = Task.Factory.StartNew(() => { alunoService.Excluir(alunoExistente.Id); });
                    await t;
                    await Progresso?.CloseAsync();

                    await this.dialog.ShowMessageAsync(this, "Atenção", "Aluno excluído com sucesso !!!");

                    Limpar();
                    BuscarAlunos();
                }
                else
                {
                    await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", alunoExistente.Notifications.Select(s => s.Mensagem)));

                    alunoService.ClearNotifications();
                }
            }
        }
        private async void Incluir()
        {
            Request.Id       = View.Id;
            Request.IdDealer = DealerView.Id;
            Request.Data     = View.Data;
            Request.Valor    = View.Valor;
            var caixinhaDada = caixinhaService.Incluir(Request, "Carlosg");

            if (!caixinhaService.Validar)
            {
                var linq = caixinhaService.Notificacoes.Select(msg => msg.Mensagem);
                await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", linq));

                caixinhaService.LimparNotificacoes();
            }
            if (caixinhaDada != null)
            {
                Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Registrando caixinha para dealer. Aguarde...");

                Progresso.SetIndeterminate();
                var   t = Task.Factory.StartNew(() => { Limpar(); });
                await t;
                await Progresso?.CloseAsync();

                await this.dialog.ShowMessageAsync(this, "Atenção", "Caixinha para dealer registrada com sucesso !!!");

                //Limpar();
            }
        }
        public void ProgressoLog(Progresso progresso)
        {
            /*
             * if (progresso.Posicao == 0) {
             *      this.form.PBar.Minimum = progresso.Minimo;
             *      this.form.PBar.Maximum = progresso.Maximo;
             *      this.form.PBar.PulseStep = progresso.Passo;
             * }
             */
            if (progresso.Maximo > 0)
            {
                this.form.PBar.Fraction = Rotinas.calculaProgresso(progresso.Maximo, progresso.Posicao);
            }

            if (progresso.Log.Length > 0)
            {
                int pos = form.MemoImportaDir.Buffer.LineCount;
                titer = form.MemoImportaDir.Buffer.GetIterAtLine(pos);
                form.MemoImportaDir.Buffer.Insert(ref titer, progresso.Log + "\n");
                form.MemoImportaDir.ScrollToIter(titer, 0, false, 0, 0);
                form.LabStatus2.Text = Convert.ToString(pos);
            }

            while (Application.EventsPending())
            {
                Application.RunIteration();
            }
        }
        private async void Alterar()
        {
            if (View != null && View.Id > 0)
            {
                var pagtoEfetuado = pagtoJogadorService.ObterPorId(View.Id);
                if (pagtoEfetuado != null)
                {
                    Request.Id    = View.Id;
                    Request.Valor = View.Valor;
                    pagtoEfetuado = pagtoJogadorService.Alterar(Request, "Carlosg");
                    if (pagtoJogadorService.Validar)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Alterando dados do pagamento ao jogador. Aguarde...");

                        Progresso.SetIndeterminate();
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Pagamento ao jogador alterado com sucesso !!!");

                        Limpar();
                    }
                    else
                    {
                        await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", pagtoJogadorService.Notificacoes.Select(s => s.Mensagem)));

                        pagtoJogadorService.LimparNotificacoes();
                        BuscarPagamentos();
                    }
                }
            }
        }
        private async void Inativar()
        {
            if (View != null && View.Id > 0)
            {
                var pagtoEfetuado = pagtoJogadorService.ObterPorId(View.Id);
                if (pagtoEfetuado != null)
                {
                    var inativarPagto = await MessageBoxQuestion("Atenção!", "Deseja mesmo inativar este pagamento ao jogador <S/N>?");

                    if (inativarPagto)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Inativando o pagamento ao jogador. Aguarde...");

                        Progresso.SetIndeterminate();
                        var   t = Task.Factory.StartNew(() => { pagtoJogadorService.Inativar(View.Id, "Carlosg"); });
                        await t;
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Pagamento ao jogador inativado com sucesso !!!");

                        Limpar();
                    }
                }
                else
                {
                    await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", pagtoEfetuado.Notificacoes.Select(s => s.Mensagem)));

                    pagtoJogadorService.LimparNotificacoes();
                }
            }
        }
        private async void Alterar()
        {
            if (View != null && View.Id > 0)
            {
                var caixinhaDada = caixinhaService.ObterPorId(View.Id);
                if (caixinhaDada != null)
                {
                    Request.Id    = View.Id;
                    Request.Valor = View.Valor;
                    caixinhaDada  = caixinhaService.Alterar(Request, "Carlosg");
                    if (caixinhaService.Validar)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Alterando registro de caixinha para dealer. Aguarde...");

                        Progresso.SetIndeterminate();
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Registro de caixinha para dealer alterado com sucesso !!!");

                        Limpar();
                    }
                    else
                    {
                        await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", caixinhaService.Notificacoes.Select(s => s.Mensagem)));

                        caixinhaService.LimparNotificacoes();
                        BuscarCaixinhas();
                    }
                }
            }
        }
示例#17
0
        public void salvarDiretorio(List <Diretorio> listaDiretorio,
                                    IProgressoLog progressoLog)
        {
            Diretorio diretorio;
            Progresso pb = new Progresso();

            pb.Minimo  = 0;
            pb.Maximo  = listaDiretorio.Count - 1;
            pb.Posicao = 0;
            pb.Passo   = 1;

            try {
                for (int i = 0; i < listaDiretorio.Count; i++)
                {
                    diretorio = listaDiretorio[i];

                    DiretorioDAO.Instancia.incluir(diretorio);
                    pb.Log = (i + 1) + " - Salvando Diretório: "
                             + diretorio.Caminho;

                    pb.Posicao = i;

                    if (progressoLog != null)
                    {
                        progressoLog.ProgressoLog(pb);
                    }
                }
            } catch (Exception) {
                throw;
            }
        }
示例#18
0
        private async void Incluir()
        {
            Request.Alimento    = View.Alimento;
            Request.Peso        = View.Peso;
            Request.Proteina    = View.Proteina;
            Request.Carboidrato = View.Carboidrato;
            Request.Gordura     = View.Gordura;
            Request.Caloria     = View.Caloria;
            var alimentoCriado = alimentoService.Incluir(Request, "Carlosg");

            if (!alimentoService.Validar)
            {
                var linq = alimentoService.Notificacoes.Select(msg => msg.Mensagem);
                await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", linq));

                alimentoService.LimparNotificacoes();
            }
            if (alimentoCriado != null)
            {
                Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Incluindo dados do alimento. Aguarde...");

                Progresso.SetIndeterminate();
                var   t = Task.Factory.StartNew(() => { BuscarAlimentos(); });
                await t;
                await Progresso?.CloseAsync();

                await this.dialog.ShowMessageAsync(this, "Atenção", "Alimento cadastrado com sucesso !!!");

                Limpar();
            }
        }
示例#19
0
        public override async Task Assinar()
        {
            var nfe = (NFe)ItemCompleto;

            try
            {
                var assina = new Fiscal.Certificacao.AssinaFacil()
                {
                    Nota = nfe
                };
                Progresso progresso = null;
                progresso = new Progresso(async x =>
                {
                    var cert   = (X509Certificate2)x;
                    var result = await assina.Assinar <NFe>(cert, nfe.Informacoes.Id, "infNFe");
                    if (result.Item1)
                    {
                        ItemBanco.Status = (int)StatusNota.Assinada;
                        AtualizarDI(ItemCompleto);
                        OnStatusChanged(StatusNota.Assinada);
                    }
                    return(result);
                }, assina.CertificadosDisponiveis, "Subject", Fiscal.Certificacao.AssinaFacil.Etapas);
                assina.ProgressChanged += async(x, y) => await progresso.Update(y);

                await progresso.ShowAsync();
            }
            catch (Exception erro)
            {
                erro.ManipularErro();
            }
        }
示例#20
0
        private async void Incluir()
        {
            Request.Descricao    = View.Descricao;
            Request.CargaHoraria = View.CargaHoraria;
            Request.Valor        = View.Valor;
            var cursoCriado = cursoService.Incluir(Request, "Carlosg");

            if (!cursoService.Validar)
            {
                var linq = cursoService.Notificacoes.Select(msg => msg.Mensagem);
                await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", linq));

                cursoService.LimparNotificacoes();
            }
            if (cursoCriado != null)
            {
                Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Incluindo dados do curso. Aguarde...");

                Progresso.SetIndeterminate();
                var   t = Task.Factory.StartNew(() => { BuscarCursos(); });
                await t;
                await Progresso?.CloseAsync();

                await this.dialog.ShowMessageAsync(this, "Atenção", "Curso cadastrado com sucesso !!!");

                Limpar();
            }
        }
示例#21
0
        private async void Alterar()
        {
            if (View != null && View.Id > 0)
            {
                var retiradaEfetuada = rakeService.ObterPorId(View.Id);
                if (retiradaEfetuada != null)
                {
                    Request.Id       = View.Id;
                    Request.Valor    = View.Valor;
                    retiradaEfetuada = rakeService.Alterar(Request, "Carlosg");
                    if (rakeService.Validar)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Alterando dados da retirada de rake. Aguarde...");

                        Progresso.SetIndeterminate();
                        await Progresso?.CloseAsync();

                        await this.dialog.ShowMessageAsync(this, "Atenção", "Retirada de rake alterada com sucesso !!!");

                        Limpar();
                    }
                    else
                    {
                        await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", rakeService.Notificacoes.Select(s => s.Mensagem)));

                        rakeService.LimparNotificacoes();
                        BuscarRakes();
                    }
                }
            }
        }
示例#22
0
 public Pacote(Cliente remetente, Cliente destinatario, Progresso status, Envio tipo)
 {
     Iniciar();
     Remetente    = remetente;
     Destinatario = destinatario;
     Status       = status;
     Tipo         = tipo;
 }
 public void ProgressoLog(Progresso progresso)
 {
     if (progresso.Posicao == 0)
     {
         this.form.pb.Minimum = progresso.Minimo;
         this.form.pb.Maximum = progresso.Maximo;
         this.form.pb.Step    = progresso.Passo;
     }
     this.form.pb.Value = progresso.Posicao;
 }
示例#24
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private static Thread CarregaProgressoThread()
        {
            var progress = new Progresso();
            var t        = new Thread(progress.ShowDiag);

            t.Start();
            while (progress.Started)
            {
            }
            return(t);
        }
 public void ProgressoLog(Progresso progresso)
 {
     /*
      * if (progresso.Posicao == 0) {
      *      this.form.PBar.Minimum = progresso.Minimo;
      *      this.form.PBar.Maximum = progresso.Maximo;
      *      this.form.PBar.PulseStep = progresso.Passo;
      * }
      */
     this.form.PBar.Fraction = Rotinas.calculaProgresso(progresso.Maximo, progresso.Posicao);
 }
示例#26
0
        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);
                    }
                }
            }
        }
示例#27
0
        public override int GetHashCode()
        {
            var hashCode = 1389737090;

            hashCode = hashCode * -1521134295 + base.GetHashCode();
            hashCode = hashCode * -1521134295 + CodMeta.GetHashCode();
            hashCode = hashCode * -1521134295 + Progresso.GetHashCode();
            hashCode = hashCode * -1521134295 + Recompensa.GetHashCode();
            hashCode = hashCode * -1521134295 + GitcoinsObtidos.GetHashCode();
            hashCode = hashCode * -1521134295 + TarefasCompletas.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(UltimaInteracao);

            return(hashCode);
        }
 public void ProgressoLog(Progresso progresso)
 {
     /*
      * if (progresso.Posicao == 0) {
      *      this.form.PBar.Minimum = progresso.Minimo;
      *      this.form.PBar.Maximum = progresso.Maximo;
      *      this.form.PBar.PulseStep = progresso.Passo;
      * }
      */
     this.form.PBar.Fraction = Rotinas.calculaProgresso(progresso.Maximo, progresso.Posicao);
     while (Application.EventsPending())
     {
         Application.RunIteration();
     }
 }
示例#29
0
        async void AdicionarInutilizacao(object sender, RoutedEventArgs e)
        {
            var caixa = new InfoInutilizacao();

            if (await caixa.ShowAsync() == ContentDialogResult.Primary)
            {
                var envio = new InutNFe(new InfInut(caixa.Homologacao, caixa.Serie, caixa.InicioNum, caixa.FimNum, caixa.Justificativa));

                var uf          = DefinicoesTemporarias.EmitenteAtivo.SiglaUF;
                var gerenciador = new GerenciadorGeral <InutNFe, RetInutNFe>(uf, Operacoes.Inutilizacao, caixa.Homologacao, isNFCe);

                AssinaFacil assinador = new AssinaFacil();
                Progresso   progresso = null;
                progresso = new Progresso(async x =>
                {
                    var cert         = (X509Certificate2)x;
                    var resultAssina = await envio.PrepararEvento(assinador, cert);
                    if (!resultAssina.Item1)
                    {
                        return(resultAssina);
                    }
                    await progresso.Update(1);

                    var resultado = await gerenciador.EnviarAsync(envio);
                    var sucesso   = resultado.Info.StatusResposta == 102;
                    if (sucesso)
                    {
                        Concluir(resultado, caixa.Homologacao);
                        await progresso.Update(6);
                    }
                    return(sucesso, resultado.Info.DescricaoResposta);
                }, assinador.CertificadosDisponiveis, "Subject",
                                          "Assinar documentos para envio",
                                          "Preparar conexão",
                                          "Obter conteúdo da requisição",
                                          "Enviar requisição",
                                          "Processar resposta",
                                          "Salvar retorno no banco de dados");
                gerenciador.ProgressChanged += async(x, y) => await progresso.Update(y + 1);

                await progresso.ShowAsync();
            }
        }
        public void ProgressoLog(Progresso progresso)
        {
            if (progresso.Posicao == 0)
            {
                this.form.pbImportar.Minimum = progresso.Minimo;
                this.form.pbImportar.Maximum = progresso.Maximo;
                this.form.pbImportar.Step    = progresso.Passo;
            }
            this.form.pbImportar.Value = progresso.Posicao;

            if (progresso.Log.Length > 0)
            {
                int pos = form.memoImportaDir.TextLength;
                form.memoImportaDir.AppendText(progresso.Log + "\n");
                form.memoImportaDir.Select(pos, pos);
                form.barraStatus.Items[1].Text = Convert.ToString(pos);
                form.barraStatus.Update();
            }
        }