Example #1
0
    public static DataSet PegaDadosCep2014(string xcep, Boolean xcepespecial)
    {
        string script = "";

        if (xcep != String.Empty)
        {
            if (!xcepespecial)
            {
                script = "select l.*, l.ufe_sg UF, " +
                         " (select c.loc_nosub from log_localidade c where c.loc_nu_sequencial = l.loc_nu_sequencial ) Cidade " +
                         " from log_logradouro l where l.cep = " + Srelib.QStr(xcep) +
                         " order by UF, Cidade";
            }
            else
            {
                script = " select l.*, l.ufe_sg UF, " +
                         " (select c.loc_nosub from log_localidade c where c.loc_nu_sequencial = l.loc_nu_sequencial ) Cidade " +
                         " from log_grande_usuario l where l.cep = " + Srelib.QStr(xcep) +
                         " order by UF, Cidade";
            }
            return(SreDblib.GetDsScriptCep(script));
        }
        else
        {
            return(null);
        }
    }
Example #2
0
    public static DataSet PegaDadosCep2007(string xcep, Boolean xcepespecial)
    {
        string script = "";

        if (xcep != String.Empty)
        {
            if (!xcepespecial)
            {
                script = "select l.*, " +
                         " (select c.Cidade from localidades c where c.id = l.CodLoc ) Cidade, " +
                         " (select c.UF from localidades c where c.id = l.CodLoc ) UF " +
                         " from logradouros l where l.cep = " + Srelib.QStr(xcep) +
                         " order by UF, Cidade";
            }
            else
            {
                script = "select l.*, l.nome Complemento, " +
                         " (select c.Cidade from localidades c where c.id = l.CodLoc ) Cidade, " +
                         " (select c.UF from localidades c where c.id = l.CodLoc ) UF " +
                         " from especiais l where l.cep = " + Srelib.QStr(xcep) +
                         " order by UF, Cidade";
            }
            return(SreDblib.GetDsScriptCep(script));
        }
        else
        {
            return(null);
        }
    }
Example #3
0
    public static DataSet PegaDadosLogradouro2014(string xendereco, string xuf, Boolean xcepespecial)
    {
        string script = "";

        if (xendereco != String.Empty)
        {
            if (!xcepespecial)
            {
                script = "select l.*, l.ufe_sg UF, " +
                         " (select c.loc_nosub from log_localidade c where c.loc_nu_sequencial = l.loc_nu_sequencial ) Cidade " +
                         " from log_logradouro l where l.endereco like " + Srelib.QStr("%" + xendereco + "%");
                if (xuf != String.Empty)
                {
                    script = script + " and l.ufe_sg = " + Srelib.QStr(xuf);
                }
                script = script + " order by UF, Cidade";
            }
            else
            {
                script = " select l.*, l.ufe_sg UF, " +
                         " (select c.loc_nosub from log_localidade c where c.loc_nu_sequencial = l.loc_nu_sequencial ) Cidade " +
                         " from log_grande_usuario l where l.endereco like " + Srelib.QStr("%" + xendereco + "%");
                if (xuf != String.Empty)
                {
                    script = script + " and l.ufe_sg = " + Srelib.QStr(xuf);
                }
                script = script + " order by UF, Cidade";
            }
            return(SreDblib.GetDsScriptCep(script));
        }
        else
        {
            return(null);
        }
    }
Example #4
0
    public static ASPxComboBox MontaComboUF(ASPxComboBox pCombo, Boolean pExibeValor)
    {
        //Documentação - Chamada da Função
        //
        //SreLib.MontaComboUF(ASPxComboBox1, true);
        //
        //Fim Documentação - Chamada da Função

        DataSet dsestados;
        string  script = "";
        string  aux    = "";

        script = "select * from Estados order by UF ";
        //
        dsestados = SreDblib.GetDsScriptCep(script);
        //
        ListEditItem le;

        pCombo.Items.Clear();
        //
        for (int i = 0; i < dsestados.Tables[0].Rows.Count; i++)
        {
            //
            le = new ListEditItem();
            if (pExibeValor)
            {
                aux = "";
                aux = dsestados.Tables[0].Rows[i]["UF"].ToString().Trim() +
                      " - " +
                      dsestados.Tables[0].Rows[i]["Estado"].ToString().Trim();
                le.Text = aux.ToUpper();
            }
            else
            {
                aux     = "";
                aux     = dsestados.Tables[0].Rows[i]["UF"].ToString().Trim();
                le.Text = aux.ToUpper();
            };
            le.Value = i;
            pCombo.Items.Add(le);
        }

        return(pCombo);
    }
Example #5
0
    public static DataSet PegaDadosLogradouro2007(string xendereco, string xuf, Boolean xcepespecial)
    {
        string script = "";

        if (xendereco != String.Empty)
        {
            if (!xcepespecial)
            {
                script = "select l.*, " +
                         " (select c.Cidade from localidades c where c.id = l.CodLoc ) Cidade, " +
                         " (select c.UF from localidades c where c.id = l.CodLoc ) UF " +
                         " from logradouros l where l.endereco like " + Srelib.QStr("%" + xendereco + "%");
                if (xuf != String.Empty)
                {
                    script = script + " and UF = " + Srelib.QStr(xuf);
                }
                script = script + " order by UF, Cidade";
            }
            else
            {
                script = "select l.*, l.nome Complemento, " +
                         " (select c.Cidade from localidades c where c.id = l.CodLoc ) Cidade, " +
                         " (select c.UF from localidades c where c.id = l.CodLoc ) UF " +
                         " from especiais l where l.endereco like " + Srelib.QStr("%" + xendereco + "%");
                if (xuf != String.Empty)
                {
                    script = script + " and UF = " + Srelib.QStr(xuf);
                }
                script = script + " order by UF, Cidade";
            }
            return(SreDblib.GetDsScriptCep(script));
        }
        else
        {
            return(null);
        }
    }
Example #6
0
    protected void btprocessa_Click(object sender, EventArgs e)
    {
        Boolean lOk = true;

        //
        //Processamento
        //ScriptManager.RegisterStartupScript(UpdatePanel, GetType(), "msgbox", "alert('Processamento Concluído!');", true);
        ScriptManager.RegisterStartupScript(this.Page, typeof(Page), Guid.NewGuid().ToString(),
                                            "toastr.success('cessamento Concluído!', 'Atenção!')", true);


        if (lOk)
        {
            //Tamanho da Base corrente
            lbbasegitano2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("EXEC sp_spaceused @updateusage = N" + Srelib.QStr("TRUE"));
            lbbasegitano2.Text = ds0.Tables[0].Rows[0]["database_size"].ToString();
            //
            try
            {
                //Tamanho da Base Cep
                lbbasecep2.Text = "";
                ds0.Clear();
                ds0             = SreDblib.GetDsScriptCep("EXEC sp_spaceused @updateusage = N" + Srelib.QStr("TRUE"));
                lbbasecep2.Text = ds0.Tables[0].Rows[0]["database_size"].ToString();
            }
            catch (Exception)
            {
                //
            }
            //
            //lbusuariosativos
            lbusuariosativos2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(login) quantidade from usuario with(nolock) where ativo = 1");
            lbusuariosativos2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //
            //lbclientesfinanciamentos
            lbclientesfinanciamentos2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(nome) quantidade from contato with(nolock) where ativo = 1");
            lbclientesfinanciamentos2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lbunidadescadastradas
            lbunidadescadastradas2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(produto) quantidade from produto_unidades with(nolock)");
            lbunidadescadastradas2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lbvendas
            lbvendas2.Text = "";
            ds0.Clear();
            ds0            = SreDblib.GetDsScript("Select count(produto) quantidade from vendas with(nolock)");
            lbvendas2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lbcontasareceber2
            lbcontasareceber2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(lancamento) quantidade from contas_receber with(nolock)");
            lbcontasareceber2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lbcontasapagar2
            lbcontasapagar2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(lancamento) quantidade from contas_pagar with(nolock)");
            lbcontasapagar2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lbclientescreceber2
            lbclientescreceber2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(nome) quantidade from clientes with(nolock)");
            lbclientescreceber2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lbfornecedorescpagar2
            lbfornecedorescpagar2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(nome) quantidade from fornecedores with(nolock)");
            lbfornecedorescpagar2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lbcontascorrentes2
            lbcontascorrentes2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(cod_banco) quantidade from contas with(nolock) ");
            lbcontascorrentes2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lbcorretores2
            lbcorretores2.Text = "";
            ds0.Clear();
            ds0 = SreDblib.GetDsScript("Select count(nome) quantidade from corretores with(nolock) ");
            lbcorretores2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
            //
            //lblog2
            lblog2.Text = "";
            ds0.Clear();
            ds0         = SreDblib.GetDsScript("Select count(login) quantidade from log with(nolock) ");
            lblog2.Text = ds0.Tables[0].Rows[0]["quantidade"].ToString();
        }

        if (lOk)
        {
            // CRIA LOG  ===============================================================================================================================================
            SqlParameter[] param_log = { new SqlParameter("@login",    (String)Session["CodUsuario"]),
                                         new SqlParameter("@tabela",   "TODAS"),
                                         new SqlParameter("@operacao", "CONFIG"),
                                         new SqlParameter("@obs",      "STATUS"),
                                         new SqlParameter("@acao",     "STATUS DO AMBIENTE - " +
                                                          "BASE (" + (String)Session["BaseCorrente"] + "): " +
                                                          lbbasegitano2.Text) };
            uLog.MakeLog(param_log);
            // FIM CRIA LOG ============================================================================================================================================
        }
    }