void Pesquisar() { this.reportViewer1.Clear(); this.reportViewer1.LocalReport.DataSources.Clear(); VeiculoCategoria categoria = (VeiculoCategoria)txtCategoria.SelectedItem; VeiculoEspecie especie = (VeiculoEspecie)txtEspecie.SelectedItem; VecimentoLicenciamento licenciamento = (VecimentoLicenciamento)txtLicenciamento.SelectedItem; List <Veiculo> list = new List <Veiculo>(); list = new RepositorioVeiculo(new UnitOfWork()).GetAll().Where(p => p.Ativo == true).ToList(); // tudo list = list.Where(v => v.Pessoa.Nome.Contains(txtPessoa.Text)).ToList(); if (categoria != VeiculoCategoria.NaoInformado) { list = list.Where(v => v.Categoria == categoria).ToList(); } if (especie != VeiculoEspecie.NaoInformado) { list = list.Where(v => v.Especie == especie).ToList(); } if (licenciamento != VecimentoLicenciamento.NaoInformado) { list = list.Where(v => v.Licenciamento == licenciamento).ToList(); } foreach (var item in list) { listRelacao.Add(new Relacao { Id = item.Pessoa.PessoaId, Proprietario = item.Pessoa.Nome, CpfCnpj = item.Pessoa.CpfCnpj, Placa = item.Placa.Valor, DescricaoVeiculo = item.DescricaoModelo, Renamvam = item.Renavam, Telefone1 = item.Pessoa.Telefone1, Telefone2 = item.Pessoa.Telefone2 }); } load(); }
public override void CarregarEntidadeDoForm() { entidade.ClearNotifications(); entidade.Endereco.ClearNotifications(); cidade.SetValidations(); pessoa.SetValidations(); marca.SetValidations(); Placa placa = new Placa(txtPlaca.Text, TipoPlaca.Comum); Endereco endereco = new Endereco(txtEnderecoLogradouro.Text.ToUpper().Trim(), txtEnderecoNumero.Text.ToUpper().Trim(), cidade, txtEnderecoBairro.Text.ToUpper().Trim(), txtEnderecoComplemento.Text.ToUpper().Trim(), txtEnderecoCEP.Text.ToUpper().Trim(), txtEnderecoCaixaPostal.Text.ToUpper().Trim()); VeiculoCategoria categoria = (VeiculoCategoria)txtCategoria.SelectedItem; VeiculoEspecie especie = (VeiculoEspecie)txtEspecie.SelectedItem; VecimentoLicenciamento licenciamento = (VecimentoLicenciamento)txtLicenciamento.SelectedItem; entidade.SetValues(placa, txtRenavam.Text.ToUpper().Trim(), txtChassi.Text.ToUpper().Trim(), txtMotor.Text.ToUpper().Trim(), txtAnoFab.Text.ToUpper().Trim(), txtAnoMod.Text.ToUpper().Trim(), txtDescricaoModelo.Text.ToUpper().Trim(), txtEspelho.Text.ToUpper().Trim(), txtCombustivel.Text.ToUpper().Trim(), txtCor.Text.ToUpper().Trim(), categoria, especie, licenciamento, endereco, pessoa, marca, metroCheckBox1.Checked, txtNomePropAnterior.Text.Trim().ToUpper(), txtCpfCnpjPropAnterior.Text.Trim().ToUpper(), txtDataCompra.Text.Trim().ToUpper().ToUpper(), txtValorCompra.Text.Trim().ToUpper(), txtNumeroNotaCompra.Text.Trim().ToUpper()); entidade.NomeComprador = txtCompradorNome.Text.Trim().ToUpper(); entidade.CpfCnpjComprador = txtCompradorCpfCnpj.Text.Trim().ToUpper(); entidade.DataVenda = txtCompradorData.Text.Trim().ToUpper(); entidade.ValorVenda = txtCompradorValor.Text.Trim().ToUpper(); }
} //construtor para EF public void SetValues(Placa placa, string renavam, string chassi, string motor, string AnoFab, string AnoMod, string descricaoModelo, string espelho, string combustivel, string cor, VeiculoCategoria categoria, VeiculoEspecie especie, VecimentoLicenciamento licenciamento, Endereco endereco, Pessoa pessoa, Marca marca, bool ativo, string NomeProprietarioAnterior, string CpfCnpjProprietarioAnterior, string DataDaCompra, string ValorDaCompra, string NumeroDaNotaDeCompra) { this.Placa = placa; this.Renavam = renavam.Trim().ToUpper(); this.Chassi = chassi.Trim().ToUpper(); this.Motor = motor.Trim().ToUpper(); this.AnoFab = AnoFab.Trim().ToUpper(); this.AnoModelo = AnoMod.Trim().ToUpper(); this.DescricaoModelo = descricaoModelo.Trim().ToUpper(); this.Espelho = espelho.Trim().ToUpper(); this.Categoria = categoria; this.Especie = especie; this.Licenciamento = licenciamento; this.Endereco = endereco; this.Pessoa = pessoa; this.Cor = cor.Trim().ToUpper(); this.Combustivel = combustivel.Trim().ToUpper(); this.Marca = marca; this.Ativo = ativo; this.NomeProprietarioAnterior = NomeProprietarioAnterior; this.CpfCnpjProprietarioAnterior = CpfCnpjProprietarioAnterior; this.DataDaCompra = DataDaCompra.Trim().ToUpper(); this.ValorDaCompra = ValorDaCompra.Trim().ToUpper(); this.NumeroDaNotaDeCompra = NumeroDaNotaDeCompra; SetValidations(); }