public static TList_CadCategoriaCliFor Buscar( string vId_CategoriaCliFor, string vDs_CategoriaCliFor, string vNm_campo, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (vId_CategoriaCliFor.Trim() != "") { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Id_CategoriaCliFor"; filtro[filtro.Length - 1].vVL_Busca = "'" + vId_CategoriaCliFor.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (vDs_CategoriaCliFor.Trim() != "") { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Ds_CategoriaCliFor"; filtro[filtro.Length - 1].vVL_Busca = "'%" + vDs_CategoriaCliFor + "%'"; filtro[filtro.Length - 1].vOperador = "LIKE"; } TCD_CadCategoriaCliFor qtb_CategoriaCliFor = new TCD_CadCategoriaCliFor(); return(qtb_CategoriaCliFor.Select(filtro, vTop, vNm_campo)); }
public static TList_Reserva_X_PreVenda Buscar(string Cd_empresa, string Id_reserva, string Id_item, string Id_prevenda, string Id_itemprevenda, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(Cd_empresa)) { Estruturas.CriarParametro(ref filtro, "a.cd_empresa", "'" + Cd_empresa.Trim() + "'"); } if (!string.IsNullOrEmpty(Id_reserva)) { Estruturas.CriarParametro(ref filtro, "a.id_reserva", Id_reserva); } if (!string.IsNullOrEmpty(Id_item)) { Estruturas.CriarParametro(ref filtro, "a.id_item", Id_item); } if (!string.IsNullOrEmpty(Id_prevenda)) { Estruturas.CriarParametro(ref filtro, "a.id_prevenda", Id_prevenda); } if (!string.IsNullOrEmpty(Id_itemprevenda)) { Estruturas.CriarParametro(ref filtro, "a.id_itemprevenda", Id_itemprevenda); } return(new TCD_Reserva_X_PreVenda(banco).Select(filtro, 0, string.Empty)); }
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_CadPais Buscar( string vCd_pais, string vNm_Pais, string vNm_campo, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (vCd_pais.Trim() != "") { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Cd_pais"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_pais.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (vNm_Pais.Trim() != "") { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Nm_Pais"; filtro[filtro.Length - 1].vVL_Busca = "'%" + vNm_Pais + "%'"; filtro[filtro.Length - 1].vOperador = "LIKE"; } TCD_CadPais qtb_pais = new TCD_CadPais(); return(qtb_pais.Select(filtro, vTop, vNm_campo)); }
public static TList_CadUf Buscar(string vUf, string vCd_uf, string vDs_uf, string vNm_campo, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(vUf)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.UF"; filtro[filtro.Length - 1].vVL_Busca = "'" + vUf.Trim().Replace("'", "''") + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vCd_uf)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_UF"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_uf.Trim().Replace("'", "''") + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vDs_uf)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.DS_UF"; filtro[filtro.Length - 1].vVL_Busca = "'" + vDs_uf.Replace("'", "''") + "'"; filtro[filtro.Length - 1].vOperador = "="; } return(new TCD_CadUf(banco).Select(filtro, vTop, vNm_campo)); }
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 TRegistro_CadCFGPedido BuscarRegistro(string vCfg_pedidoString, string vDs_tipopedido, string vTp_movimento, string vSt_deposito, string vSt_confere_saldo, string vSt_valoresfixos, string vSt_permite_pedidoparcial, string vSt_permitetransf, string vSt_comissaoped, string vSt_comissaofat, string vSt_servico, decimal vNr_pedido, int vTop, string vNm_campo, TObjetoBanco banco) { TList_CadCFGPedido lCfg = Buscar(vCfg_pedidoString, vDs_tipopedido, vTp_movimento, vSt_deposito, vSt_confere_saldo, vSt_valoresfixos, vSt_permite_pedidoparcial, vSt_permitetransf, vSt_comissaoped, vSt_comissaofat, vSt_servico, vNr_pedido, vTop, vNm_campo, banco); return(lCfg.Count > 0 ? lCfg[0] : null); }
public static void recalculaNota(TRegistro_LanPesagem val, TObjetoBanco banco) { bool pode_liberar = false; TCD_LanPesagemClifor qtb_psclifor = new TCD_LanPesagemClifor(); try { if (banco == null) { qtb_psclifor.CriarBanco_Dados(true); pode_liberar = true; } else { qtb_psclifor.Banco_Dados = banco; } //Recalcular Notas do Desdobro qtb_psclifor.recalculaNotas(val); if (pode_liberar) { qtb_psclifor.Banco_Dados.Commit_Tran(); } } finally { if (pode_liberar) { qtb_psclifor.deletarBanco_Dados(); } } }
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_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_CadContratoxPedidoItem Buscar(string vNr_Contrato, string vNr_Pedido, string vCd_produto, string vNm_campo, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(vNr_Contrato)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Nr_Contrato"; filtro[filtro.Length - 1].vVL_Busca = vNr_Contrato; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vCd_produto)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Cd_produto"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_produto.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vNr_Pedido)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Nr_Pedido"; filtro[filtro.Length - 1].vVL_Busca = vNr_Pedido; filtro[filtro.Length - 1].vOperador = "="; } return(new TCD_CadContratoxPedidoItem(banco).Select(filtro, vTop, vNm_campo)); }
public static TRegistro_CadContatoCliFor BuscarCadContatoCliFor(string vId_Contato, string vCd_CliFor, string vTp_Contato, string vNM_Contato, string vEmail, string vFone, string vFoneMovel, string vNm_campo, TObjetoBanco banco) { TList_CadContatoCliFor listaCadContatoClifor = Buscar(vId_Contato, vCd_CliFor, vTp_Contato, vNM_Contato, vEmail, vFone, vFoneMovel, false, false, false, vNm_campo, 1, banco); if (listaCadContatoClifor.Count > 0) { return(listaCadContatoClifor[0]); } else { return(new TRegistro_CadContatoCliFor()); } }
public static TList_CadAlmox_X_Empresa Busca(string vId_almox, string vCd_empresa, TObjetoBanco banco) { TpBusca[] vBusca = new Utils.TpBusca[0]; if (!string.IsNullOrEmpty(vId_almox)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.id_almox"; vBusca[vBusca.Length - 1].vVL_Busca = vId_almox; vBusca[vBusca.Length - 1].vOperador = "="; } 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 = "="; } TCD_CadAlmox_X_Empresa cd = new TCD_CadAlmox_X_Empresa(); return(new TCD_CadAlmox_X_Empresa(banco).Select(vBusca, 0, string.Empty)); }
public static TList_CadLote Busca(string vNR_LoteProducao, string vDS_LoteProducao, int vTop, string vCD_LoteID, string vNM_Campo, TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if ((vNR_LoteProducao.Trim() != "") && (vNR_LoteProducao.Trim() != "0")) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.NR_LoteProducao"; vBusca[vBusca.Length - 1].vVL_Busca = vNR_LoteProducao; vBusca[vBusca.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vDS_LoteProducao)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.DS_LoteProducao"; vBusca[vBusca.Length - 1].vVL_Busca = "('%" + vDS_LoteProducao + "%')"; vBusca[vBusca.Length - 1].vOperador = "like"; } if (!string.IsNullOrEmpty(vCD_LoteID)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_LoteID"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_LoteID + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } return(new TCD_CadLote(banco).Select(vBusca, vTop, vNM_Campo)); }
public static void PreencherCMINota(TRegistro_LanFaturamento val, TObjetoBanco banco) { //Buscar registro cmi CamadaDados.Fiscal.TList_CadCMI lCmi = CamadaNegocio.Fiscal.TCN_CadCMI.Busca(val.Cd_cmistring, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, false, false, false, false, false, false, false, banco); if (lCmi.Count > 0) { val.Cminf.Clear(); val.Cminf.Add( new TRegistro_LanFaturamento_CMI() { St_complementar = lCmi[0].St_complementar, St_devolucao = lCmi[0].St_devolucao, St_geraestoque = lCmi[0].St_geraestoque, St_mestra = lCmi[0].St_mestra, St_simplesremessa = lCmi[0].St_simplesremessa, St_compdevimposto = lCmi[0].St_compdevimposto, St_retorno = lCmi[0].St_retorno }); } }
// regras de gravacao de aplicacao public static TList_LanAplicacaoPedido Buscar(string vID_Aplicacao, string vNR_Pedido, string vCD_Produto, string vCD_Empresa, string vID_LanctoEstoque, string vID_Ticket, string vTP_Pesagem, TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if ((vID_Aplicacao.Trim() != string.Empty) && (vID_Aplicacao.Trim() != "0")) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.ID_Aplicacao"; vBusca[vBusca.Length - 1].vVL_Busca = vID_Aplicacao; vBusca[vBusca.Length - 1].vOperador = "="; } if ((vNR_Pedido.Trim() != string.Empty) && (vNR_Pedido.Trim() != "0")) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.NR_Pedido"; vBusca[vBusca.Length - 1].vVL_Busca = vNR_Pedido; vBusca[vBusca.Length - 1].vOperador = "="; } if (vCD_Produto.Trim() != string.Empty) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.CD_Produto"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vCD_Produto.Trim() + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } if (vCD_Empresa.Trim() != string.Empty) { 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 ((vID_LanctoEstoque.Trim() != string.Empty) && (vID_LanctoEstoque.Trim() != "0")) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.ID_LanctoEstoque"; vBusca[vBusca.Length - 1].vVL_Busca = vID_LanctoEstoque; vBusca[vBusca.Length - 1].vOperador = "="; } if ((vID_Ticket.Trim() != string.Empty) && (vID_Ticket.Trim() != "0")) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.ID_Ticket"; vBusca[vBusca.Length - 1].vVL_Busca = vID_Ticket; vBusca[vBusca.Length - 1].vOperador = "="; } if (vTP_Pesagem.Trim() != string.Empty) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.TP_Pesagem"; vBusca[vBusca.Length - 1].vVL_Busca = "'" + vTP_Pesagem.Trim() + "'"; vBusca[vBusca.Length - 1].vOperador = "="; } return(new TCD_LanAplicacaoPedido(banco).Select(vBusca, 0, string.Empty, string.Empty, string.Empty)); }
public static TList_CadCidade Buscar(string vCd_cidade, string vDs_cidade, string vUf, string vNm_campo, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(vCd_cidade)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_Cidade"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_cidade.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vDs_cidade)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.DS_Cidade"; filtro[filtro.Length - 1].vVL_Busca = "('%" + vDs_cidade.ToString().Trim().Replace("'", "''") + "%' COLLATE Latin1_General_CI_AI )"; filtro[filtro.Length - 1].vOperador = "like"; } if (!string.IsNullOrEmpty(vUf)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "b.UF"; filtro[filtro.Length - 1].vVL_Busca = "'" + vUf.ToString().Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } return(new TCD_CadCidade(banco).Select(filtro, vTop, vNm_campo)); }
public static TList_CTB_CFGNFCe Buscar(string Id_cfgctb, string Cd_empresa, string Cd_cfop, TObjetoBanco banco) { TpBusca[] vBusca = new TpBusca[0]; if (!string.IsNullOrEmpty(Id_cfgctb)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.ID_CFGCTB"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = Id_cfgctb; } 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(Cd_cfop)) { Array.Resize(ref vBusca, vBusca.Length + 1); vBusca[vBusca.Length - 1].vNM_Campo = "a.cd_cfop"; vBusca[vBusca.Length - 1].vOperador = "="; vBusca[vBusca.Length - 1].vVL_Busca = "'" + Cd_cfop.Trim() + "'"; } return(new TCD_CTB_CFGNFCe(banco).Select(vBusca, 0, string.Empty)); }
public static decimal Valor_Medio_Est_Produto(string vCd_empresa, string vCd_Produto, TObjetoBanco banco) { if ((string.IsNullOrEmpty(vCd_empresa)) || (string.IsNullOrEmpty(vCd_Produto))) { return(0); } object obj = new TCD_LanEstoque(banco).BuscarSaldo_EstoqueEscalar( new TpBusca[] { new TpBusca() { vNM_Campo = "a.cd_empresa", vOperador = "=", vVL_Busca = "'" + vCd_empresa.Trim() + "'" }, new TpBusca() { vNM_Campo = "a.cd_produto", vOperador = "=", vVL_Busca = "'" + vCd_Produto.Trim() + "'" } }, "a.vl_medio"); return(obj == null ? decimal.Zero : Convert.ToDecimal(obj.ToString())); }
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_ParamClasse BuscaParamRDCSQLString(string SQL, TObjetoBanco banco) { TList_Cad_ParamClasse lParamRetorno = new TList_Cad_ParamClasse(); const char chaveInicio = '{'; const char chaveFim = '}'; char[] delimitadores = new char[] { chaveInicio, chaveFim }; String[] resultadoArray = SQL.Split(delimitadores); for (int i = 0; i < resultadoArray.Length; i++) { if (resultadoArray[i].IndexOf("@") == 0) { TList_Cad_ParamClasse listaParam = TCN_Cad_ParamClasse.Buscar("", "{" + resultadoArray[i] + "}", "", 0, banco); for (int x = 0; x < listaParam.Count; x++) { if (!lParamRetorno.Exists(p => p.NM_CampoFormat == (listaParam[x] as TRegistro_Cad_ParamClasse).NM_CampoFormat)) { //ADD A LISTA DE RETORNO DOS PARAMETROS lParamRetorno.Add(listaParam[x] as TRegistro_Cad_ParamClasse); } } } } return(lParamRetorno); }
public static TList_Cad_OriginacaoCustoHeadge Buscar(decimal vID_Originacao, decimal vID_Headge, decimal vID_LanctoHeadge, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if ((vID_Originacao > 0)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_Originacao"; filtro[filtro.Length - 1].vVL_Busca = vID_Originacao.ToString(); filtro[filtro.Length - 1].vOperador = "="; } if (vID_Headge > 0) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_Headge"; filtro[filtro.Length - 1].vVL_Busca = vID_Headge.ToString(); filtro[filtro.Length - 1].vOperador = "="; } if (vID_LanctoHeadge > 0) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_LanctoHeadge"; filtro[filtro.Length - 1].vVL_Busca = vID_LanctoHeadge.ToString(); filtro[filtro.Length - 1].vOperador = "="; } return(new TCD_Cad_OriginacaoCustoHeadge().Select(filtro, vTop, "")); }
public static string Gravar(TRegistro_CTB_CFGProvisao_Estoque val, TObjetoBanco banco) { bool st_transacao = false; TCD_CTB_CFGProvisao_Estoque qtb_CTB_CFGProvisao_Estoque = new TCD_CTB_CFGProvisao_Estoque(); try { if (banco == null) { st_transacao = qtb_CTB_CFGProvisao_Estoque.CriarBanco_Dados(true); } else { qtb_CTB_CFGProvisao_Estoque.Banco_Dados = banco; } if (!val.ID_CFGCTB.HasValue) { Utils.TpBusca[] filtro = new Utils.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_produto"; filtro[1].vOperador = "="; filtro[1].vVL_Busca = "'" + val.CD_Produto.Trim() + "'"; filtro[2].vNM_Campo = "a.tp_movimento"; filtro[2].vOperador = "="; filtro[2].vVL_Busca = "'" + val.Tp_movimento.Trim() + "'"; object obj = qtb_CTB_CFGProvisao_Estoque.BuscarEscalar(filtro, "a.id_cfgctb"); if (obj != null) { val.ID_CFGCTB = decimal.Parse(obj.ToString()); } } val.ID_CFGCTB_String = CamadaDados.TDataQuery.getPubVariavel(qtb_CTB_CFGProvisao_Estoque.Grava(val), "@P_ID_CFGCTB"); if (st_transacao) { qtb_CTB_CFGProvisao_Estoque.Banco_Dados.Commit_Tran(); } return(val.ID_CFGCTB_String); } catch (Exception ex) { if (st_transacao) { qtb_CTB_CFGProvisao_Estoque.Banco_Dados.RollBack_Tran(); } throw new Exception("Erro gravar registro: " + ex.Message.Trim()); } finally { if (st_transacao) { qtb_CTB_CFGProvisao_Estoque.deletarBanco_Dados(); } } }
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(); } } }
public static TList_ConfigAdto Buscar(string vCd_empresa, string vCd_historico_adto_c, string vCd_historico_adto_r, string vCd_historico_devadto_c, string vCd_historico_devadto_r, int vTop, string vNm_campo, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(vCd_empresa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_Empresa"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_empresa.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } else { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = "exists"; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from tb_div_usuario_x_empresa x " + "where x.cd_empresa = a.cd_empresa " + "and ((x.login = '******') or " + "(exists(select 1 from tb_div_usuario_x_grupos y " + " where y.logingrp = x.login and y.loginusr = '******'))))"; } if (!string.IsNullOrEmpty(vCd_historico_adto_c)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_Historico_Adto_C"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_historico_adto_c.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vCd_historico_adto_r)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_Historico_Adto_R"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_historico_adto_r.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vCd_historico_devadto_c)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_Historico_DEVAdto_C"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_historico_devadto_c.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vCd_historico_devadto_r)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_Historico_DEVAdto_R"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_historico_devadto_r.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } return(new TCD_CadConfigAdto(banco).Select(filtro, vTop, vNm_campo)); }
public void deletarBanco_Dados() { if (pBanco_Dados.Conexao.State == ConnectionState.Open) { pBanco_Dados.Conexao.Close(); } pBanco_Dados = null; }
public static void Valores_EstoqueLocal(string vCd_empresa, string vCd_Produto, string vCd_local, ref decimal vTot_Entrada, ref decimal vTot_Saida, ref decimal vTot_Saldo, ref decimal vVL_Estoque_ent, ref decimal vVL_Estoque_sai, ref decimal vVL_SaldoEstoque, ref decimal vVL_Medio, TObjetoBanco banco) { if ((!string.IsNullOrEmpty(vCd_empresa)) && (!string.IsNullOrEmpty(vCd_Produto)) && (!string.IsNullOrEmpty(vCd_local))) { System.Data.DataTable tb_estoque = new TCD_LanEstoque(banco).BuscarSaldo_EstoqueLocal( new TpBusca[] { new TpBusca() { vNM_Campo = "a.cd_empresa", vOperador = "=", vVL_Busca = "'" + vCd_empresa.Trim() + "'" }, new TpBusca() { vNM_Campo = "a.cd_produto", vOperador = "=", vVL_Busca = "'" + vCd_Produto.Trim() + "'" }, new TpBusca() { vNM_Campo = "a.cd_local", vOperador = "=", vVL_Busca = "'" + vCd_local.Trim() + "'" } }, 0, string.Empty, string.Empty); if (tb_estoque != null) { if (tb_estoque.Rows.Count > 0) { try { vTot_Entrada = Convert.ToDecimal(tb_estoque.Rows[0]["tot_entrada"].ToString()); vTot_Saida = Convert.ToDecimal(tb_estoque.Rows[0]["tot_saida"].ToString()); vTot_Saldo = Convert.ToDecimal(tb_estoque.Rows[0]["tot_saldo"].ToString()); vVL_Estoque_ent = Convert.ToDecimal(tb_estoque.Rows[0]["vl_estoque_ent"].ToString()); vVL_Estoque_sai = Convert.ToDecimal(tb_estoque.Rows[0]["vl_estoque_sai"].ToString()); vVL_SaldoEstoque = Convert.ToDecimal(tb_estoque.Rows[0]["vl_saldoEstoque"].ToString()); vVL_Medio = Convert.ToDecimal(tb_estoque.Rows[0]["vl_medio"].ToString()); } catch {} } } } }
public static string Gravar(TRegistro_ReservaChopp val, TRegistro_ItensReserva rChopeira, bool St_kitextrator, TObjetoBanco banco) { bool st_transacao = false; TCD_ReservaChopp query = new TCD_ReservaChopp(); try { if (banco == null) { st_transacao = query.CriarBanco_Dados(true); } else { query.Banco_Dados = banco; } val.Id_reserva = Convert.ToInt32(CamadaDados.TDataQuery.getPubVariavel(query.Gravar(val), "@P_ID_RESERVA")); if (rChopeira != null) { val.Itens.Add(rChopeira); } if (St_kitextrator) { val.Itens.Add(new TRegistro_ItensReserva { St_kitextrator = true }); } val.Itens.ForEach(p => { p.Cd_empresa = val.Cd_empresa; p.Id_reserva = val.Id_reserva; TCN_ItensReserva.Gravar(p, query.Banco_Dados); }); if (st_transacao) { query.Banco_Dados.Commit_Tran(); } return(val.Id_reserva.ToString()); } catch (Exception ex) { if (st_transacao) { query.Banco_Dados.RollBack_Tran(); } throw new Exception("Erro gravar reserva: " + ex.Message.Trim()); } finally { if (st_transacao) { query.deletarBanco_Dados(); } } }
public static TList_Lan_Originacao_x_Faturamento Buscar(decimal vID_Originacao, string vCD_Empresa, decimal vNr_LanctoFiscal, decimal vID_NFITem, decimal vQTD_Origem, decimal vVL_Origem, string vNm_campo, int vTop, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if ((vID_Originacao > 0)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_Originacao"; filtro[filtro.Length - 1].vVL_Busca = vID_Originacao.ToString(); filtro[filtro.Length - 1].vOperador = "="; } if (vCD_Empresa.Trim() != string.Empty) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_Empresa"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCD_Empresa.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } if (vNr_LanctoFiscal > 0) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.Nr_LanctoFiscal"; filtro[filtro.Length - 1].vVL_Busca = vNr_LanctoFiscal.ToString(); filtro[filtro.Length - 1].vOperador = "="; } if (vID_NFITem > 0) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_NFITem"; filtro[filtro.Length - 1].vVL_Busca = vID_NFITem.ToString(); filtro[filtro.Length - 1].vOperador = "="; } if (vQTD_Origem > 0) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.QTD_Origem"; filtro[filtro.Length - 1].vVL_Busca = vQTD_Origem.ToString(); filtro[filtro.Length - 1].vOperador = "="; } if (vVL_Origem > 0) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.VL_Origem"; filtro[filtro.Length - 1].vVL_Busca = vVL_Origem.ToString(); filtro[filtro.Length - 1].vOperador = "="; } return(new TCD_Lan_Originacao_x_Faturamento().Select(filtro, vTop, vNm_campo)); }
public static Tlist_Inventario Busca(string vId_inventario, string vCd_empresa, string vSt_inventario, string vDt_ini, string vDt_fin, TObjetoBanco banco) { TpBusca[] filtro = new TpBusca[0]; if (!string.IsNullOrEmpty(vId_inventario)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.ID_Inventario"; filtro[filtro.Length - 1].vVL_Busca = vId_inventario; filtro[filtro.Length - 1].vOperador = "="; } if (!string.IsNullOrEmpty(vCd_empresa)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.CD_Empresa"; filtro[filtro.Length - 1].vVL_Busca = "'" + vCd_empresa.Trim() + "'"; filtro[filtro.Length - 1].vOperador = "="; } else { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = "EXISTS"; filtro[filtro.Length - 1].vVL_Busca = "(select 1 from tb_div_usuario_x_empresa x " + "where x.cd_empresa = a.cd_empresa " + "and ((x.login = '******') or " + "(exists(select 1 from tb_div_usuario_x_grupos y " + " where y.logingrp = x.login and y.loginusr = '******'))))"; } if (!string.IsNullOrEmpty(vSt_inventario)) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "isnull(a.st_inventario, 'A')"; filtro[filtro.Length - 1].vOperador = "in"; filtro[filtro.Length - 1].vVL_Busca = "(" + vSt_inventario.Trim() + ")"; } if ((!string.IsNullOrEmpty(vDt_ini)) && (vDt_ini.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.dt_inventario"; filtro[filtro.Length - 1].vOperador = ">="; filtro[filtro.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(vDt_ini).ToString("yyyyMMdd")) + " 00:00:00'"; } if ((!string.IsNullOrEmpty(vDt_fin)) && (vDt_fin.Trim() != "/ /")) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "a.dt_inventario"; filtro[filtro.Length - 1].vOperador = "<="; filtro[filtro.Length - 1].vVL_Busca = "'" + string.Format(new System.Globalization.CultureInfo("en-US", true), Convert.ToDateTime(vDt_fin).ToString("yyyyMMdd")) + " 23:59:59'"; } return(new TCD_Inventario(banco).Select(filtro, 0, string.Empty)); }