Exemple #1
0
        private async void btnAprovar_Click(object sender, EventArgs e)
        {
            Acompanhamento acompanhamento = await HttpAcompanhamento.GetBySolicitacaoId(idSolicitacao, usuarioLogado.token);

            BloqueiaCampos();
            this.Cursor = Cursors.WaitCursor;
            if (await HttpEmail.EnviarEmail(data, idSolicitacao, usuarioLogado.token))
            {
                acompanhamento.StatusId = ConstantesProjeto.STATUS_ANEXAR_NF;
                var acompanhamentoUpdate = await HttpAcompanhamento.Update(acompanhamento, acompanhamento.Id, usuarioLogado.token);

                DesbloqueiaCampos();
                this.Cursor = Cursors.Arrow;
                MessageBox.Show("Envio de e-mail feito com sucesso");
                if (acompanhamentoUpdate != null)
                {
                    this.Dispose();
                    frmPrecadastroEmail.Dispose();
                    frmAreaCoordenacao.AtualizaGridSolicitacoes();
                }
            }
            else
            {
                MessageBox.Show("Erro ao enviar e-mail");
                this.Dispose();
            }
        }
Exemple #2
0
        private async Task <string> DowloadEmail(long idSolicitacao)
        {
            try
            {
                var file = await HttpEmail.DownloadEmail(data, idSolicitacao, usuarioLogado.token);

                string fileName       = "email" + DateTime.Now.ToString("yyyyMMddHHmm");
                string fileSavePcName = $@"{AppDomain.CurrentDomain.BaseDirectory}{fileName}";
                File.WriteAllBytes(fileSavePcName, file);
                return(fileSavePcName);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(null);
            }
        }