public static TList_CadPatrimonio Busca(string CD_Patrimonio, string CD_empresa, string Nr_patrimonio, BancoDados.TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrEmpty(CD_Patrimonio)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_Patrimonio"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + CD_Patrimonio.Trim() + "'"; } if (!string.IsNullOrEmpty(CD_empresa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_empresa"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + CD_empresa.Trim() + "'"; } if (!string.IsNullOrEmpty(Nr_patrimonio)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.Nr_patrimonio"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + Nr_patrimonio.Trim() + "'"; } return(new TCD_CadPatrimonio(banco).Select(vBusca, 0, "")); }
public static TList_CadContrato_Headge Busca(string vID_Headge, string vNr_Contrato, string vTpValor, string vCD_Clifor, string vCD_Endereco, string vTp_Duplicata, TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrEmpty(vTpValor.Trim())) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.TpValor"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vTpValor.Trim() + "'"; } if (!string.IsNullOrEmpty(vCD_Clifor.Trim())) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_Clifor"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_Clifor.Trim() + "'"; } if (!string.IsNullOrEmpty(vCD_Endereco.Trim())) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_Endereco"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_Endereco.Trim() + "'"; } if (!string.IsNullOrEmpty(vTp_Duplicata.Trim())) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.Tp_Duplicata"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vTp_Duplicata.Trim() + "'"; } if (!string.IsNullOrEmpty(vNr_Contrato.Trim())) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.Nr_Contrato"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = vNr_Contrato; } if (!string.IsNullOrEmpty(vID_Headge.Trim())) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.Id_Headge"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = vID_Headge; } return(new TCD_CadContrato_Headge(banco).Select(vBusca, 0, string.Empty)); }
public static TList_CadUsuario_CFGPedido Busca(string login, string Cfg_pedido, string cd_empresa, BancoDados.TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrEmpty(login)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.login"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + login.Trim() + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(Cfg_pedido)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.cfg_pedido"; vBusca[vBusca.Length - 1].vVL_Busca = Cfg_pedido; vBusca[vBusca.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(cd_empresa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "d.cd_empresa"; vBusca[vBusca.Length - 1].vVL_Busca = cd_empresa; vBusca[vBusca.Length - 1].vOperador = "="; } return(new TCD_CadUsuario_CFGPedido(banco).Select(vBusca, 0, string.Empty)); }
public static TList_RegCadProtocolo Busca(string vCD_Protocolo, string vDS_Protocolo, string vCD_Terminal, BancoDados.TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrEmpty(vCD_Protocolo)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "CD_Protocolo"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_Protocolo.Trim() + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vDS_Protocolo)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "DS_Protocolo"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vDS_Protocolo.Trim() + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vCD_Terminal)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = string.Empty; vBusca[vBusca.Length - 1].vVL_Busca = "(Select 1 From TB_DIV_Terminal_X_Protocolo x " + "Where x.CD_Protocolo = a.CD_Protocolo " + "and x.CD_Terminal = '" + vCD_Terminal + "')"; vBusca[vBusca.Length - 1].vOperador = "EXISTS"; } return(new TCD_CadProtocolo(banco).Select(vBusca, 0, string.Empty)); }
public static TList_Retirada buscar(string Cd_empresa, string Id_retirada, string Cd_funcionario, string Dt_ini, string Dt_fin, BancoDados.TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrWhiteSpace(Cd_empresa)) { Estruturas.CriarParametro(ref vBusca, "a.cd_empresa", "'" + Cd_empresa.Trim() + "'"); } if (!string.IsNullOrWhiteSpace(Id_retirada)) { Estruturas.CriarParametro(ref vBusca, "a.id_retirada", Id_retirada); } if (!string.IsNullOrWhiteSpace(Cd_funcionario)) { Estruturas.CriarParametro(ref vBusca, "a.cd_funcionario", "'" + Cd_funcionario.Trim() + "'"); } if (Dt_ini.IsDateTime()) { Estruturas.CriarParametro(ref vBusca, "convert(datetime, floor(convert(decimal(30,10), a.dt_retirada)))", "'" + Convert.ToDateTime(Dt_ini).ToString("yyyyMMdd") + "'", ">="); } if (Dt_fin.IsDateTime()) { Estruturas.CriarParametro(ref vBusca, "convert(datetime, floor(convert(decimal(30,10), a.dt_retirada)))", "'" + Convert.ToDateTime(Dt_fin).ToString("yyyyMMdd") + "'", "<="); } return(new TCD_Retirada(banco).Select(vBusca, 0, string.Empty)); }
public static TList_CadParamSys Busca(string nm_campo, string st_auto, decimal tamanho, BancoDados.TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (nm_campo.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "nm_campo"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + nm_campo.Replace("'", "''") + "'"; vBusca[vBusca.Length - 1].vOperador = " like "; } if (st_auto.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "st_auto"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + st_auto + "'"; vBusca[vBusca.Length - 1].vOperador = " = "; } if (tamanho > 0) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "Tamanho"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + tamanho + "'"; vBusca[vBusca.Length - 1].vOperador = " = "; } return(new TCD_CadParamSys(banco).Select(vBusca, 0, "")); }
public static TList_CadEmpresa_X_Moega Busca(string vCD_Moega, string vCD_Empresa, string vST_Registro) { TpBusca[] vBusca = new TpBusca[0]; if (vCD_Moega.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_Moega"; vBusca[vBusca.Length - 1].vOperador = " = "; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_Moega + "'"; } if (vCD_Empresa.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_Empresa"; vBusca[vBusca.Length - 1].vOperador = " = "; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_Empresa + "'"; } ; if (vST_Registro.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.ST_Registro"; vBusca[vBusca.Length - 1].vOperador = " = "; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vST_Registro + "'"; } ; TCD_CadEmpresa_X_Moega cd = new TCD_CadEmpresa_X_Moega(); return(cd.Select(vBusca, 0, "")); }
public static TList_CadTaxaDeposito Buscar(string vId_Taxa, string vDs_Taxa, string vTP_Taxa, string vNm_campo, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(vId_Taxa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_taxa"; filtro[filtro.Length - 1].vVL_Busca = vId_Taxa; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vTP_Taxa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.tp_taxa"; filtro[filtro.Length - 1].vVL_Busca = "'" + vTP_Taxa + "'"; filtro[filtro.Length - 1].vOperador = "like"; } if (!string.IsNullOrEmpty(vDs_Taxa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ds_taxa"; filtro[filtro.Length - 1].vVL_Busca = "'%" + vDs_Taxa + "%'"; filtro[filtro.Length - 1].vOperador = "like"; } return(new TCD_CadTaxaDeposito(banco).Select(filtro, vTop, vNm_campo)); }
public static TList_CadDespesa Busca(string iddespesa, string DSdespesa, BancoDados.TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrEmpty(iddespesa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.id_despesa"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + iddespesa.Trim() + "'"; } if (!string.IsNullOrEmpty(DSdespesa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.DS_despesa"; vBusca[vBusca.Length - 1].vOperador = "like"; vBusca[vBusca.Length - 1].vVL_Busca = "('%" + DSdespesa.Trim() + "%')"; } return(new TCD_CadDespesa(banco).Select(vBusca, 0, string.Empty)); }
private void CD_PRODUTO_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(CD_PRODUTO.Text.SoNumero().Trim())) { TpBusca[] filtro = new TpBusca[2]; filtro[0].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[0].vOperador = "<>"; filtro[0].vVL_Busca = "'C'"; filtro[1].vNM_Campo = string.Empty; filtro[1].vOperador = string.Empty; filtro[1].vVL_Busca = "(a.cd_produto like '%" + CD_PRODUTO.Text.Trim() + "') or " + "(a.Codigo_Alternativo = '" + (CD_PRODUTO.TextOld != null ? CD_PRODUTO.TextOld.ToString() : ds_produto.Text.Trim()) + "') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + CD_PRODUTO.Text.Trim() + "'))"; System.Collections.Hashtable hs = new System.Collections.Hashtable(2); hs.Add("@CD_EMPRESA", pCd_empresa); hs.Add("@CD_TABELAPRECO", pCd_tabelapreco); TList_CadProduto lProd = new TCD_CadProduto().Select(filtro, 1, string.Empty, string.Empty, string.Empty, hs); if (lProd.Count > 0) { rProd = lProd[0]; CD_PRODUTO.Text = lProd[0].CD_Produto; ds_produto.Text = lProd[0].DS_Produto; afterficha(); } else { MessageBox.Show("Produto não encontrado pelo código informado.", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public static TList_ReservaEstoque BuscarReservaEstoque(string Cd_empresa, string Cd_produto, string Cd_local, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_empresa"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_empresa.Trim() + "'"; } if (!string.IsNullOrEmpty(Cd_produto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_produto"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_produto.Trim() + "'"; } if (!string.IsNullOrEmpty(Cd_local)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_local"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_local.Trim() + "'"; } return(new TCD_ReservaEstoque(banco).Select(filtro, 0, string.Empty)); }
public static TList_Sabores Buscar( string id_sabor, string ds_sabor, string cd_grupo, BancoDados.TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(cd_grupo)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_grupo"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + cd_grupo.Trim() + "'"; } if (!string.IsNullOrEmpty(id_sabor)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_sabor"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + id_sabor.Trim() + "'"; } if (!string.IsNullOrEmpty(ds_sabor)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ds_sabor"; filtro[filtro.Length - 1].vOperador = "like"; filtro[filtro.Length - 1].vVL_Busca = "'%" + ds_sabor.Trim() + "%'"; } return(new TCD_Sabores(banco).Select(filtro, 0, string.Empty)); }
private void BuscarProduto() { if (cbEmpresa.SelectedItem == null) { MessageBox.Show("Obrigatório informar empresa!", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } TpBusca[] filtro = new TpBusca[1]; //Descartar produtos cancelados filtro[0].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[0].vOperador = "<>"; filtro[0].vVL_Busca = "'C'"; CamadaDados.Estoque.Cadastros.TRegistro_CadProduto rProd = null; if (string.IsNullOrEmpty(cd_produto.Text)) { rProd = UtilPesquisa.BuscarProduto(string.Empty, cbEmpresa.SelectedValue.ToString(), string.Empty, string.Empty, null, filtro); } else if (cd_produto.Text.SoNumero().Trim().Length != cd_produto.Text.Trim().Length) { rProd = UtilPesquisa.BuscarProduto(cd_produto.Text, cbEmpresa.SelectedValue.ToString(), string.Empty, string.Empty, null, filtro); } else { //Buscar Produto Estruturas.CriarParametro(ref filtro, string.Empty, "(a.cd_produto like '%" + cd_produto.Text.Trim() + "') or " + "(a.Codigo_Alternativo = '" + (cd_produto.TextOld != null ? cd_produto.TextOld.ToString() : cd_produto.Text.Trim()) + "') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + cd_produto.Text.Trim() + "'))", string.Empty); CamadaDados.Estoque.Cadastros.TList_CadProduto lProd = new CamadaDados.Estoque.Cadastros.TCD_CadProduto().Select(filtro, 0, string.Empty, string.Empty, string.Empty); if (lProd.Count > 0) { rProd = lProd[0]; } } if (rProd != null) { CdProduto.Text = rProd.CD_Produto; dsProduto.Text = rProd.DS_Produto; dtAbast.Focus(); } else { cd_produto.Focus(); } cd_produto.Clear(); }
public static TList_Resposta Buscar(string Id_resposta, string Ds_resposta, BancoDados.TObjetoBanco banco, string Cancelado = "") { TpBusca[] tpBuscas = new TpBusca[0]; if (!string.IsNullOrEmpty(Id_resposta)) { Estruturas.CriarParametro(ref tpBuscas, "a.Id_pergunta", "'" + Id_resposta + "'"); } if (!string.IsNullOrEmpty(Ds_resposta)) { Estruturas.CriarParametro(ref tpBuscas, "a.Ds_resposta", "'" + Ds_resposta + "'"); } if (!string.IsNullOrEmpty(Cancelado) && Cancelado.Equals("1")) { Estruturas.CriarParametro(ref tpBuscas, "a.cancelado", "'1'"); } else if (!string.IsNullOrEmpty(Cancelado) && Cancelado.Equals("0")) { Estruturas.CriarParametro(ref tpBuscas, "a.cancelado", "'0'"); } return(new TCD_Resposta(banco).Select(tpBuscas, 0, string.Empty)); }
public static TList_CadClifor BuscaVendedor(string Cd_vendedor, string Loginvendedor, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[2]; filtro[0].vNM_Campo = "isnull(a.st_vendedor, 'N')"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'S'"; filtro[1].vNM_Campo = "isnull(a.st_funcativo, 'N')"; filtro[1].vOperador = "="; filtro[1].vVL_Busca = "'S'"; if (!string.IsNullOrEmpty(Cd_vendedor)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_clifor"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_vendedor.Trim() + "'"; } if (!string.IsNullOrEmpty(Loginvendedor)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.loginvendedor"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Loginvendedor.Trim() + "'"; } return(new TCD_CadClifor(banco).Select(filtro, 0, string.Empty)); }
public static TList_Cad_Filtro Busca(decimal vID_Filtro, string vID_Consulta, string vNM_Campo) { TpBusca[] vBusca = new TpBusca[0]; if (vID_Filtro > 0) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.id_Filtro"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vID_Filtro.ToString() + "'"; } if (vID_Consulta.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.ID_Consulta"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vID_Consulta.ToString() + "'"; } if (vNM_Campo.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.NM_Campo"; vBusca[vBusca.Length - 1].vOperador = "like"; vBusca[vBusca.Length - 1].vVL_Busca = "'%" + vNM_Campo + "%'"; } TCD_Cad_Filtro cd = new TCD_Cad_Filtro(); return(cd.Select(vBusca, 0, "")); }
public static TList_CadClifor BuscaMotorista(string Cd_motorista, string id_veiculo, BancoDados.TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[2]; filtro[0].vNM_Campo = "isnull(a.st_motorista, 'N')"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'S'"; filtro[1].vNM_Campo = "isnull(a.st_ativo, 'S')"; filtro[1].vOperador = "="; filtro[1].vVL_Busca = "'S'"; if (!string.IsNullOrEmpty(Cd_motorista)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_clifor"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_motorista.Trim() + "'"; } if (!string.IsNullOrEmpty(id_veiculo)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_veiculo"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = id_veiculo; } return(new TCD_CadClifor(banco).Select(filtro, 0, string.Empty)); }
public static TList_CadEmpresa Busca(string vCD_Empresa, string vNM_Empresa, string vST_Registro, BancoDados.TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrEmpty(vCD_Empresa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_EMPRESA"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_Empresa.Trim() + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vNM_Empresa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.NM_EMPRESA"; vBusca[vBusca.Length - 1].vVL_Busca = "('%" + vNM_Empresa.Trim() + "%')"; vBusca[vBusca.Length - 1].vOperador = "like"; } if (!string.IsNullOrEmpty(vST_Registro)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "isnull(a.ST_REGISTRO, 'A')"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vST_Registro.Trim() + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } return(new TCD_CadEmpresa(banco).Select(vBusca, 0, string.Empty)); }
public static TList_CadLayoutEtiqueta Busca(string id_layout, string DS_layout, TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (id_layout.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.id_layout"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + id_layout + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } ; if (DS_layout.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "DS_layout"; vBusca[vBusca.Length - 1].vVL_Busca = "'%" + DS_layout + "%'"; vBusca[vBusca.Length - 1].vOperador = "like"; } ; TCD_CadLayoutEtiqueta qtb_Menu = new TCD_CadLayoutEtiqueta(); if (banco != null) { qtb_Menu.Banco_Dados = banco; } return(qtb_Menu.Select(vBusca, 0, string.Empty, string.Empty)); }
public static TList_Lote_X_Servicos Buscar(string Id_lote, string Id_os, string Cd_empresa, int vTop, string vNm_campo, BancoDados.TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (Id_lote.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_lote"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_lote; } if (Id_os.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_os"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = Id_os; } if (Cd_empresa.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_empresa"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_empresa.Trim() + "'"; } return(new TCD_Lote_X_Servicos(banco).Select(filtro, vTop, vNm_campo)); }
private void BuscarValesDia() { if (rCfgPosto.Qt_maxvaledia > decimal.Zero) { TpBusca[] filtro = new TpBusca[3]; filtro[0].vNM_Campo = "a.cd_empresa"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'" + rCfgPosto.Cd_empresa.Trim() + "'"; filtro[1].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[1].vOperador = "<>"; filtro[1].vVL_Busca = "'C'"; filtro[2].vNM_Campo = string.Empty; filtro[2].vOperador = "exists"; filtro[2].vVL_Busca = "(select 1 from tb_fat_pontosfidelidade x " + "inner join tb_fat_resgatepontos y " + "on x.cd_empresa = y.cd_empresa " + "and x.id_ponto = y.id_ponto " + "where y.cd_empresa = a.cd_empresa " + "and y.id_vale = a.id_vale " + "and convert(datetime, floor(convert(decimal(30,10), y.dt_resgate))) = convert(datetime, floor(convert(decimal(30,10), getdate()))) " + "and " + (pPlaca.Trim().Length.Equals(8) ? "replace(x.placa, '-', '') = '" + pPlaca.Replace("-", string.Empty) + "')" : !string.IsNullOrEmpty(pCpf_motorista.SoNumero()) ? "x.cpf_cliente = '" + pCpf_motorista.Trim() + "')" : "a.cd_clifor = '" + pCd_clifor.Trim() + "')"); object obj = new CamadaDados.Faturamento.Fidelizacao.TCD_ValeResgate().BuscarEscalar(filtro, "count(*)"); if (obj != null) { vales_impressos.Value = decimal.Parse(obj.ToString()); } } }
public static TList_Mesa Buscar(string nr_mesa, string id_local, string ds_mesa, BancoDados.TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(nr_mesa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nr_mesa"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + nr_mesa.Trim() + "'"; } if (!string.IsNullOrEmpty(id_local)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.id_local"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = id_local; } if (!string.IsNullOrEmpty(ds_mesa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ds_mesa"; filtro[filtro.Length - 1].vOperador = "like"; filtro[filtro.Length - 1].vVL_Busca = "'%" + ds_mesa.Trim() + "%'"; } Estruturas.CriarParametro(ref filtro, "isnull(a.st_registro, 'A')", "'A'"); return(new TCD_Mesa(banco).Select(filtro, 0, string.Empty)); }
public static TList_CadTbPreco Busca(string vCD_TabelaPreco, string vDS_TabelaPreco, string vST_Registro) { TpBusca[] vBusca = new TpBusca[0]; if (vCD_TabelaPreco.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "CD_TabelaPreco"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_TabelaPreco + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } if (vDS_TabelaPreco.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "DS_TabelaPreco"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vDS_TabelaPreco + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } if (vST_Registro.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "ST_Registro"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vST_Registro + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } TCD_CadTbPreco cadPreco = new TCD_CadTbPreco(); return(cadPreco.Select(vBusca, 0, "")); }
public static TList_Cad_Param Buscar(decimal vID_Param, decimal vID_Consulta, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (vID_Param > 0) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_ParamClasse"; filtro[filtro.Length - 1].vVL_Busca = "" + vID_Param.ToString() + ""; filtro[filtro.Length - 1].vOperador = "="; } if (vID_Consulta > 0) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_Consulta"; filtro[filtro.Length - 1].vVL_Busca = "'" + vID_Consulta + "'"; filtro[filtro.Length - 1].vOperador = "="; } TCD_Cad_Param qtb_Param = new TCD_Cad_Param(); return(qtb_Param.Select(filtro, vTop, "")); }
public static TList_CadCFGEmpreendimento Busca(string cd_empresa, string cfg_remessa, BancoDados.TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrEmpty(cfg_remessa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.cfg_remessa"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + cfg_remessa.Trim() + "'"; } if (!string.IsNullOrEmpty(cd_empresa)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.cd_empresa"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + cd_empresa.Trim() + "'"; } return(new TCD_CadCFGEmpreendimento(banco).Select(vBusca, 0, string.Empty)); }
public static DataTable Buscar(string vCD_Empresa, string vNR_Contrato, short vTop, string vNM_Campo, string vGroup, string vOrder, Hashtable vParametros ) { TpBusca[] vBusca = new TpBusca[0]; if (vCD_Empresa.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_Empresa"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_Empresa + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } if (vNR_Contrato.Trim() != "") { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.NR_Contrato"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vNR_Contrato + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } TCD_Rel_Saldo_Sintetico_Contrato qtb_Saldo_Sintetico_Contrato = new TCD_Rel_Saldo_Sintetico_Contrato("SqlCodeBusca_Saldo_Sintetico_Contrato"); return(qtb_Saldo_Sintetico_Contrato.Buscar(vBusca, vTop, vNM_Campo, vGroup, vOrder, vParametros)); }
private void bbBuscar_Click(object sender, EventArgs e) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(fone.Text)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.celular"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + fone.Text.Trim() + "'"; } if (!string.IsNullOrEmpty(editDefault1.Text)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.nm_clifor"; filtro[filtro.Length - 1].vOperador = "like"; filtro[filtro.Length - 1].vVL_Busca = "'%" + editDefault1.Text.Trim() + "%'"; } Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.st_registro"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'A'"; bsClifor.DataSource = new CamadaDados.Restaurante.Cadastro.TCD_Clifor().Select(filtro, 0, string.Empty); bsClifor.ResetCurrentItem(); }
public static TList_Questionario Buscar(string Id_questionario, string Ds_questionario, BancoDados.TObjetoBanco banco, string Cancelado = "") { TpBusca[] tpBuscas = new TpBusca[0]; if (!string.IsNullOrEmpty(Id_questionario)) { Estruturas.CriarParametro(ref tpBuscas, "a.id_questionario", "'" + Id_questionario + "'"); } if (!string.IsNullOrEmpty(Ds_questionario)) { Estruturas.CriarParametro(ref tpBuscas, "a.ds_questionario", "'" + Ds_questionario + "'"); } if (!string.IsNullOrEmpty(Cancelado) && Cancelado.Equals("1")) { Estruturas.CriarParametro(ref tpBuscas, "a.cancelado", "'1'"); } else if (!string.IsNullOrEmpty(Cancelado) && Cancelado.Equals("0")) { Estruturas.CriarParametro(ref tpBuscas, "a.cancelado", "'0'"); } return(new TCD_Questionario(banco).Select(tpBuscas, 0, string.Empty)); }
public static TList_CadFatDireto Buscar(string Cd_empresa, string Id_orcamento, string Id_Projeto, string Nr_versao, string id_ficha, string Cd_clifor, string Cd_vendedor, string Tp_data, string Dt_ini, string Dt_fin, string St_registro, BancoDados.TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.cd_empresa"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'" + Cd_empresa.Trim() + "'"; } if (!string.IsNullOrEmpty(Id_Projeto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vOperador = "exists "; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from TB_EMP_ItensFatDireto x where a.cd_empresa = x.cd_empresa and a.id_faturamento = x.id_faturamento and x.Id_Projeto = '" + Id_Projeto + "' )"; } if (!string.IsNullOrEmpty(Id_orcamento)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vOperador = "exists "; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from TB_EMP_ItensFatDireto x where a.cd_empresa = x.cd_empresa and a.id_faturamento = x.id_faturamento and x.id_orcamento = '" + Id_orcamento + "' )"; } if (!string.IsNullOrEmpty(Nr_versao)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vOperador = "exists "; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from TB_EMP_ItensFatDireto x where a.cd_empresa = x.cd_empresa and a.id_faturamento = x.id_faturamento and x.Nr_versao = '" + Nr_versao + "' )"; } if (!string.IsNullOrEmpty(Dt_ini.SoNumero())) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "convert(datetime, floor(convert(decimal(30,10), " + (Tp_data.Trim().ToUpper().Equals("I") ? "a.dt_previni" : Tp_data.Trim().ToUpper().Equals("F") ? "a.dt_prevfin" : "a.dt_orcamento") + ")))"; filtro[filtro.Length - 1].vOperador = ">="; filtro[filtro.Length - 1].vVL_Busca = "'" + DateTime.Parse(Dt_ini).ToString("yyyyMMdd") + "'"; } if (!string.IsNullOrEmpty(Dt_fin.SoNumero())) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "convert(datetime, floor(convert(decimal(30,10), " + (Tp_data.Trim().ToUpper().Equals("I") ? "a.dt_previni" : Tp_data.Trim().ToUpper().Equals("F") ? "a.dt_prevfin" : "a.dt_orcamento") + ")))"; filtro[filtro.Length - 1].vOperador = "<="; filtro[filtro.Length - 1].vVL_Busca = "'" + DateTime.Parse(Dt_fin).ToString("yyyyMMdd") + "'"; } return(new TCD_CadFatDireto(banco).Select(filtro, 0, string.Empty)); }
public static string Gravar(TRegistro_CTB_CFGNFCe val, TObjetoBanco banco) { bool st_transacao = false; TCD_CTB_CFGNFCe qtb_CTB_CFG = new TCD_CTB_CFGNFCe(); try { if (banco == null) { st_transacao = qtb_CTB_CFG.CriarBanco_Dados(true); } else { qtb_CTB_CFG.Banco_Dados = banco; } if (!val.Id_cfgctb.HasValue) { TpBusca[] filtro = new TpBusca[3]; filtro[0].vNM_Campo = "a.cd_empresa"; filtro[0].vOperador = "="; filtro[0].vVL_Busca = "'" + val.Cd_empresa.Trim() + "'"; filtro[1].vNM_Campo = "a.cd_cfop"; filtro[1].vOperador = "="; filtro[1].vVL_Busca = val.Cd_cfop; filtro[2].vNM_Campo = "a.cd_produto"; filtro[2].vOperador = string.IsNullOrEmpty(val.Cd_produto) ? "is" : "="; filtro[2].vVL_Busca = string.IsNullOrEmpty(val.Cd_produto) ? "null" : "'" + val.Cd_produto.Trim() + "'"; object obj = qtb_CTB_CFG.BuscarEscalar(filtro, "a.id_cfgctb"); if (obj != null) { val.Id_cfgctb = decimal.Parse(obj.ToString()); } } string retorno = qtb_CTB_CFG.Grava(val); if (st_transacao) { qtb_CTB_CFG.Banco_Dados.Commit_Tran(); } return(retorno); } catch (Exception ex) { if (st_transacao) { qtb_CTB_CFG.Banco_Dados.RollBack_Tran(); } throw new Exception("Erro gravar registro: " + ex.Message); } finally { if (st_transacao) { qtb_CTB_CFG.deletarBanco_Dados(); } } }