private void AtribuirEstrutura(EstruturaClienteEndereco estrutura) { this.Control.ID = estrutura.ID; this.CEP.Valor = estrutura.CEP; this.Endereco.Valor = estrutura.Endereco; this.Numero.Valor = estrutura.Numero; this.Cidade.Valor = estrutura.Cidade; this.Estado.Valor = estrutura.Estado; this.Complemento.Valor = estrutura.Complemento; this.Bairro.Valor = estrutura.Bairro; this.Nome.Valor = estrutura.Nome; this.CPF.Valor = estrutura.CPF; this.RG.Valor = estrutura.RG; this.ClienteID.Valor = estrutura.ClienteID; this.EnderecoTipoID.Valor = estrutura.EnderecoTipoID; this.EnderecoPrincipal.Valor = estrutura.EnderecoPrincipal; this.StatusConsulta = estrutura.StatusConsulta; if (estrutura.EnderecoPrincipal) { this.LimparEnderecoPrincipal(); } }
public EstruturaClienteEndereco LerEstrutura(int ClienteEnderecoID) { EstruturaClienteEndereco retorno = new EstruturaClienteEndereco(); string sql = @"select tClienteEndereco.ID, CEP, Endereco, Numero, Cidade, Estado, Complemento, Bairro, tClienteEndereco.Nome, ISNULL(CPF,'-') as CPF, RG, ClienteID,EnderecoTipoID,tEnderecoTipo.nome as EnderecoTipo, EnderecoPrincipal, StatusConsulta from tClienteEndereco inner join tEnderecoTipo on tClienteEndereco.EnderecoTipoID = tEnderecoTipo.ID where tClienteEndereco.ID = " + ClienteEnderecoID; bd.Consulta(sql); if (bd.Consulta().Read()) { retorno.ID = bd.LerInt("ID"); retorno.CEP = bd.LerString("CEP"); retorno.Endereco = bd.LerString("Endereco"); retorno.Numero = bd.LerString("Numero"); retorno.Cidade = bd.LerString("Cidade"); retorno.Estado = bd.LerString("Estado"); retorno.Complemento = bd.LerString("Complemento"); retorno.Bairro = bd.LerString("Bairro"); retorno.Nome = bd.LerString("Nome"); retorno.CPF = bd.LerString("CPF"); retorno.RG = bd.LerString("RG"); retorno.ClienteID = bd.LerInt("ClienteID"); retorno.EnderecoTipoID = bd.LerInt("EnderecoTipoID"); retorno.EnderecoTipo = bd.LerString("EnderecoTipo"); retorno.EnderecoPrincipal = bd.LerBoolean("EnderecoPrincipal"); retorno.StatusConsulta = (enumStatusCPF)bd.LerInt("StatusConsulta"); } bd.Fechar(); return(retorno); }
public void Inserir(EstruturaClienteEndereco estrutura) { oClienteEndereco.Inserir(estrutura); }
public void Atualizar(EstruturaClienteEndereco estrutura) { oClienteEndereco.Atualizar(estrutura); }
public bool VerificaTaxas(List <int> listaEventoID, EstruturaEntregaAgenda entregaSelecionada, EstruturaClienteEndereco clienteEnderecoSelecionado) { try { bool retorno = true; string eventos = ""; foreach (int eventoID in listaEventoID) { if (eventos.Length > 0) { eventos += "," + eventoID; } else { eventos = eventoID.ToString(); } } int controleID = entregaSelecionada.EntregaControleID; string CEP = clienteEnderecoSelecionado.CEP == null ? "" : clienteEnderecoSelecionado.CEP; string strCEP = "and (CepInicial<" + CEP + "and CepFinal >" + CEP + ")"; string sql = @"select tEntregaControle.EntregaID , tEntregaControle.ID as EntregaControleID , tEntrega.Nome, PrazoEntrega, tEntrega.ProcedimentoEntrega, Tipo, tEntrega.DiasTriagem,tEntregaControle.Valor,ISNULL(tEntregaPeriodo.Nome,'') as Periodo from tEventoEntregaControle inner join tEntregaControle on tEventoEntregaControle.EntregaControleID = tEntregaControle.ID inner join tEntrega on tEntregaControle.EntregaID = tEntrega.ID inner join tEntregaAreaCep ON tEntregaControle.EntregaAreaID = tEntregaAreaCep.EntregaAreaID left join tEntregaPeriodo ON tEntregaControle.PeriodoID = tEntregaPeriodo.ID where tEventoEntregaControle.EventoID IN (" + eventos + @") and tEntregaControle.ID = " + controleID + @" and tEntrega.Tipo in ('A','N') " + (CEP.Length > 0 ? strCEP : "") + @"group by tEntregaControle.EntregaID,tEntregaControle.ID , tEntrega.Nome, PrazoEntrega, tEntrega.ProcedimentoEntrega, Tipo, tEntrega.DiasTriagem,tEntregaControle.Valor,tEntregaPeriodo.Nome having COUNT(Distinct tEventoEntregaControle.EventoID) = " + listaEventoID.Count + @" order by tEntregaControle.EntregaID"; bd.Consulta(sql); while (bd.Consulta().Read()) { retorno = false; } bd.Fechar(); return(retorno); } catch (Exception ex) { throw ex; } }
public void Atualizar(EstruturaClienteEndereco estrutura) { AtribuirEstrutura(estrutura); this.Atualizar(); }
public void Inserir(EstruturaClienteEndereco estrutura) { AtribuirEstrutura(estrutura); this.Inserir(); }