First Push

This commit is contained in:
pedrocx486 2023-02-11 00:12:14 -03:00
parent 95e3bc2504
commit b36043ba69
11 changed files with 529 additions and 0 deletions

133
.gitignore vendored Normal file
View File

@ -0,0 +1,133 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.svclog
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
*.azurePubxml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
packages/
## TODO: If the tool you use requires repositories.config, also uncomment the next line
!packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
![Ss]tyle[Cc]op.targets
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
_NCrunch*

BIN
Calibration Cube.stl Normal file

Binary file not shown.

25
ConsoleApp3.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp3", "ConsoleApp3\ConsoleApp3.csproj", "{66C6A0CC-DB6F-4457-BE38-C539BB053528}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{66C6A0CC-DB6F-4457-BE38-C539BB053528}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66C6A0CC-DB6F-4457-BE38-C539BB053528}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66C6A0CC-DB6F-4457-BE38-C539BB053528}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66C6A0CC-DB6F-4457-BE38-C539BB053528}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F63105BC-918C-4438-A47B-E5BA3B82499E}
EndGlobalSection
EndGlobal

6
ConsoleApp3/App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{66C6A0CC-DB6F-4457-BE38-C539BB053528}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ConsoleApp3</RootNamespace>
<AssemblyName>ConsoleApp3</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Participante.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
public class Participante
{
public string Nickname { get; set; }
public string Nome { get; set; }
public int Idade { get; set; }
public string Cpf { get; set; }
public string Endereco { get; set; }
public string Estado { get; set; }
public string Bairro { get; set; }
public string NomeResponsavel { get; set; }
public string CpfResponsavel { get; set; }
public int idadeResponsavel { get; set; }
}
}

253
ConsoleApp3/Program.cs Normal file
View File

@ -0,0 +1,253 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
internal class Program
{
static Participante[] listaParticipantes = { };
static void Main(string[] args)
{
Menu();
Console.ReadKey();
}
static void Menu()
{
int opcao;
Console.WriteLine("Bem vindo ao Diretório Participantes");
Console.WriteLine("Selecione uma opção: \n");
Console.WriteLine("1- Novo Cadastro");
Console.WriteLine("2- Listar Cadastros");
Console.WriteLine("3- Listar Cadastros com Responsavéis");
Console.WriteLine("4- Consultar por ID");
Console.WriteLine("5- Consultar por Nickname");
Console.WriteLine("6- Sair");
opcao = int.Parse(Console.ReadLine());
switch (opcao)
{
case 1:
{
NovoCadastro();
break;
}
case 2:
{
ListarCadastros();
break;
}
case 3:
{
ListarCadastrosComResponsaveis();
break;
}
case 4:
{
EncontrarPorID();
break;
}
case 5:
{
PesquisaNick();
break;
}
case 6:
{
System.Environment.Exit(0);
break;
}
default:
{
Console.WriteLine("Opção Inválida!");
Menu();
break;
}
}
}
static void NovoCadastro()
{
Participante novoParticipante = new Participante();
Console.WriteLine("\nOlá, seja bem vindo!\nAntes de iniciarmos o seu cadastro, como você gostaria de ser chamado?");
novoParticipante.Nickname = Console.ReadLine();
Console.WriteLine("Seja bem vindo, " + novoParticipante.Nickname + "\n");
Console.WriteLine(novoParticipante.Nickname + ", preencha os dados corretamente para validar sua inscrição.");
Console.WriteLine("\nNome Completo:");
novoParticipante.Nome = Console.ReadLine();
Console.WriteLine("\nQual é a sua idade?");
novoParticipante.Idade = int.Parse(Console.ReadLine());
if (novoParticipante.Idade > 18)
{
Console.WriteLine("Você está elegivel para o cadastro, vamos continuar com o processo!\n");
Console.WriteLine("Qual o seu CPF? (Digite apenas números, sem pontos e barra.)");
novoParticipante.Cpf = Console.ReadLine();
}
else
{
Console.WriteLine("\nPor ser menor de idade, é necessário o cadastro de um responsável por você.\n");
Console.WriteLine("\nNome do Responsável:");
novoParticipante.NomeResponsavel = Console.ReadLine();
Console.WriteLine("\nIdade do Responsável:");
novoParticipante.idadeResponsavel = int.Parse(Console.ReadLine());
if (novoParticipante.idadeResponsavel < 18)
{
Console.WriteLine("\nInfelizmente, não podemos continuar devido ao seu responsável ser de menor.\n");
Menu();
}
else
{
Console.WriteLine("\nCPF do Resposável: (Digite apenas números, sem pontos e barra.)");
novoParticipante.CpfResponsavel = Console.ReadLine();
Console.WriteLine("\nTudo certo, agora vamos continuar com o seu cadastro.\n");
}
}
Console.WriteLine("\nVamos agora conferir o local onde você mora!");
Console.WriteLine("Qual é o seu endereço?");
novoParticipante.Endereco = Console.ReadLine();
Console.WriteLine("Digite seu Bairro:");
novoParticipante.Bairro = Console.ReadLine();
Console.WriteLine("Digite seu Estado:");
novoParticipante.Estado = Console.ReadLine();
Console.WriteLine("\nMuito bem, vamos agora conferir os seus dados!");
Console.WriteLine("Nickname: " + novoParticipante.Nickname);
Console.WriteLine("Nome Completo: " + novoParticipante.Nome);
Console.WriteLine("Idade: " + novoParticipante.Idade);
if (novoParticipante.Idade < 18)
{
Console.WriteLine("Nome do Responsável: " + novoParticipante.NomeResponsavel);
Console.WriteLine("Idade do Responsável: " + novoParticipante.idadeResponsavel);
Console.WriteLine("CPF do Responsável: " + novoParticipante.CpfResponsavel);
}
Console.WriteLine("Endereço: " + novoParticipante.Endereco);
Console.WriteLine("Bairro: " + novoParticipante.Bairro);
Console.WriteLine("Estado: " + novoParticipante.Estado);
Console.WriteLine("Confirma que os dados estão corretos? S / N");
bool confirma = (string.Equals(Console.ReadLine(), "s", StringComparison.OrdinalIgnoreCase) ? true : false);
if (confirma)
{
listaParticipantes = listaParticipantes.Append(novoParticipante).ToArray();
Console.WriteLine("");
Menu();
}
else
{
NovoCadastro();
}
}
static void ListarCadastros()
{
foreach (Participante participante in listaParticipantes)
{
Console.WriteLine("ID: " + Array.IndexOf(listaParticipantes, participante));
Console.WriteLine("Nickname: " + participante.Nickname);
Console.WriteLine("Nome Completo: " + participante.Nome);
Console.WriteLine("Idade: " + participante.Idade);
Console.WriteLine("Endereço: " + participante.Endereco);
Console.WriteLine("Bairro: " + participante.Bairro);
Console.WriteLine("Estado: " + participante.Estado);
Console.WriteLine("");
}
if (listaParticipantes.Length < 1)
{
Console.WriteLine("\nLista vazia.");
}
Console.WriteLine("");
Menu();
}
static void ListarCadastrosComResponsaveis()
{
foreach (Participante participante in listaParticipantes.Where(p => !(p.NomeResponsavel is null)).ToArray())
{
Console.WriteLine("ID: " + Array.IndexOf(listaParticipantes, participante));
Console.WriteLine("Nickname: " + participante.Nickname);
Console.WriteLine("Nome Completo: " + participante.Nome);
Console.WriteLine("Idade: " + participante.Idade);
Console.WriteLine("Endereço: " + participante.Endereco);
Console.WriteLine("Bairro: " + participante.Bairro);
Console.WriteLine("Estado: " + participante.Estado);
Console.WriteLine("Nome do Responsável: " + participante.NomeResponsavel);
Console.WriteLine("Idade do Responsável: " + participante.idadeResponsavel);
Console.WriteLine("CPF do Responsável: " + participante.CpfResponsavel);
Console.WriteLine("");
}
if (listaParticipantes.Length < 1)
{
Console.WriteLine("\nLista vazia.");
}
Console.WriteLine("");
Menu();
}
static void EncontrarPorID()
{
foreach (Participante participante in listaParticipantes)
{
Console.WriteLine("ID: " + Array.IndexOf(listaParticipantes, participante));
Console.WriteLine("Nickname: " + participante.Nickname);
Console.WriteLine("");
}
Console.WriteLine("Qual ID você deseja consultar?");
int id = int.Parse(Console.ReadLine());
Console.WriteLine("Nickname: " + listaParticipantes[id].Nickname);
Console.WriteLine("Nome Completo: " + listaParticipantes[id].Nome);
Console.WriteLine("Idade: " + listaParticipantes[id].Idade);
Console.WriteLine("Endereço: " + listaParticipantes[id].Endereco);
Console.WriteLine("Bairro: " + listaParticipantes[id].Bairro);
Console.WriteLine("Estado: " + listaParticipantes[id].Estado);
Console.WriteLine("");
if (listaParticipantes.Length < 1)
{
Console.WriteLine("\nLista vazia.");
}
Console.WriteLine("");
Menu();
}
static void PesquisaNick()
{
Console.WriteLine("Qual nickname você gostaria de consultar?");
var pesquisa = Console.ReadLine();
var resultados = listaParticipantes.Where(p => string.Equals(pesquisa, p.Nickname, StringComparison.OrdinalIgnoreCase)).ToArray();
foreach (Participante participante in resultados)
{
Console.WriteLine("Nickname: " + participante.Nickname);
Console.WriteLine("Nome Completo: " + participante.Nome);
Console.WriteLine("Idade: " + participante.Idade);
Console.WriteLine("Endereço: " + participante.Endereco);
Console.WriteLine("Bairro: " + participante.Bairro);
Console.WriteLine("Estado: " + participante.Estado);
Console.WriteLine("");
}
if (resultados.Length < 1)
{
Console.WriteLine("\nResultado não encontrado.");
}
Console.WriteLine("");
Menu();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// As informações gerais sobre um assembly são controladas por
// conjunto de atributos. Altere estes valores de atributo para modificar as informações
// associadas a um assembly.
[assembly: AssemblyTitle("ConsoleApp3")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConsoleApp3")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Definir ComVisible como false torna os tipos neste assembly invisíveis
// para componentes COM. Caso precise acessar um tipo neste assembly de
// COM, defina o atributo ComVisible como true nesse tipo.
[assembly: ComVisible(false)]
// O GUID a seguir será destinado à ID de typelib se este projeto for exposto para COM
[assembly: Guid("66c6a0cc-db6f-4457-be38-c539bb053528")]
// As informações da versão de um assembly consistem nos quatro valores a seguir:
//
// Versão Principal
// Versão Secundária
// Número da Versão
// Revisão
//
// É possível especificar todos os valores ou usar como padrão os Números de Build e da Revisão
// usando o "*" como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]