Ejemplo n.º 1
0
    protected void BtnExtrato_Click(object sender, EventArgs e)
    {
        if (TxtAno.Text.Length != 4)
        {
            return;
        }

        GetConnection();

        try
        {
            string output_st_content_block = "";
            string output_vr_disp          = "";
            string output_vr_lim           = "";

            string pass = Session["pass"].ToString();
            string cnpj = Session["cnpj"].ToString();

            if (var_exchange.fetch_extratoWeb(cnpj + (CboMes.SelectedIndex + 1).ToString().PadLeft(2, '0') + TxtAno.Text,
                                              pass,
                                              ref output_st_content_block,
                                              ref output_vr_disp,
                                              ref output_vr_lim))
            {
                ArrayList values = new ArrayList();

                while (output_st_content_block != "")
                {
                    ArrayList tmp_memory = new ArrayList();

                    if (var_exchange.fetch_memory(output_st_content_block, "200",
                                                  ref output_st_content_block,
                                                  ref tmp_memory))
                    {
                        long vr_gasto = 0;

                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            Rel_RTC rtc = new Rel_RTC(tmp_memory[t] as DataPortable);

                            PositionData_ExtratoCartao bind = new PositionData_ExtratoCartao();

                            bind.nsu   = rtc.get_st_nsu();
                            bind.cart  = rtc.get_en_op_cartao();
                            bind.data  = var_util.getDDMMYYYY_format(rtc.get_dt_trans());
                            bind.loja  = rtc.get_st_loja();
                            bind.valor = new money().formatToMoney(rtc.get_vr_total());

                            vr_gasto += Convert.ToInt64(rtc.get_vr_total());

                            bind.parcela = rtc.get_st_indice_parcela() + " / " + rtc.get_st_term();

                            values.Add(bind);
                        }

                        LblTot.Text = "Total disponível: R$ " + new money().formatToMoney(output_vr_disp);

                        if (output_vr_lim == "")
                        {
                            LblLim.Visible = false;
                        }
                        else
                        {
                            LblLim.Text = "Limite mensal: R$ " + new money().formatToMoney(output_vr_lim);
                        }

                        LblGasto.Text = "Total de gastos: R$ " + new money().formatToMoney(vr_gasto.ToString());
                    }
                }

                string note = var_exchange.m_Client.GetServerMessage();

                var_exchange.m_Client.ExitSession();

                if (note == "")
                {
                    RptExtrato.DataSource = values;
                    RptExtrato.DataBind();
                }
                else
                {
                    Session["st_error"]      = note;
                    Session["st_error_dest"] = "trans.aspx";
                    Response.Redirect("error.aspx", true);
                }
            }
            else
            {
                var_exchange.m_Client.ExitSession();

                Session["st_error"]      = var_exchange.m_Client.GetServerMessage();
                Session["st_error_dest"] = "trans.aspx";
                Response.Redirect("error.aspx", true);
            }
        }
        catch (System.Exception se)
        {
            if (se.Message == "Exit")
            {
                Session["st_error"]      = "Esgotado tempo de espera no servidor";
                Session["st_error_dest"] = "login.aspx";
                Response.Redirect("error.aspx", true);
            }
        }
    }
Ejemplo n.º 2
0
    public void BuscaDados(DateTime tim)
    {
        RptHist.Visible = false;

        GetConnection();

        string st_cartao = Session["st_cartao"].ToString();
        string st_senha  = Session["st_senha"].ToString();

        ArrayList lst    = new ArrayList();
        ArrayList lstEmp = new ArrayList();

        DadosCartaoEdu dce = new DadosCartaoEdu();

        money mon = new money();

        try
        {
            if (var_exchange.web_fetch_edu_virtual(st_cartao,
                                                   st_senha,
                                                   var_util.ConvertDate(tim),
                                                   ref dce,
                                                   ref lst,
                                                   ref lstEmp))
            {
                if (dce.get_nu_vrRank() != "0")
                {
                    LblAluno.Text = "#" + dce.get_nu_vrRank() + " - " + dce.get_st_aluno();
                }
                else
                {
                    LblAluno.Text = dce.get_st_aluno();
                }

                LblDiaMov.Text = tim.ToLongDateString();

                TxtVrDispVirtual.Text = mon.formatToMoney(dce.get_vr_disp_virtual());
                TxtVrTotalInv.Text    = mon.formatToMoney(dce.get_vr_invest_virtual());

                TxtVrTotal.Text = mon.setMoneyFormat(Convert.ToInt64(dce.get_vr_disp_virtual()) +
                                                     Convert.ToInt64(dce.get_vr_invest_virtual()));

                ArrayList values    = new ArrayList();
                ArrayList valuesEmp = new ArrayList();

                for (int t = 0; t < lstEmp.Count; ++t)
                {
                    DadosMovEmpresaVirtual    dMov = new DadosMovEmpresaVirtual(lstEmp[t] as DataPortable);
                    PositionData_FundoEmpresa bind = new PositionData_FundoEmpresa();

                    bind.nome        = dMov.get_st_nome();
                    bind.acoes       = dMov.get_vr_acoes();
                    bind.osc         = dMov.get_vr_osc();
                    bind.vrdia       = mon.formatToMoney(dMov.get_vr_dia());
                    bind.preco_medio = mon.formatToMoney(dMov.get_vr_preco_medio());

                    bind.invest = (Convert.ToInt64(dMov.get_vr_acoes()) * Convert.ToInt64(dMov.get_vr_dia())).ToString();
                    bind.invest = mon.formatToMoney(bind.invest);

                    bool neg = false;

                    if (bind.osc.IndexOf("-") >= 0)
                    {
                        neg = true;
                    }

                    bind.osc = bind.osc.Replace("-", "");
                    bind.osc = bind.osc.PadLeft(4, '0');

                    int len = bind.osc.Length;

                    if (len == 4)
                    {
                        bind.osc = "0," + bind.osc;
                    }
                    else
                    {
                        bind.osc = bind.osc.Insert(len - 4, ",");
                    }

                    if (neg)
                    {
                        bind.osc = "-" + bind.osc;
                    }

                    bind.osc += "%";

                    if (bind.osc == "0,0000%")
                    {
                        bind.osc = "-";
                    }

                    valuesEmp.Add(bind);
                }

                RptEmpresas.DataSource = valuesEmp;
                RptEmpresas.DataBind();

                RptEmpresas.Visible = true;

                for (int t = 0; t < lst.Count; ++t)
                {
                    DadosMovEmpresaVirtual dMov = new DadosMovEmpresaVirtual(lst[t] as DataPortable);
                    PositionData_MovFundo  bind = new PositionData_MovFundo();

                    bind.nome = dMov.get_st_nome();
                    bind.mov  = dMov.get_vr_mov_fundo();

                    if (bind.mov.IndexOf("-") == -1)
                    {
                        bind.mov = "+" + bind.mov;
                    }

                    bind.total = dMov.get_vr_total();

                    values.Add(bind);
                }

                RptExtrato.DataSource = values;
                RptExtrato.DataBind();

                RptExtrato.Visible = true;
            }

            var_exchange.m_Client.ExitSession();
        }
        catch (System.Exception se)
        {
            if (se.Message == "Exit")
            {
                Session["st_error"]      = "Esgotado tempo de espera no servidor";
                Session["st_error_dest"] = "default.aspx";
                Response.Redirect("error.aspx", true);
            }
        }
    }
Ejemplo n.º 3
0
    protected void BtnConfirmar_Click(object sender, EventArgs e)
    {
        GetConnection();

        try
        {
            string output_st_content_block = "";

            ArrayList desc_status = new TipoConfirmacaoDesc().GetArray();

            string pass = Session ["pass"].ToString();
            string cnpj = Session ["cnpj"].ToString();

            DateTime t_start = (DateTime)DtIni.SelectedDate;
            DateTime t_end   = (DateTime)DtFim.SelectedDate;

            t_start = new DateTime(t_start.Year, t_start.Month, t_start.Day);

            if (var_exchange.fetch_consultaLojista(cnpj,
                                                   var_util.GetDataBaseTimeFormat((DateTime)t_start),
                                                   var_util.GetDataBaseTimeFormat((DateTime)t_end.AddHours(23).AddMinutes(59).AddSeconds(59)),
                                                   pass,
                                                   ref output_st_content_block))
            {
                ArrayList values = new ArrayList();

                while (output_st_content_block != "")
                {
                    ArrayList tmp_memory = new ArrayList();

                    if (var_exchange.fetch_memory(output_st_content_block, "200",
                                                  ref output_st_content_block,
                                                  ref tmp_memory))
                    {
                        long vr_tot = 0;

                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            DadosConsultaTransacao dct = new DadosConsultaTransacao(tmp_memory[t] as DataPortable);

                            PositionData_Extrato bind = new PositionData_Extrato();

                            bind.nsu      = dct.get_st_nsu();
                            bind.data     = var_util.getDDMMYYYY_format(dct.get_dt_transacao());
                            bind.valor    = new money().formatToMoney(dct.get_vr_valor());
                            bind.cartao   = dct.get_st_cartao();
                            bind.parcelas = dct.get_nu_parcelas();
                            bind.desc     = desc_status[Convert.ToInt32(dct.get_tg_status())].ToString();
                            bind.assoc    = dct.get_st_cod_empresa();

                            if (dct.get_tg_status() == TipoConfirmacao.Confirmada) // desfazimento
                            {
                                vr_tot += Convert.ToInt64(dct.get_vr_valor());
                            }

                            values.Add(bind);
                        }

                        LblTot.Text = "Total : R$ " + new money().formatToMoney(vr_tot.ToString());
                    }
                }

                string note = var_exchange.m_Client.GetServerMessage();

                var_exchange.m_Client.ExitSession();

                if (note == "")
                {
                    RptExtrato.DataSource = values;
                    RptExtrato.DataBind();
                }
                else
                {
                    Session["st_error"]      = note;
                    Session["st_error_dest"] = "trans.aspx";
                    Response.Redirect("error.aspx", true);
                }
            }
            else
            {
                var_exchange.m_Client.ExitSession();

                Session["st_error"]      = var_exchange.m_Client.GetServerMessage();
                Session["st_error_dest"] = "trans.aspx";
                Response.Redirect("error.aspx", true);
            }
        }
        catch (System.Exception se)
        {
            if (se.Message == "Exit")
            {
                Session["st_error"]      = "Esgotado tempo de espera no servidor";
                Session["st_error_dest"] = "login.aspx";
                Response.Redirect("error.aspx", true);
            }
        }
    }
Ejemplo n.º 4
0
    protected void BtnConfirmar(object sender, EventArgs e)
    {
        GetConnection();

        money money_helper = new money();

        try
        {
            DateTime t_start = (DateTime)DtIni.SelectedDate;
            DateTime t_end   = (DateTime)DtFim.SelectedDate;

            t_start = new DateTime(t_start.Year, t_start.Month, t_start.Day);

            string st_csv           = "";
            string st_total_periodo = "";

            GetConnection();

            if (!var_exchange.web_fetch_rel_edu_extrato(Session["st_cartao"].ToString(),
                                                        var_util.DESCript(TxtSenha.Value.PadLeft(8, '*'), "12345678"),
                                                        var_util.GetDataBaseTimeFormat((DateTime)t_start),
                                                        var_util.GetDataBaseTimeFormat((DateTime)t_end.AddHours(23).AddMinutes(59).AddSeconds(59)),
                                                        SyCrafEngine.Context.TRUE,
                                                        ref st_csv,
                                                        ref st_total_periodo))
            {
                var_exchange.m_Client.ExitSession();

                Session["st_error"]      = var_exchange.m_Client.GetServerMessage();
                Session["st_error_dest"] = "RespExt.aspx";
                Response.Redirect("error.aspx", true);
                return;
            }

            RptExtrato.Visible = true;
            LblExtrato.Visible = true;

            LblExtrato.Text = "Extrato de atividades do cartão: " + DtIni.SelectedDate.ToShortDateString() + " até " + DtFim.SelectedDate.ToShortDateString();

            ArrayList values = new ArrayList();

            ArrayList desc    = new TipoConfirmacaoDesc().GetArray();
            ArrayList desc_op = new OperacaoCartaoDesc().GetArray();

            while (st_csv != "")
            {
                ArrayList list = new ArrayList();

                var_exchange.fetch_memory(st_csv, "400", ref st_csv, ref list);

                for (int t = 0; t < list.Count; ++t)
                {
                    EduExtrato rel_line = new EduExtrato(list[t] as DataPortable);

                    PositionData_ExtratoEdu bind = new PositionData_ExtratoEdu();

                    bind.nsu      = rel_line.get_st_nsu();
                    bind.data     = var_util.getDDMMYYYY_format(rel_line.get_dt_trans());
                    bind.valor    = money_helper.formatToMoney(rel_line.get_vr_valor());
                    bind.loja     = rel_line.get_st_loja();
                    bind.saldo    = money_helper.formatToMoney(rel_line.get_vr_disp());
                    bind.fundo    = money_helper.formatToMoney(rel_line.get_vr_fundo());
                    bind.operacao = desc_op[Convert.ToInt32(rel_line.get_en_oper())].ToString();

                    values.Add(bind);
                }
            }

            RptExtrato.DataSource = values;
            RptExtrato.DataBind();

            var_exchange.m_Client.ExitSession();
        }
        catch (System.Exception se)
        {
            if (se.Message == "Exit")
            {
                Session["st_error"]      = "Esgotado tempo de espera no servidor";
                Session["st_error_dest"] = "default.aspx";
                Response.Redirect("error.aspx", true);
            }
        }
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LblNome.Text = Session["nome"].ToString();

            GetConnection();

            try
            {
                string output_st_content_block = "";

                string pass = Session["pass"].ToString();
                string cnpj = Session["cnpj"].ToString();

                if (var_exchange.fetch_extratoWebFuturo(cnpj,
                                                        pass,
                                                        ref output_st_content_block))
                {
                    ArrayList values = new ArrayList();

                    while (output_st_content_block != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(output_st_content_block, "200",
                                                      ref output_st_content_block,
                                                      ref tmp_memory))
                        {
                            long vr_gasto = 0;

                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                Rel_RTC rtc = new Rel_RTC(tmp_memory[t] as DataPortable);

                                PositionData_ExtratoCartaoFuturo bind = new PositionData_ExtratoCartaoFuturo();

                                bind.loja  = rtc.get_st_loja();
                                bind.valor = new money().formatToMoney(rtc.get_vr_total());

                                vr_gasto += Convert.ToInt64(rtc.get_vr_total());

                                bind.parcela = rtc.get_st_indice_parcela() + " / " + rtc.get_nu_parc();

                                values.Add(bind);
                            }

                            LblGasto.Text = "Total previsto: R$ " + new money().formatToMoney(vr_gasto.ToString());
                        }
                    }

                    string note = var_exchange.m_Client.GetServerMessage();

                    var_exchange.m_Client.ExitSession();

                    if (note == "")
                    {
                        RptExtrato.DataSource = values;
                        RptExtrato.DataBind();
                    }
                    else
                    {
                        Session["st_error"]      = note;
                        Session["st_error_dest"] = "trans.aspx";
                        Response.Redirect("error.aspx", true);
                    }
                }
                else
                {
                    var_exchange.m_Client.ExitSession();

                    Session["st_error"]      = var_exchange.m_Client.GetServerMessage();
                    Session["st_error_dest"] = "trans.aspx";
                    Response.Redirect("error.aspx", true);
                }
            }
            catch (System.Exception se)
            {
                if (se.Message == "Exit")
                {
                    Session["st_error"]      = "Esgotado tempo de espera no servidor";
                    Session["st_error_dest"] = "login.aspx";
                    Response.Redirect("error.aspx", true);
                }
            }
        }
    }