public void slipknot(EntidadeDominio entidade) { Bilhete Classe = (Bilhete)entidade; try { if (string.IsNullOrEmpty(Classe.Email)) { return;// "email invalido"; } else { //OpenPop.Pop3.Pop3Client cliente = new OpenPop.Pop3.Pop3Client(); //cliente.Authenticate("", ); SmtpClient c = new SmtpClient("smtp.gmail.com", 587); MailAddress add = new MailAddress(Classe.Email); MailMessage msg = new MailMessage(); msg.To.Add(add); msg.From = new MailAddress("*****@*****.**"); msg.IsBodyHtml = true; msg.Subject = @"Agradecimento"; msg.Body = "obrigado por voar com a gente"; if (ServicePointManager.SecurityProtocol != SecurityProtocolType.Tls12) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; } c.Credentials = new System.Net.NetworkCredential("*****@*****.**", "5djcam67"); c.EnableSsl = true; c.Send(msg); } } catch { } }
public override void salvar(EntidadeDominio entidade) { if (connection.State == ConnectionState.Closed) { connection.Open(); } Bilhete Classe = (Bilhete)entidade; pst.Dispose(); pst = new NpgsqlCommand(); pst.CommandText = "insert into bilhete ( nome , rg , cpf ,email , sexo , passaporte , viagem_id ) values ( :no,:nome,:nomm,:nom,:sex,:passpor,:via ) returning bilhete_id"; parameters = new NpgsqlParameter[] { new NpgsqlParameter("no", Classe.Nome), new NpgsqlParameter("nome", Classe.RG), new NpgsqlParameter("nomm", Classe.cpf), new NpgsqlParameter("nom", Classe.Email), new NpgsqlParameter("sex", Classe.Sexo), new NpgsqlParameter("passpor", Classe.passaporte), new NpgsqlParameter("via", Classe.passagem.ID), }; pst.Parameters.Clear(); pst.Parameters.AddRange(parameters); pst.Connection = connection; pst.CommandType = CommandType.Text; Classe.ID = (int)pst.ExecuteScalar(); pst.CommandText = "commit work"; pst.ExecuteNonQuery(); connection.Close(); return; }
public async Task <IActionResult> Edit(int id, [Bind("TicketID,email,Descrição,DataCompra,EventoFK2,Preco,IDFK")] Bilhete bilhete) { if (id != bilhete.TicketID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bilhete); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BilheteExists(bilhete.TicketID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EventoFK2"] = new SelectList(_context.Set <Evento>(), "EvId", "EvId", bilhete.EventoFK2); ViewData["IDFK"] = new SelectList(_context.Set <Utilizador>(), "UserID", "UserID", bilhete.IDFK); return(View(bilhete)); }
public static Bilhete Resultado() { Bilhete bil = new Bilhete(); var URI = new Uri("https://confiraloterias.com.br/api/json/?loteria=lotofacil&token=Bq4lqw1m9odXiJ9"); using (HttpClient request = new HttpClient()) { using (Task <HttpResponseMessage> response = request.GetAsync(URI)) { if (response.Result.IsSuccessStatusCode) { String jsonString = response.Result.Content.ReadAsStringAsync().Result; RootObject obj = JsonConvert.DeserializeObject <RootObject>(jsonString); IList <int> list = new List <int>(); if (obj.concurso != null) { foreach (string dezenas in obj.concurso.dezenas) { list.Add(int.Parse(dezenas)); } } bil.Numeros = list; return(bil); } } } return(bil); }
public RecebimentoTestes() { _provedorDoTempo = new ProvedorDataHoraSistema(); _recebimento = new Recebimento(); _veiculo = new FabricaDeVeiculo().ComAPlacaPadrao().Criar(); _bilhete = new Bilhete(_ticketId, DateTime.UtcNow, _veiculo); _ticket = new Ticket(_bilhete.TicketId, _bilhete.DataHoraDeEntrada, _bilhete.Veiculo); }
private void loadBilhetes(object sender = null, EventArgs e = null) { if (!Connection.verifySGBDConnection()) { return; } String queryDate = "@data=" + datePicked; if (datePicked != "null") { queryDate = "@data='" + datePicked + "'"; } String query = "exec getClientBilhetes @cc=" + Cliente.Escolhido.CC + "," + queryDate + ", @estacao_" + "partida=" + EstacaoPartida + ", @estacao_chegada=" + EstacaoChegada; if (!Clean.IsClean(query)) { MessageBox.Show(Clean.Err()); return; } SqlCommand cmd = new SqlCommand(query, Connection.get()); SqlDataReader reader = cmd.ExecuteReader(); listBoxBilhetes.Items.Clear(); while (reader.Read()) { Bilhete b = new Bilhete(); b.BilheteID = reader["bilheteID"].ToString(); b.Preco = reader["preco"].ToString(); b.Data = reader["data"].ToString(); b.ParagemPartida = reader["paragem_partida"].ToString(); b.ParagemChegada = reader["paragem_chegada"].ToString(); b.Comboio = reader["lugar_comboio"].ToString(); b.Carruagem = reader["lugar_carruagem"].ToString(); b.Lugar = reader["lugar_n"].ToString(); b.Partida = reader["partida"].ToString(); b.HoraPartida = reader["hora_partida"].ToString(); b.Chegada = reader["chegada"].ToString(); b.HoraChegada = reader["hora_chegada"].ToString(); listBoxBilhetes.Items.Add(b); } currentBilhete = 0; if (listBoxBilhetes.Items.Count == 0) { listBoxBilhetes.Items.Add("Sem bilhetes a apresentar"); currentBilhete = -1; } Connection.close(); ShowBilhete(); }
public void Print(Bilhete obj) { bilhete = obj; doc = new PrintDocument(); //DefaultPageSettings //doc.QueryPageSettings += Doc_QueryPageSettings; doc.PrintPage += Doc_PrintPage; doc.DefaultPageSettings.PaperSize = bilhete.PaperSize; //= new PaperSize("210 x 297 mm", 800, 800); doc.Print(); }
public BilheteDTO(Bilhete bilhete) { Id = bilhete.Id; Data = string.Concat(bilhete.Data.Day + "/" + bilhete.Data.Month + "/" + bilhete.Data.Year); PrecoNormal = bilhete.PrecoNormal.ToString(); PrecoDiaAnterior = bilhete.PrecoDiaAnterior.ToString(); PrecoNoDia = bilhete.PrecoNoDia.ToString(); PrecoNoDiaForaHoras = bilhete.PrecoNoDiaForaHoras.ToString(); BilheteiraOnlineUrl = bilhete.Link.Url; }
public static String returnString(Bilhete bilhete) { String resultado = String.Empty; foreach (var item in bilhete.Numeros) { resultado += String.Format(" {0} ", item); } return(resultado); }
public void Deve_obter_um_bilhete_emitido() { //arrange IServicoDeCondutor servicoDeCondutor = new ServicoDeCondutor(_repositorioDeLeituraTickets); //act var bilhete = servicoDeCondutor.ObterBilheteEmitidoPor(1); //assert var placaEsperada = new Placa("NHC 3030"); var veiculoEsperado = new Veiculo(placaEsperada); var bilheteEsperado = new Bilhete(1, new DateTime(2018, 01, 01, 00, 00, 000), veiculoEsperado); Assert.Equal(bilheteEsperado, bilhete); }
public async Task <IActionResult> Create([Bind("TicketID,email,Descrição,DataCompra,EventoFK2,Preco,IDFK")] Bilhete bilhete) { if (ModelState.IsValid) { //encontrar o ID Utilizador do user autenticado, adicionar data de compra e criar o bilhete bilhete.IDFK = _context.Utilizador.Where(b => b.Nome == User.Identity.Name).Select(b => b.UserID).FirstOrDefault(); bilhete.email = User.Identity.Name; bilhete.DataCompra = DateTime.Now; _context.Add(bilhete); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EventoFK2"] = new SelectList(_context.Set <Evento>(), "EvId", "EvId", bilhete.EventoFK2); ViewData["IDFK"] = new SelectList(_context.Set <Utilizador>(), "UserID", "UserID", bilhete.IDFK); return(View(bilhete)); }
private void ShowBilhete() { if (listBoxBilhetes.Items.Count == 0 | currentBilhete < 0) { return; } Bilhete b = (Bilhete)listBoxBilhetes.Items[currentBilhete]; textBoxBilheteCarr.Text = b.Carruagem; textBoxBilheteChegada.Text = b.Chegada; textBoxBilheteChegadaHora.Text = b.HoraChegada; textBoxBilheteComboio.Text = b.Comboio; textBoxBilheteData.Text = b.Data; textBoxBilheteLugar.Text = b.Lugar; textBoxBilhetePartida.Text = b.Partida; textBoxBilhetePartidaHora.Text = b.HoraPartida; textBoxBilheteValor.Text = b.Preco; }
//lê lista de bilhetes private void LerLista() { StreamReader sr; if (File.Exists(Bilhete.FicheiroBilhetes)) { sr = File.OpenText(Bilhete.FicheiroBilhetes); string linha = string.Empty; try { while ((linha = sr.ReadLine()) != null) // enquanto as linhas nao tiverem vazias { string[] colunas = linha.ToString().Split(','); if (colunas.Length >= 6) { Bilhete bilhete = new Bilhete { Id = new Voo(colunas[0]), IdBilhete = colunas[1], Nome = colunas[2], Documento = colunas[3], Classe = colunas[4], Lugar = colunas[5], }; bilheteBindingSource.Add(bilhete); } } } catch (Exception) { MessageBox.Show("Ocorreu um erro na gravação do ficheiro"); } finally { sr.Close(); } } }
public void OnPostWay2(string data) { Bilhete a = new Bilhete() { Nome = Request.Form["nome"], RG = Request.Form["RG"], cpf = Request.Form["CPF"], Email = Request.Form["email"], passaporte = Request.Form["Passaporte"], Sexo = Convert.ToBoolean(Request.Form["sexo"]) }; var venn = HttpContext.Session.GetObjectFromJson <Venda>(devil); if (venn != null) { ven = venn; } string cod = HttpContext.Session.GetString("cod"); if (!string.IsNullOrEmpty(cod)) { var go = ven.Viagems.Find(x => x.Voo.ID == int.Parse(cod)); go.Passageiros.Add(a); if (go.qtd < go.Passageiros.Count) { go.qtd = go.Passageiros.Count; } } HttpContext.Session.SetObjectAsJson(devil, ven); var bora = ven.Viagems.Find(x => x.Voo.ID == int.Parse(cod)); if (bora.qtd <= bora.Passageiros.Count) { Response.Redirect("./cart"); } listItems = GetRoles(); listItems1 = GetRoles1(); devill = GetRoles3(); }
public async Task <IActionResult> Comprar(Bilhete bilhete, [Bind("EvId,Local,Titulo,Preco")] Evento evento) { if (ModelState.IsValid) { //var ev = _context.Evento.Where(e => e.EvId == evento.EvId).Select(b=>b.Preco).FirstOrDefault(); var ev = await _context.Evento.FindAsync(evento.EvId); //encontrar nome do local var loc = _context.Local.Where(b => b.ID == evento.LocalFK).Select(b => b.NomeLocal).FirstOrDefault(); //encontrar o ID Utilizador do user autenticado bilhete.IDFK = _context.Utilizador.Where(b => b.Nome == User.Identity.Name).Select(b => b.UserID).FirstOrDefault(); bilhete.email = User.Identity.Name; bilhete.DataCompra = DateTime.Now; //recebe preco do evento atraves do nome do select if (ev.Preco == 0) { var p = Request.Form["pr"]; bilhete.Preco = decimal.Parse(Request.Form["pr"]); } else { bilhete.Preco = ev.Preco; } bilhete.Descrição = string.Concat(loc, ev.Titulo); bilhete.EventoFK2 = evento.EvId; _context.Add(bilhete); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EventoFK2"] = new SelectList(_context.Set <Evento>(), "EvId", "EvId", bilhete.EventoFK2); ViewData["IDFK"] = new SelectList(_context.Set <Utilizador>(), "UserID", "UserID", bilhete.IDFK); // ViewData["conf"] = "<script>alert('Change succesfully');</script>"; //return View(bilhete); return(RedirectToAction(nameof(Index))); }
public override List <EntidadeDominio> consultar(EntidadeDominio entidade) { try { if (connection.State == ConnectionState.Closed) { connection.Open(); } pst.Dispose(); Bilhete Classe = (Bilhete)entidade; string sql = null; if (Classe.Nome == null) { Classe.Nome = ""; } if (Classe.ID == 0 && Classe.passagem.Voo.ID == 0 && string.IsNullOrEmpty(Classe.Nome)) { sql = "SELECT * FROM bilhete "; } else if (Classe.ID == 0 && string.IsNullOrEmpty(Classe.Nome)) { sql = "SELECT * FROM bilhete join viagem using(viagem_id ) join passagens using(pass_id) WHERE pass_id= :cod"; } else if (string.IsNullOrEmpty(Classe.Nome)) { sql = "SELECT * FROM bilhete join viagem using(viagem_id ) join passagens using(pass_id) WHERE bilhete_id = :co"; } else { sql = "SELECT * FROM bilhete join viagem using(viagem_id ) join passagens using(pass_id) where nome ilike :codd ||'%'"; } pst = new NpgsqlCommand(); pst.CommandText = sql; parameters = new NpgsqlParameter[] { new NpgsqlParameter("co", Classe.ID), new NpgsqlParameter("cod", Classe.passagem.Voo.ID), new NpgsqlParameter("codd", Classe.Nome) }; pst.Parameters.Clear(); pst.Parameters.AddRange(parameters); pst.Connection = connection; pst.CommandType = CommandType.Text; //pst.ExecuteNonQuery(); vai = pst.ExecuteReader(); List <EntidadeDominio> Classes = new List <EntidadeDominio>(); Bilhete p; while (vai.Read()) { p = new Bilhete(); p.ID = Convert.ToInt32(vai["bilhete_id"]); p.Nome = (vai["nome"].ToString()); p.cpf = (vai["cpf"].ToString()); p.RG = (vai["rg"].ToString()); p.Sexo = Convert.ToBoolean(vai["sexo"]); p.passagem.ID = Convert.ToInt32(vai["viagem_id"]); if (Classe.ID != 0 || (Classe.passagem.Voo.ID != 0 || !string.IsNullOrEmpty(Classe.Nome))) { p.passagem.Tipo.ID = Convert.ToInt32(vai["class_id"]); p.passagem.Voo.ID = Convert.ToInt32(vai["pass_id"]); } Classes.Add(p); } vai.Close(); connection.Close(); return(Classes); } catch (NpgsqlException ora) { vai.Close(); connection.Close(); throw ora; } }
public void EnsureSeedData(IHostingEnvironment env) { if (!LocaisAtividades.Any()) { LocaisAtividades.AddRange( new LocalAtividadeAcademica { Nome = "Coliseu do Porto", Latitude = 41.1469917, Longitude = -8.605416999999989 }, new LocalAtividadeAcademica { Nome = "Avenida dos Aliados", Latitude = 41.1484572, Longitude = -8.610746400000039 }, new LocalAtividadeAcademica { Nome = "Aula Magna da Universidade Portucalense", Latitude = 41.1804589, Longitude = -8.605948000000012 }, new LocalAtividadeAcademica { Nome = "Cidade do Porto", Latitude = 41.1494466, Longitude = -8.607507199999986 }, new LocalAtividadeAcademica { Nome = "Teatro Sá da Bandeira", Latitude = 41.146793, Longitude = -8.608879099999967 }, new LocalAtividadeAcademica { Nome = "Casa dos Arcos", Latitude = 41.1657561, Longitude = -8.670960700000023 } ); SaveChanges(); } if (!PontosVenda.Any()) { PontosVenda.AddRange( new PontoVenda { Nome = "FAP", Latitude = 41.1523043, Longitude = -8.636018499999977, DescricaoAdicional = "teste" }, new PontoVenda { Nome = "Campus S.João", Latitude = 41.18024569999999, Longitude = -8.604281899999933, DescricaoAdicional = "teste" }, new PontoVenda { Nome = "Queimódromo", Latitude = 41.17346102935757, Longitude = -8.68374690413475, DescricaoAdicional = "teste" }, new PontoVenda { Nome = "El Corte Inglés", Latitude = 41.125627, Longitude = -8.604804999999942, DescricaoAdicional = "teste" } ); SaveChanges(); } if (!Bilheteiras.Any()) { Bilheteira bilheteira = new Bilheteira { PrecoIngressoSemanal = 40.00m, Condicoes = "Teste Condições" }; Bilheteiras.Add(bilheteira); SaveChanges(); Link link_bilhete1 = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Bilhete dia 1", Url = "www.online.pt" }; Link link_bilhete2 = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Bilhete dia 2", Url = "www.online.pt" }; Link link_bilhete3 = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Bilhete dia 3", Url = "www.online.pt" }; Link link_bilhete4 = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Bilhete dia 4", Url = "www.online.pt" }; Link link_bilhete5 = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Bilhete dia 5", Url = "www.online.pt" }; Link link_bilhete6 = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Bilhete dia 6", Url = "www.online.pt" }; Link link_bilhete7 = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Bilhete dia 7", Url = "www.online.pt" }; Link link_bilhete8 = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Bilhete dia 8", Url = "www.online.pt" }; Link link_ingresso_semanal = new Link { Categoria = Categoria.Bilheteira, Descricao = "Link Ingresso Semanal", Url = "www.ingresso.pt" }; Links.AddRange(link_bilhete1, link_bilhete2, link_bilhete3, link_bilhete4, link_bilhete5, link_bilhete6, link_bilhete7, link_bilhete8, link_ingresso_semanal); SaveChanges(); bilheteira.Link = link_ingresso_semanal; bilheteira.LinkId = link_ingresso_semanal.Id; Bilhete bilhete_dia1 = new Bilhete { Data = new DateTime(2016, 05, 01), Link = link_bilhete1, LinkId = link_bilhete1.Id, PrecoNormal = 8.00m, PrecoDiaAnterior = 9.00m, PrecoNoDia = 10.00m, PrecoNoDiaForaHoras = 12.00m, Bilheteira = bilheteira, BilheteiraId = bilheteira.Id }; Bilhete bilhete_dia2 = new Bilhete { Data = new DateTime(2016, 05, 02), Link = link_bilhete2, LinkId = link_bilhete2.Id, PrecoNormal = 8.00m, PrecoDiaAnterior = 9.00m, PrecoNoDia = 10.00m, PrecoNoDiaForaHoras = 12.00m, Bilheteira = bilheteira, BilheteiraId = bilheteira.Id }; Bilhete bilhete_dia3 = new Bilhete { Data = new DateTime(2016, 05, 03), Link = link_bilhete3, LinkId = link_bilhete3.Id, PrecoNormal = 8.00m, PrecoDiaAnterior = 9.00m, PrecoNoDia = 10.00m, PrecoNoDiaForaHoras = 12.00m, Bilheteira = bilheteira, BilheteiraId = bilheteira.Id }; Bilhete bilhete_dia4 = new Bilhete { Data = new DateTime(2016, 05, 04), Link = link_bilhete4, LinkId = link_bilhete4.Id, PrecoNormal = 8.00m, PrecoDiaAnterior = 9.00m, PrecoNoDia = 10.00m, PrecoNoDiaForaHoras = 12.00m, Bilheteira = bilheteira, BilheteiraId = bilheteira.Id }; Bilhete bilhete_dia5 = new Bilhete { Data = new DateTime(2016, 05, 05), Link = link_bilhete5, LinkId = link_bilhete5.Id, PrecoNormal = 8.00m, PrecoDiaAnterior = 9.00m, PrecoNoDia = 10.00m, PrecoNoDiaForaHoras = 12.00m, Bilheteira = bilheteira, BilheteiraId = bilheteira.Id }; Bilhete bilhete_dia6 = new Bilhete { Data = new DateTime(2016, 05, 06), Link = link_bilhete6, LinkId = link_bilhete6.Id, PrecoNormal = 8.00m, PrecoDiaAnterior = 9.00m, PrecoNoDia = 10.00m, PrecoNoDiaForaHoras = 12.00m, Bilheteira = bilheteira, BilheteiraId = bilheteira.Id }; Bilhete bilhete_dia7 = new Bilhete { Data = new DateTime(2016, 05, 07), Link = link_bilhete7, LinkId = link_bilhete7.Id, PrecoNormal = 8.00m, PrecoDiaAnterior = 9.00m, PrecoNoDia = 10.00m, PrecoNoDiaForaHoras = 12.00m, Bilheteira = bilheteira, BilheteiraId = bilheteira.Id }; Bilhete bilhete_dia8 = new Bilhete { Data = new DateTime(2016, 05, 08), Link = link_bilhete8, LinkId = link_bilhete8.Id, PrecoNormal = 8.00m, PrecoDiaAnterior = 9.00m, PrecoNoDia = 10.00m, PrecoNoDiaForaHoras = 12.00m, Bilheteira = bilheteira, BilheteiraId = bilheteira.Id }; Bilhetes.AddRange(bilhete_dia1, bilhete_dia2, bilhete_dia3, bilhete_dia4, bilhete_dia5, bilhete_dia6, bilhete_dia7, bilhete_dia8); SaveChanges(); List <Bilhete> bilhetes_list = new List <Bilhete>(); bilhetes_list.Add(bilhete_dia1); bilhetes_list.Add(bilhete_dia2); bilhetes_list.Add(bilhete_dia3); bilhetes_list.Add(bilhete_dia4); bilhetes_list.Add(bilhete_dia5); bilhetes_list.Add(bilhete_dia6); bilhetes_list.Add(bilhete_dia7); bilhetes_list.Add(bilhete_dia8); bilheteira.Bilhetes = bilhetes_list; Bilheteiras.Update(bilheteira); SaveChanges(); } ; //if (!Atividades.Any()) //{ // List<PontoVenda> pontos_venda = PontosVenda.ToList(); // List<LocalAtividadeAcademica> locais = LocaisAtividades.ToList(); // Atividades.AddRange( // new AtividadeAcademica // { // Data = new DateTime(2016, 02, 01), // Descricao = "Descrição teste", // LocalAtividadeAcademica = locais.ElementAt(0), // Nome = "Sarau Cultural", // PontosVenda = "Coliseu do Porto, FAP", // ImagemPath = env.WebRootPath + "\\imagens\\atividades\\TOMANEPHOTOS056.jpg", // LocalAtividadeAcademicaId = locais.ElementAt(0).Id, // Preco = 3.00m // } // ); // SaveChanges(); //} if (!Artistas.Any()) { Artistas.Add( new Artista { Nome = "Dumitri Basiul", Biografia = "Dima tinha 12 anos quando começou a estudar música clássica. Depois disso emigrou para a Gronelândia", DataAtuacao = new DateTime(2016, 05, 12), ImagemPath = "\\imagens\\artistas\\Borgore.jpg", Palco = Palco.PalcoPrincipal, } ); SaveChanges(); } }
public static Bilhete MontaBilhete() { int cartela = 16; Random r = new Random(); IList <int> listaPrimos = EscolheNumeros.NumerosPrimos(r); IList <int> listaPrimeiros = EscolheNumeros.NumeroPrimeiro(r); IList <int> listaUltimos = EscolheNumeros.NumeroUltimo(r); IList <int> listaPares = EscolheNumeros.NumeroPares(r); IList <int> listaImpares = EscolheNumeros.NumeroImpares(r); IList <int> listaTodos = EscolheNumeros.NumeroTodos(r); List <int> listaBilhete = new List <int>(); foreach (var item in listaPrimos) { if (!listaBilhete.Contains(item) && listaBilhete.Count < cartela) { listaBilhete.Add(item); } } foreach (var item in listaPrimeiros) { if (!listaBilhete.Contains(item) && listaBilhete.Count < cartela) { listaBilhete.Add(item); } } foreach (var item in listaUltimos) { if (!listaBilhete.Contains(item) && listaBilhete.Count < cartela) { listaBilhete.Add(item); } } foreach (var item in listaPares) { if (!listaBilhete.Contains(item) && listaBilhete.Count < cartela) { listaBilhete.Add(item); } } foreach (var item in listaImpares) { if (!listaBilhete.Contains(item) && listaBilhete.Count < cartela) { listaBilhete.Add(item); } } foreach (var item in listaTodos) { if (!listaBilhete.Contains(item) && listaBilhete.Count < cartela) { listaBilhete.Add(item); } } listaBilhete.Sort(); Bilhete bilhete = new Bilhete(); bilhete.Numeros = listaBilhete; return(bilhete); }