Example #1
0
        protected void btnInformarPagamento_Click(object sender, EventArgs e)
        {
            if (this.InformouPagamento != null)
            {
                UsuarioPagamento usuarioPagamento = null;

                try
                {
                    usuarioPagamento = this.ObterObjetoUsuarioPagamento();
                    ManterUsuarioPagamento manterUsuarioPagamento = new ManterUsuarioPagamento();;
                    manterUsuarioPagamento.SalvarInformacoesDePagamento(usuarioPagamento);
                }
                catch (AcademicoException ex)
                {
                    WebFormHelper.ExibirMensagem(enumTipoMensagem.Erro, ex.Message);
                    return;
                }

                this.IdUsuario = usuarioPagamento.Usuario.ID;

                InformouPagamento(this, new InformarPagamentoEventArgs(this.IdUsuario));

                //(IList<ItemQuestionario>)this.QuestionarioDaSessao.ListaItemQuestionario));
                //this.IdLogicoDoItemQuestionario = 0;
                ////ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myscript", " $('#EdicaoNivel, #modal-background').removeClass('active');", true);
                //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "myscript", " $('#ModalQuestionario').modal('hide');", true);
                //return;
            }
        }
Example #2
0
        protected void dgvHistoricoDePagamento_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int idUsuarioPagamento = int.Parse(e.CommandArgument.ToString());

            if (e.CommandName.Equals("editar"))
            {
                try
                {
                    ucInformarPagamento1.IdUsuarioPagamento = idUsuarioPagamento;
                    UsuarioPagamento usuarioPagamento = new ManterUsuarioPagamento().ObterInformacoesDePagamentoPorID(idUsuarioPagamento);
                    ucInformarPagamento1.PrepararTelaParaEdicaoDeInformarPagamento(usuarioPagamento);
                    this.pnlUcInformarPagamento.Visible = true;
                    this.ucInformarPagamento1.Visible   = true;
                }
                catch (AcademicoException ex)
                {
                    WebFormHelper.ExibirMensagem(enumTipoMensagem.Erro, ex.Message);
                }
            }
            else if (e.CommandName.Equals("linksitebb"))
            {
                try
                {
                    this.EnviaInformacoesParaSiteDoBancoDoBrasil(idUsuarioPagamento);
                }
                catch (AcademicoException ex)
                {
                    WebFormHelper.ExibirMensagem(enumTipoMensagem.Erro, ex.Message);
                }
            }
        }
Example #3
0
        private void CalcularDatas()
        {
            ManterUsuarioPagamento manterUsuarioPagamento = new ManterUsuarioPagamento();
            UsuarioPagamento       usuarioPagamento       = manterUsuarioPagamento.ObterInformacoesCalculadasDeConfiguracaoPagamento(int.Parse(ddlConfigPagto.SelectedItem.Value));

            this.txtFimVigencia.Text          = usuarioPagamento.DataFimVigenciaCalculada.ToShortDateString();
            this.TxtDtInicioRenovacao.Text    = usuarioPagamento.DataInicioRenovacaoCalculada.ToShortDateString();
            this.txtDataMaxInadimplencia.Text = usuarioPagamento.DataMaxInadimplenciaCalculada.ToShortDateString();
            this.TxtDtVencimento.Text         = usuarioPagamento.DataVencimentoCalculada.ToShortDateString();

            //this.txtFimVigencia.Text = configuracaoPagamento.DataInicioCompetencia.AddDays(configuracaoPagamento.QuantidadeDiasValidade).ToShortDateString();
        }
Example #4
0
 /// <summary>
 /// Esta rotina processa arquivos de cartão de débito do Banco do Brasil.
 /// </summary>
 protected void ProcessaRcb001()
 {
     try
     {
         ManterUsuarioPagamento manterUsuarioPagamento = new ManterUsuarioPagamento();
         manterUsuarioPagamento.ProcessarArquivoDeDebitoDoBancoDoBrasil(this.FileUpload1.PostedFile);
     }
     catch (AcademicoException ex)
     {
         WebFormHelper.ExibirMensagem(enumTipoMensagem.Alerta, ex.Message);
     }
     catch
     {
         WebFormHelper.ExibirMensagem(enumTipoMensagem.Alerta, "Erro no envio de e-mail ou tipo de arquivo inválido!");
     }
 }
Example #5
0
        protected void VisualizarDetalheDoPagamento_VisualizouDetalheDoPagamento(object sender, VisualizarDetalheDoPagamentoEventArgs e)
        {
            try
            {
                int idUsuarioPagamento = e.IdUsuarioPagamento;

                //Abre a tela com os detalhes do Pagamento
                //ucHistoricoPagamento1.Visible = false;
                ucInformarPagamento1.IdUsuarioPagamento = idUsuarioPagamento;
                classes.UsuarioPagamento usuarioPagamento = new ManterUsuarioPagamento().ObterInformacoesDePagamentoPorID(idUsuarioPagamento);
                ucInformarPagamento1.PrepararTelaParaEdicaoDeInformarPagamento(usuarioPagamento);
                this.pnlUcInformarPagamento.Visible = true;
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void CarregarInformacoesSobrePagamento()
        {
            try
            {
                if (IdUsuario > 0)
                {
                    Usuario usuario = new ManterUsuario().ObterUsuarioPorID(this.IdUsuario);

                    if (usuario != null)
                    {
                        IList <UsuarioPagamento> ListaUsuarioPagamento = new ManterUsuarioPagamento().ObterInformacoesDePagamentoDoUsuario(this.IdUsuario);
                        WebFormHelper.PreencherGrid(ListaUsuarioPagamento, dgvInformacoesDeHistoricoDePagamento);
                    }
                }
            }
            catch (AcademicoException ex)
            {
                WebFormHelper.ExibirMensagem(enumTipoMensagem.Erro, ex.Message);
            }
        }
Example #7
0
        public UsuarioPagamento ObterObjetoUsuarioPagamento()
        {
            UsuarioPagamento usuarioPagamento = null;

            //Cadastro de um novo pagamento
            if (AcaoDaTela.Equals((int)enumAcaoTelaCadastroDeInformarPagamento.NovoPagamento))
            {
                usuarioPagamento         = new Dominio.Classes.UsuarioPagamento();
                usuarioPagamento.Usuario = new ManterUsuario().ObterUsuarioPorID(this.IdUsuario);
            }
            else if (AcaoDaTela.Equals((int)enumAcaoTelaCadastroDeInformarPagamento.EdicaoDePagamento))
            {
                usuarioPagamento = new ManterUsuarioPagamento().ObterInformacoesDePagamentoPorID(this.IdUsuarioPagamento);
            }

            if (!string.IsNullOrWhiteSpace(this.DdlInPago.SelectedItem.Value))
            {
                string foiPago = this.DdlInPago.SelectedItem.Value;

                if (foiPago.ToUpper().Equals("S"))
                {
                    usuarioPagamento.PagamentoEfetuado = true;
                }
                else if (foiPago.ToUpper().Equals("N"))
                {
                    usuarioPagamento.PagamentoEfetuado = false;
                }
            }

            if (!string.IsNullOrWhiteSpace(this.DdlFormaPagamento.SelectedItem.Value))
            {
                int formaPagamento = int.Parse(this.DdlFormaPagamento.SelectedItem.Value.ToString());
                usuarioPagamento.FormaPagamento = (enumFormaPagamento)formaPagamento;
            }

            //Configuracao de Pagamento
            usuarioPagamento.ConfiguracaoPagamento = new ManterConfiguracaoPagamento().ObterConfiguracaoPagamentoPorId(int.Parse(ddlConfigPagto.SelectedItem.Value));

            //Data Inicio Vigencia
            if (!string.IsNullOrWhiteSpace(this.txtDataInicioVigencia.Text))
            {
                DateTime dataInicioVigenciaAux = DateTime.Now;

                if (!DateTime.TryParse(this.txtDataInicioVigencia.Text, out dataInicioVigenciaAux))
                {
                    throw new AcademicoException("Valor inválido para o Campo data Início Vigência");
                }
                else
                {
                    usuarioPagamento.DataInicioVigencia = dataInicioVigenciaAux;
                }
            }

            //Data Fim Vigencia
            if (!string.IsNullOrWhiteSpace(this.txtFimVigencia.Text))
            {
                DateTime dataFimVigenciaAux = DateTime.Now;

                if (!DateTime.TryParse(this.txtFimVigencia.Text, out dataFimVigenciaAux))
                {
                    throw new AcademicoException("Valor inválido para o Campo data Fim Vigência");
                }
                else
                {
                    usuarioPagamento.DataFimVigencia = dataFimVigenciaAux;
                }
            }

            //Valor
            if (!string.IsNullOrWhiteSpace(this.txtValor.Text))
            {
                Decimal valorPagamento = 0;
                if (!Decimal.TryParse(this.txtValor.Text, out valorPagamento))
                {
                    throw new AcademicoException("Valor inválido para o Campo Valor Pagamento");
                }
                else
                {
                    usuarioPagamento.ValorPagamento = valorPagamento;
                }
            }

            //Data Inicio Renovação
            if (!string.IsNullOrWhiteSpace(this.TxtDtInicioRenovacao.Text))
            {
                DateTime dataInicioRenovacaoAux = DateTime.Now;

                if (!DateTime.TryParse(this.TxtDtInicioRenovacao.Text.Trim(), out dataInicioRenovacaoAux))
                {
                    throw new AcademicoException("Valor inválido para o Campo Data de Início de Renovação");
                }
                else
                {
                    usuarioPagamento.DataInicioRenovacao = dataInicioRenovacaoAux;
                }
            }

            //Data Max Inadimplencia
            if (!string.IsNullOrWhiteSpace(this.txtDataMaxInadimplencia.Text))
            {
                DateTime dataMaxInadimplenciaAux = DateTime.Now;

                if (!DateTime.TryParse(this.txtDataMaxInadimplencia.Text, out dataMaxInadimplenciaAux))
                {
                    throw new AcademicoException("Valor inválido para o Campo Data Máxima de Inadimplência");
                }
                else
                {
                    usuarioPagamento.DataMaxInadimplencia = dataMaxInadimplenciaAux;
                }
            }

            if (!string.IsNullOrWhiteSpace(this.TxtDtVencimento.Text))
            {
                DateTime dataVencimentoAux = DateTime.Now;

                if (!DateTime.TryParse(this.TxtDtVencimento.Text, out dataVencimentoAux))
                {
                    throw new AcademicoException("Valor inválido para o Campo Data de Vencimento");
                }
                else
                {
                    usuarioPagamento.DataVencimento = dataVencimentoAux;
                }
            }

            //Codigo Informacao
            if (!string.IsNullOrWhiteSpace(this.TxtCodInformacao.Text))
            {
                usuarioPagamento.NossoNumero = this.TxtCodInformacao.Text.Trim();
            }

            //Data Inicio Vigencia
            if (!string.IsNullOrWhiteSpace(this.DtInicioVigencia))
            {
                DateTime dtInicioVigenciaAux = DateTime.Now;

                if (!DateTime.TryParse(this.DtInicioVigencia, out dtInicioVigenciaAux))
                {
                    throw new AcademicoException("Valor inválido para o Campo Data de Início de Vigência");
                }
                else
                {
                    usuarioPagamento.DataInicioVigencia = dtInicioVigenciaAux;
                }
            }

            //Data Fim Vigencia
            if (!string.IsNullOrWhiteSpace(this.DtFimVigencia))
            {
                DateTime dtFimVigenciaAux = DateTime.Now;

                if (!DateTime.TryParse(this.DtFimVigencia, out dtFimVigenciaAux))
                {
                    throw new AcademicoException("Valor inválido para o Campo Data Fim de Vigência");
                }
                else
                {
                    usuarioPagamento.DataFimVigencia = dtFimVigenciaAux;
                }
            }

            //Data Inicio Renovação
            if (!string.IsNullOrWhiteSpace(this.DtInicioRenovacao))
            {
                DateTime dtInicioRenovacaoAux = DateTime.Now;

                if (!DateTime.TryParse(this.TxtDtInicioRenovacao.Text, out dtInicioRenovacaoAux))
                {
                    throw new AcademicoException("Valor inválido para o Campo Data de início Renovação");
                }
                else
                {
                    usuarioPagamento.DataInicioRenovacao = dtInicioRenovacaoAux;
                }
            }

            return(usuarioPagamento);
        }
Example #8
0
        protected void botao_Click(object sender, EventArgs e)
        {
            string  dia                = null;
            string  mes                = null;
            string  ano                = null;
            string  linhacompleta      = null;
            string  identificacao      = null;
            string  datalote           = null;
            string  convenio           = null;
            decimal valorrecebido      = 0;
            string  datadocredito      = null;
            string  liquidacao         = null;
            string  RefTranNossoNumero = null;

            if (string.IsNullOrWhiteSpace(this.FileUpload1.PostedFile.FileName))
            {
                //this.Label1.Text = "Escolha um arquivo texto no botão acima.";
                //this.Label1.Visible = true;
                WebFormHelper.ExibirMensagem(enumTipoMensagem.Alerta, "Escolha um arquivo texto no botão acima.");
                return;
            }

            if (string.IsNullOrWhiteSpace(this.txtData2.Text))
            {
                //this.Label1.Text = "Entre com a data desejada para o processamento, normalmente será o dia anterior.";
                //this.Label1.Visible = true;
                WebFormHelper.ExibirMensagem(enumTipoMensagem.Alerta, "Escolha um arquivo texto no botão acima.");
                return;
            }

            this.txtData2.Text = this.txtData2.Text.Replace("/", "");
            this.txtData2.Text = this.txtData2.Text.Replace("-", "");

            //transforma a data para DDMMAA
            dia = this.txtData2.Text.Substring(1, 2);
            mes = this.txtData2.Text.Substring(3, 2);
            ano = this.txtData2.Text.Substring(5, 2);

            if (int.Parse(dia) > 31)
            {
                WebFormHelper.ExibirMensagem(enumTipoMensagem.Atencao, "Dia inválido");
                return;
            }
            if (int.Parse(mes) > 12)
            {
                WebFormHelper.ExibirMensagem(enumTipoMensagem.Atencao, "Mês inválido");
                return;
            }

            string ddmmaa = dia + mes + ano;

            string Planilha = FileUpload1.PostedFile.FileName;
            //utilizar a linha abaixo quando rodando em produção
            //string caminho = Server.MapPath("../universidadecorporativasebrae/xml/");
            //Utilizar a linha abaixo quando rodando no studio localmente
            string caminho = "C:\\temp\\sebrae\\";

            string strcaminho = caminho + Planilha;

            //Salvamos o mesmo
            FileUpload1.PostedFile.SaveAs(strcaminho);
            Planilha = strcaminho;

            string[] linhas = File.ReadAllLines(Planilha);
            //string[] linhas = File.ReadAllLines(Server.MapPath("../universidadecorporativasebrae/xml/cnab20131011.txt"));

            foreach (string linha in linhas)
            {
                linhacompleta = linha;
                identificacao = linhacompleta.Substring(1, 1);

                if (int.Parse(identificacao) == 0) //registro header
                {
                    datalote = linhacompleta.Substring(90, 6);
                    if (ddmmaa == datalote)
                    {
                        WebFormHelper.ExibirMensagem(enumTipoMensagem.Erro, "Data do arquivo não confere com a data entrada, nenhum registro processado.");
                        return;
                    }
                }
                else if (int.Parse(identificacao) == 9) //registro footer
                {
                    WebFormHelper.ExibirMensagem(enumTipoMensagem.Sucesso, "Arquivo processado com sucesso.");
                    return;
                }
                else
                {
                    convenio = linhacompleta.Substring(32, 7);
                    if (convenio == "2575011")
                    {
                        valorrecebido      = decimal.Parse(linhacompleta.Substring(254, 13));
                        datadocredito      = linhacompleta.Substring(176, 6);
                        liquidacao         = linhacompleta.Substring(109, 2);
                        RefTranNossoNumero = linhacompleta.Substring(64, 17);

                        if (liquidacao == "03" || liquidacao == "13")
                        {
                            //Houve problema com a liquidação - 03 = Comando recusado (Motivo indicado na posição 087/088), 13 = Abatimento Cancelado
                        }
                        else
                        {
                            if (!string.IsNullOrWhiteSpace(RefTranNossoNumero))
                            {
                                ManterUsuarioPagamento manterUsuarioPagamento = new ManterUsuarioPagamento();
                                manterUsuarioPagamento.AtualizarInformacoesDePagamento(RefTranNossoNumero);

                                //enviaremail
                            }
                        }
                    }
                }
            }
        }
        private void InformarPagamento(int idUsuario, String Nome, String Endereco, String Cidade, String Cep, Uf UF)
        {
            //throw new NotImplementedException();
            //Forma de passagem de parametros por "POST"

            {
                string   idconv      = "311620";
                string   qtdPontos   = "0";
                string   tpPagamento = "0";
                DateTime?DataVigencia;
                DateTime?DataMaxVigencia;
                DateTime?DataInicioRenovacao;
                DateTime?DataInicioVigencia;
                DateTime?DataFimVigencia;
                DateTime?DataMaxInadimplencia;
                string   Dia, Mes, Ano;
                int      dia, mes, ano;
                Uf       ufAlfaNumerica;

                string xscript = "document.forms[0].enctype='application/x-www-form-urlencoded'; document.forms[0].action='https://www16.bancodobrasil.com.br/site/mpag/';" + "document.forms[0].target='_blank';" + "document.forms[0].submit();" + "document.forms[0].action='GerenciadorPagamentoCnab643.aspx';" + "document.forms[0].target='_self';";

                ClientScript.RegisterHiddenField("idConv", idconv);
                ClientScript.RegisterHiddenField("refTran", this.ucInformarPagamento1.codInformacao.ToString());
                ClientScript.RegisterHiddenField("valor", this.ucInformarPagamento1.valor.ToString());
                ClientScript.RegisterHiddenField("qtdPontos", qtdPontos);

                DataMaxVigencia      = CommonHelper.TratarData(this.ucInformarPagamento1.DtMaxInadimplencia.ToString(), "Data Máxima de Inadimplência");
                DataInicioRenovacao  = CommonHelper.TratarData(this.ucInformarPagamento1.DtInicioRenovacao.ToString(), "Data Inicio Renovação");
                DataInicioVigencia   = CommonHelper.TratarData(this.ucInformarPagamento1.DtInicioVigencia.ToString(), "Data Início Vigência");
                DataFimVigencia      = CommonHelper.TratarData(this.ucInformarPagamento1.DtFimVigencia.ToString(), "Data Fim Vigência");
                DataMaxInadimplencia = CommonHelper.TratarData(this.ucInformarPagamento1.DtMaxInadimplencia.ToString(), "Data Max Inadimplência");

                DataVigencia = CommonHelper.TratarData(this.ucInformarPagamento1.DtInicioVigencia.ToString(), "Data de Início");
                dia          = Convert.ToDateTime(DataVigencia).Day;
                if (dia <= 9)
                {
                    Dia = "0" + dia;
                }
                else
                {
                    Dia = dia.ToString();
                }
                mes = Convert.ToDateTime(DataVigencia).Month;
                if (mes <= 9)
                {
                    Mes = "0" + mes;
                }
                else
                {
                    Mes = mes.ToString();
                }
                ano = Convert.ToDateTime(DataVigencia).Year;
                Ano = ano.ToString();
                ClientScript.RegisterHiddenField("dtVenc", Dia + Mes + Ano);
                ClientScript.RegisterHiddenField("tpPagamento", tpPagamento);
                ClientScript.RegisterHiddenField("urlRetorno", "http://www5.fgv.br/fgvonline/universidadecorporativasebrae/inicial.aspx");
                ClientScript.RegisterHiddenField("nome", Nome);
                ClientScript.RegisterHiddenField("endereco", Endereco);
                ClientScript.RegisterHiddenField("cidade", Cidade);

                //Pega a UF a partir do código da UF
                ManterUf manterUf = new ManterUf();
                ufAlfaNumerica = manterUf.ObterUfPorID(UF.ID);
                ClientScript.RegisterHiddenField("uf", ufAlfaNumerica.Sigla);

                ClientScript.RegisterHiddenField("cep", Cep);
                ClientScript.RegisterHiddenField("msgLoja", "");
                ClientScript.RegisterStartupScript(this.GetType(), "jsenviar", xscript, true);

                //Inserir aqui a gravação de um registro na tabela TB_UsuarioPagamento campos IN_Pago com 1 e DT_Pagamento
                ManterUsuarioPagamento   manterUsuarioPagamento = new ManterUsuarioPagamento();
                classes.UsuarioPagamento usuarioPagamento       = new UsuarioPagamento();

                //Cadastra dados dos pagamentos
                usuarioPagamento.Usuario = new ManterUsuario().ObterUsuarioPorID(idUsuario);
                usuarioPagamento.ConfiguracaoPagamento = new ManterConfiguracaoPagamento().ObterConfiguracaoPagamentoPorId(int.Parse(this.ddlConfigPagto.SelectedValue));
                usuarioPagamento.DataInicioVigencia    = DateTime.Parse(this.ucInformarPagamento1.DtInicioVigencia);
                usuarioPagamento.DataFimVigencia       = DateTime.Parse(this.ucInformarPagamento1.DtFimVigencia);
                usuarioPagamento.ValorPagamento        = decimal.Parse(this.ucInformarPagamento1.valor.ToString());
                usuarioPagamento.DataInicioRenovacao   = DateTime.Parse(this.ucInformarPagamento1.DtInicioRenovacao);
                usuarioPagamento.DataMaxInadimplencia  = DateTime.Now.AddDays(368);
                usuarioPagamento.NossoNumero           = this.ucInformarPagamento1.codInformacao.ToString();
                usuarioPagamento.PagamentoEfetuado     = false;
                usuarioPagamento.FormaPagamento        = this.ucInformarPagamento1.codFormaPagamento;
                manterUsuarioPagamento.IncluirUsuarioPagamento(usuarioPagamento);
            }
        }
        protected void ProcessaCBR643()
        {
            try
            {
                ManterUsuarioPagamento manterUsuarioPagamento = new ManterUsuarioPagamento();
                manterUsuarioPagamento.ProcessarArquivoDeDebitoDoBancoDoBrasilCBR643(this.FileUpload1.PostedFile, this.TxtData.Text);


                //string dia = null;
                //string mes = null;
                //string ano = null;
                //string linhacompleta = null;
                //string identificacao = null;
                //string datalote = null;
                //string convenio = null;
                //decimal valorrecebido = 0;
                //string datadocredito = null;
                //string liquidacao = null;
                //string RefTranNossoNumero = null;

                //if ((this.FileUpload1.PostedFile != null) &&
                //    string.IsNullOrWhiteSpace(this.FileUpload1.PostedFile.FileName))
                //{
                //    //this.Label1.Text = "Escolha um arquivo texto no botão acima.";
                //    //this.Label1.Visible = true;
                //    WebFormHelper.ExibirMensagem(enumTipoMensagem.Alerta, "Escolha um arquivo texto no botão acima.");
                //    return;
                //}

                //if (string.IsNullOrWhiteSpace(this.TxtData.Text))
                //{
                //    //this.Label1.Text = "Entre com a data desejada para o processamento, normalmente será o dia anterior.";
                //    //this.Label1.Visible = true;
                //    WebFormHelper.ExibirMensagem(enumTipoMensagem.Atencao, "Escolha um arquivo texto no botão acima.");
                //    return;
                //}

                //this.TxtData.Text = this.TxtData.Text.Replace("/", "");
                //this.TxtData.Text = this.TxtData.Text.Replace("-", "");

                //if (this.TxtData.Text.Length < 5)
                //{
                //    //Considerando que entrou dia e/ou mes sem o zero a esquerda, exemplo: 5/5/2013
                //    WebFormHelper.ExibirMensagem(enumTipoMensagem.Alerta, "Entre com a data no formato dd/mm/aaaa.");
                //    return;
                //}

                //dia = this.TxtData.Text.Substring(0, 2);
                //mes = this.TxtData.Text.Substring(2, 2);
                //ano = this.TxtData.Text.Substring(6, 2);

                //if (int.Parse(dia) > 31)
                //{
                //    WebFormHelper.ExibirMensagem(enumTipoMensagem.Atencao, "Dia inválido");
                //    return;
                //}
                //if (int.Parse(mes) > 12)
                //{
                //    WebFormHelper.ExibirMensagem(enumTipoMensagem.Atencao, "Mês inválido");
                //    return;
                //}

                //string ddmmaa = dia + mes + ano;

                //string Planilha = FileUpload1.PostedFile.FileName;
                ////utilizar a linha abaixo quando rodando em produção
                //string caminho = Server.MapPath("../universidadecorporativasebrae/xml/");
                ////Utilizar a linha abaixo quando rodando no studio localmente
                ////string caminho = "C:\\temp\\sebrae\\";

                //string strcaminho = caminho + Planilha;

                ////Salvamos o mesmo
                //FileUpload1.PostedFile.SaveAs(strcaminho);
                //Planilha = strcaminho;

                //string[] linhas = File.ReadAllLines(Planilha);
                ////string[] linhas = File.ReadAllLines(Server.MapPath("../universidadecorporativasebrae/xml/cnab20131011.txt"));

                //foreach (string linha in linhas)
                //{
                //    linhacompleta = linha;
                //    identificacao = linhacompleta.Substring(0, 1);

                //    if (int.Parse(identificacao) == 0) //registro header
                //    {
                //        datalote = linhacompleta.Substring(94, 6);
                //        if (ddmmaa != datalote)
                //        {
                //            WebFormHelper.ExibirMensagem(enumTipoMensagem.Erro, "Data do arquivo não confere com a data entrada, nenhum registro processado.");
                //            return;
                //        }
                //    }
                //    else if (int.Parse(identificacao) == 9) //registro footer
                //    {
                //        WebFormHelper.ExibirMensagem(enumTipoMensagem.Sucesso, "Arquivo processado com sucesso.");
                //        return;
                //    }
                //    else
                //    {
                //        convenio = linhacompleta.Substring(31, 7);
                //        if (convenio == "2575011")
                //        {
                //            valorrecebido = decimal.Parse(linhacompleta.Substring(253, 13));
                //            datadocredito = linhacompleta.Substring(175, 6);
                //            datadocredito = datadocredito.Substring(0, 2) + "/" + datadocredito.Substring(2, 2) + "/20" + datadocredito.Substring(4, 2);
                //            liquidacao = linhacompleta.Substring(108, 2);
                //            RefTranNossoNumero = linhacompleta.Substring(63, 17);

                //            if (liquidacao == "03" || liquidacao == "13")
                //            {
                //                //Houve problema com a liquidação - 03 = Comando recusado (Motivo indicado na posição 087/088), 13 = Abatimento Cancelado
                //            }
                //            else
                //            {
                //                if (!string.IsNullOrWhiteSpace(RefTranNossoNumero))
                //                {
                //                    manterUsuarioPagamento = new ManterUsuarioPagamento();
                //                    manterUsuarioPagamento.AtualizarInformacoesDePagamento(RefTranNossoNumero);

                //                    UsuarioPagamento usuarioPagamento = manterUsuarioPagamento.ObterInformacoesDePagamentoDoUsuarioNossoNumero(RefTranNossoNumero);

                //                    //Inserir aqui a gravação de um registro na tabela TB_UsuarioPagamento campos IN_Pago com 1 e DT_Pagamento
                //                    usuarioPagamento.DataPagamento = DateTime.Parse(datadocredito);
                //                    usuarioPagamento.ValorPagamento = valorrecebido;
                //                    manterUsuarioPagamento.IncluirUsuarioPagamento(usuarioPagamento);

                //                    //Envia e-mail para o usuário com o token
                //                    String texto;
                //                    texto = "ESTE É UM E-MAIL AUTOMÁTICO. FAVOR NÃO RESPONDER. \n";
                //                    texto += "Prezado(a) " + usuarioPagamento.Usuario.Nome + "\n";

                //                    texto += "Identificamos o recolhimento da Taxa, no valor de R$15,00, referente a sua participação em ações educacionais da Universidade corporativa Sebrae. \n";
                //                    texto += "Você deve acessar novamente o portal da UCSebrae e criar a sua senha de acesso. Em caso de dúvidas procure apoio no Fale conosco e no FAQ. \n";

                //                    texto += "A UCSebrae busca Promover ambiente de aprendizagem para o desenvolvimento de competências dos Colaboradores internos e externos, ";
                //                    texto += "contribuindo para o alcance dos resultados do SEBRAE junto aos Pequenos Negócios. Conte conosco em seu desenvolvimento para melhor atender ao empreendedor brasileiro! \n";

                //                    texto += "Atenciosamente,\n";
                //                    texto += "Universidade Corporativa Sebrae \n";

                //                    EmailFacade.Instancia.EnviarEmail(usuarioPagamento.Usuario.Email,
                //                                                      "Taxa de participação.",
                //                                                      texto);

                //                }

                //            }
                //        }
                //    }

                // }
            }
            catch
            {
                WebFormHelper.ExibirMensagem(enumTipoMensagem.Alerta, "Tipo de arquivo inválido ou erro no envio de e-mail!");
            }
        }
Example #11
0
        private void AtualizarGridComInformacoesDePagamento()
        {
            IList <UsuarioPagamento> ListaUsuarioPagamento = new ManterUsuarioPagamento().ObterInformacoesDePagamentoPorUsuario(this.IdUsuario);

            WebFormHelper.PreencherGrid(ListaUsuarioPagamento, this.dgvHistoricoDePagamento);
        }