├── .gitattributes ├── .gitignore ├── App.config ├── AppFuncionario.csproj ├── AppFuncionario.sln ├── Funcionario.cs ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── Resources ├── aniversario.png ├── aniversario1.png └── bolo.png ├── frmAniversario.Designer.cs ├── frmAniversario.cs ├── frmAniversario.resx ├── frmPrincipal.Designer.cs ├── frmPrincipal.cs └── frmPrincipal.resx /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AppFuncionario.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1AF17603-88E1-4865-B7B3-4A800939C339} 8 | WinExe 9 | AppFuncionario 10 | AppFuncionario 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | publish\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | false 29 | true 30 | 31 | 32 | AnyCPU 33 | true 34 | full 35 | false 36 | bin\Debug\ 37 | DEBUG;TRACE 38 | prompt 39 | 4 40 | 41 | 42 | AnyCPU 43 | pdbonly 44 | true 45 | bin\Release\ 46 | TRACE 47 | prompt 48 | 4 49 | 50 | 51 | 52 | ..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.dll 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | Form 68 | 69 | 70 | frmAniversario.cs 71 | 72 | 73 | Form 74 | 75 | 76 | frmPrincipal.cs 77 | 78 | 79 | 80 | 81 | 82 | frmAniversario.cs 83 | 84 | 85 | frmPrincipal.cs 86 | 87 | 88 | ResXFileCodeGenerator 89 | Resources.Designer.cs 90 | Designer 91 | 92 | 93 | True 94 | Resources.resx 95 | True 96 | 97 | 98 | SettingsSingleFileGenerator 99 | Settings.Designer.cs 100 | 101 | 102 | True 103 | Settings.settings 104 | True 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | Always 113 | 114 | 115 | Always 116 | DbFuncionario.mdf 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | False 125 | Microsoft .NET Framework 4.7.2 %28x86 e x64%29 126 | true 127 | 128 | 129 | False 130 | .NET Framework 3.5 SP1 131 | false 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /AppFuncionario.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.6.33815.320 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppFuncionario", "AppFuncionario.csproj", "{1AF17603-88E1-4865-B7B3-4A800939C339}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {1AF17603-88E1-4865-B7B3-4A800939C339}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {1AF17603-88E1-4865-B7B3-4A800939C339}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {1AF17603-88E1-4865-B7B3-4A800939C339}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {1AF17603-88E1-4865-B7B3-4A800939C339}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {B4EA0D86-AF8B-4450-9279-0EA43C36496C} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Funcionario.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Data.SqlClient; 7 | using System.Data; 8 | using System.Windows.Forms; 9 | 10 | namespace AppFuncionario 11 | { 12 | public class Funcionario 13 | { 14 | public int Id { get; set; } 15 | public string nome { get; set; } 16 | public string turno { get; set; } 17 | public string data_nascimento { get; set; } 18 | public string matricula { get; set; } 19 | 20 | SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\Users\\Aluno\\Downloads\\AppFuncionario\\DbFuncionario.mdf;Integrated Security=True"); 21 | 22 | public List Listafuncionario() 23 | { 24 | List li = new List(); 25 | string sql = "SELECT * FROM Funcionario"; 26 | if (con.State == ConnectionState.Open) 27 | { 28 | con.Close(); 29 | } 30 | con.Open(); 31 | SqlCommand cmd = new SqlCommand(sql, con); 32 | SqlDataReader dr = cmd.ExecuteReader(); 33 | while (dr.Read()) 34 | { 35 | Funcionario func = new Funcionario(); 36 | func.Id = (int)dr["Id"]; 37 | func.nome = dr["nome"].ToString(); 38 | func.turno = dr["turno"].ToString(); 39 | func.data_nascimento = dr["data_nascimento"].ToString(); 40 | func.matricula = dr["matricula"].ToString(); 41 | li.Add(func); 42 | } 43 | dr.Close(); 44 | con.Close(); 45 | return li; 46 | } 47 | 48 | public void Inserir(string nome, string turno, string data_nascimento, string matricula) 49 | { 50 | try 51 | { 52 | string sql = "INSERT INTO Funcionario(nome,turno,data_nascimento,matricula) VALUES ('"+nome+"','"+turno+"','"+data_nascimento+"','"+matricula+"')"; 53 | if (con.State == ConnectionState.Open) 54 | { 55 | con.Close(); 56 | } 57 | con.Open(); 58 | SqlCommand cmd = new SqlCommand(sql, con); 59 | cmd.ExecuteNonQuery(); 60 | con.Close(); 61 | } 62 | catch (Exception erro) 63 | { 64 | MessageBox.Show(erro.Message); 65 | } 66 | } 67 | 68 | public void Localizar(int Id) 69 | { 70 | try 71 | { 72 | string sql = "SELECT * FROM Funcionario WHERE Id='" + Id + "'"; 73 | if (con.State == ConnectionState.Open) 74 | { 75 | con.Close(); 76 | } 77 | con.Open(); 78 | SqlCommand cmd = new SqlCommand(sql, con); 79 | SqlDataReader dr = cmd.ExecuteReader(); 80 | while (dr.Read()) 81 | { 82 | nome = dr["nome"].ToString(); 83 | turno = dr["turno"].ToString(); 84 | data_nascimento = dr["data_nascimento"].ToString(); 85 | matricula = dr["matricula"].ToString(); 86 | } 87 | dr.Close(); 88 | con.Close(); 89 | } 90 | catch (Exception erro) 91 | { 92 | MessageBox.Show(erro.Message); 93 | } 94 | } 95 | 96 | public void Atualizar(int Id, string nome, string turno, string data_nascimento, string matricula) 97 | { 98 | try 99 | { 100 | string sql = "UPDATE Funcionario SET nome='"+nome+"',turno='"+turno+"',data_nascimento='"+data_nascimento+"',matricula='"+matricula+"' WHERE Id='"+Id+"'"; 101 | if (con.State == ConnectionState.Open) 102 | { 103 | con.Close(); 104 | } 105 | con.Open(); 106 | SqlCommand cmd = new SqlCommand(sql, con); 107 | cmd.ExecuteNonQuery(); 108 | con.Close(); 109 | } 110 | catch (Exception erro) 111 | { 112 | MessageBox.Show(erro.Message); 113 | } 114 | } 115 | 116 | public void Excluir(int Id) 117 | { 118 | try 119 | { 120 | string sql = "DELETE FROM Funcionario WHERE Id='"+Id+"'"; 121 | if (con.State == ConnectionState.Open) 122 | { 123 | con.Close(); 124 | } 125 | con.Open(); 126 | SqlCommand cmd = new SqlCommand(sql, con); 127 | cmd.ExecuteNonQuery(); 128 | con.Close(); 129 | } 130 | catch (Exception erro) 131 | { 132 | MessageBox.Show(erro.Message); 133 | } 134 | } 135 | 136 | public bool RegistroRepetido(string matricula) 137 | { 138 | string sql = "SELECT * FROM Funcionario WHERE matricula='"+matricula+"'"; 139 | if (con.State == ConnectionState.Open) 140 | { 141 | con.Close(); 142 | } 143 | con.Open(); 144 | SqlCommand cmd = new SqlCommand(sql, con); 145 | cmd.ExecuteNonQuery(); 146 | var result = cmd.ExecuteScalar(); 147 | if (result != null) 148 | { 149 | return (int)result > 0; 150 | } 151 | con.Close(); 152 | return false; 153 | } 154 | 155 | public bool ExisteId(int Id) 156 | { 157 | string sql = "SELECT * FROM Funcionario WHERE Id='" + Id + "'"; 158 | if (con.State == ConnectionState.Open) 159 | { 160 | con.Close(); 161 | } 162 | con.Open(); 163 | SqlCommand cmd = new SqlCommand(sql, con); 164 | cmd.ExecuteNonQuery(); 165 | var result = cmd.ExecuteScalar(); 166 | if (result != null) 167 | { 168 | return (int)result > 0; 169 | } 170 | con.Close(); 171 | return false; 172 | } 173 | 174 | public bool Aniversario(string data) 175 | { 176 | string sql = "SELECT data_nascimento FROM Funcionario"; 177 | if (con.State == ConnectionState.Open) 178 | { 179 | con.Close(); 180 | } 181 | con.Open(); 182 | SqlCommand cmd = new SqlCommand(sql, con); 183 | SqlDataReader dr = cmd.ExecuteReader(); 184 | var dataniver = data; 185 | string data1 = dataniver.Substring(0, 2); 186 | string data2 = dataniver.Substring(3, 2); 187 | while (dr.Read()) 188 | { 189 | var datanasc = dr["data_nascimento"].ToString(); 190 | string datan1 = datanasc.Substring(0, 2); 191 | string datan2 = datanasc.Substring(3, 2); 192 | if(data1.ToString() == datan1.ToString() && data2.ToString() == datan2.ToString()) 193 | { 194 | return true; 195 | } 196 | } 197 | dr.Close(); 198 | con.Close(); 199 | return false; 200 | } 201 | 202 | public List ListaAniversariantes() 203 | { 204 | List li = new List(); 205 | string sql = "SELECT * FROM Funcionario"; 206 | if(con.State == ConnectionState.Open) 207 | { 208 | con.Close(); 209 | } 210 | con.Open(); 211 | SqlCommand cmd = new SqlCommand(sql, con); 212 | SqlDataReader dr = cmd.ExecuteReader(); 213 | var dataniver = DateTime.Now.ToString("dd/MM/yyyy"); 214 | string data1 = dataniver.Substring (0, 2); 215 | string data2 = dataniver.Substring (3, 2); 216 | while (dr.Read()) 217 | { 218 | Funcionario func = new Funcionario(); 219 | var datanasc = dr["data_nascimento"].ToString(); 220 | string datan1 = datanasc.Substring (0, 2); 221 | string datan2 = datanasc.Substring (3, 2); 222 | if(data1.ToString() == datan1.ToString() && data2.ToString() ==datan2.ToString()) 223 | { 224 | func.Id = (int)dr["ID"]; 225 | func.nome = dr["nome"].ToString(); 226 | func.turno = dr["turno"].ToString(); 227 | func.data_nascimento = dr["data_nascimento"].ToString(); 228 | func.matricula = dr["matricula"].ToString(); 229 | li.Add(func); 230 | } 231 | 232 | } 233 | dr.Close(); 234 | con.Close(); 235 | return li; 236 | } 237 | 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace AppFuncionario 8 | { 9 | internal static class Program 10 | { 11 | /// 12 | /// Ponto de entrada principal para o aplicativo. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new frmPrincipal()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // As informações gerais sobre um assembly são controladas por 6 | // conjunto de atributos. Altere estes valores de atributo para modificar as informações 7 | // associadas a um assembly. 8 | [assembly: AssemblyTitle("AppFuncionario")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Sistema Fiep")] 12 | [assembly: AssemblyProduct("AppFuncionario")] 13 | [assembly: AssemblyCopyright("Copyright © Sistema Fiep 2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Definir ComVisible como false torna os tipos neste assembly invisíveis 18 | // para componentes COM. Caso precise acessar um tipo neste assembly de 19 | // COM, defina o atributo ComVisible como true nesse tipo. 20 | [assembly: ComVisible(false)] 21 | 22 | // O GUID a seguir será destinado à ID de typelib se este projeto for exposto para COM 23 | [assembly: Guid("1af17603-88e1-4865-b7b3-4a800939c339")] 24 | 25 | // As informações da versão de um assembly consistem nos quatro valores a seguir: 26 | // 27 | // Versão Principal 28 | // Versão Secundária 29 | // Número da Versão 30 | // Revisão 31 | // 32 | // É possível especificar todos os valores ou usar como padrão os Números de Build e da Revisão 33 | // usando o "*" como mostrado abaixo: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // O código foi gerado por uma ferramenta. 4 | // Versão de Tempo de Execução:4.0.30319.42000 5 | // 6 | // As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se 7 | // o código for gerado novamente. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace AppFuncionario.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc. 17 | /// 18 | // Essa classe foi gerada automaticamente pela classe StronglyTypedResourceBuilder 19 | // através de uma ferramenta como ResGen ou Visual Studio. 20 | // Para adicionar ou remover um associado, edite o arquivo .ResX e execute ResGen novamente 21 | // com a opção /str, ou recrie o projeto do VS. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Retorna a instância de ResourceManager armazenada em cache usada por essa classe. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AppFuncionario.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Substitui a propriedade CurrentUICulture do thread atual para todas as 51 | /// pesquisas de recursos que usam essa classe de recurso de tipo de alta segurança. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Consulta um recurso localizado do tipo System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap bolo { 67 | get { 68 | object obj = ResourceManager.GetObject("bolo", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\bolo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | -------------------------------------------------------------------------------- /Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace AppFuncionario.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Resources/aniversario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoemiaGitHub/ProjetoFinalAppFuncionario/04335d3a4de86ab40168ecadcfc85554dfc55146/Resources/aniversario.png -------------------------------------------------------------------------------- /Resources/aniversario1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoemiaGitHub/ProjetoFinalAppFuncionario/04335d3a4de86ab40168ecadcfc85554dfc55146/Resources/aniversario1.png -------------------------------------------------------------------------------- /Resources/bolo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoemiaGitHub/ProjetoFinalAppFuncionario/04335d3a4de86ab40168ecadcfc85554dfc55146/Resources/bolo.png -------------------------------------------------------------------------------- /frmAniversario.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace AppFuncionario 2 | { 3 | partial class frmAniversario 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btnFechar = new System.Windows.Forms.Button(); 32 | this.dgvAniversariantes = new System.Windows.Forms.DataGridView(); 33 | ((System.ComponentModel.ISupportInitialize)(this.dgvAniversariantes)).BeginInit(); 34 | this.SuspendLayout(); 35 | // 36 | // btnFechar 37 | // 38 | this.btnFechar.BackColor = System.Drawing.Color.Red; 39 | this.btnFechar.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 40 | this.btnFechar.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 41 | this.btnFechar.ForeColor = System.Drawing.SystemColors.ButtonFace; 42 | this.btnFechar.Location = new System.Drawing.Point(592, 12); 43 | this.btnFechar.Name = "btnFechar"; 44 | this.btnFechar.Size = new System.Drawing.Size(196, 105); 45 | this.btnFechar.TabIndex = 0; 46 | this.btnFechar.Text = "FECHAR"; 47 | this.btnFechar.UseVisualStyleBackColor = false; 48 | this.btnFechar.Click += new System.EventHandler(this.btnFechar_Click); 49 | // 50 | // dgvAniversariantes 51 | // 52 | this.dgvAniversariantes.AllowUserToAddRows = false; 53 | this.dgvAniversariantes.AllowUserToDeleteRows = false; 54 | this.dgvAniversariantes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 55 | this.dgvAniversariantes.Location = new System.Drawing.Point(12, 12); 56 | this.dgvAniversariantes.Name = "dgvAniversariantes"; 57 | this.dgvAniversariantes.ReadOnly = true; 58 | this.dgvAniversariantes.Size = new System.Drawing.Size(574, 426); 59 | this.dgvAniversariantes.TabIndex = 1; 60 | // 61 | // frmAniversario 62 | // 63 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 64 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 65 | this.ClientSize = new System.Drawing.Size(800, 450); 66 | this.Controls.Add(this.dgvAniversariantes); 67 | this.Controls.Add(this.btnFechar); 68 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 69 | this.Name = "frmAniversario"; 70 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 71 | this.Text = "frmAniversario"; 72 | this.Load += new System.EventHandler(this.frmAniversario_Load); 73 | ((System.ComponentModel.ISupportInitialize)(this.dgvAniversariantes)).EndInit(); 74 | this.ResumeLayout(false); 75 | 76 | } 77 | 78 | #endregion 79 | 80 | private System.Windows.Forms.Button btnFechar; 81 | private System.Windows.Forms.DataGridView dgvAniversariantes; 82 | } 83 | } -------------------------------------------------------------------------------- /frmAniversario.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace AppFuncionario 12 | { 13 | public partial class frmAniversario : Form 14 | { 15 | public frmAniversario() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void btnFechar_Click(object sender, EventArgs e) 21 | { 22 | this.Close(); 23 | } 24 | 25 | private void frmAniversario_Load(object sender, EventArgs e) 26 | { 27 | Funcionario funcionario = new Funcionario(); 28 | List func = funcionario.ListaAniversariantes(); 29 | dgvAniversariantes.DataSource = func; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /frmAniversario.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /frmPrincipal.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace AppFuncionario 2 | { 3 | partial class frmPrincipal 4 | { 5 | /// 6 | /// Variável de designer necessária. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Limpar os recursos que estão sendo usados. 12 | /// 13 | /// true se for necessário descartar os recursos gerenciados; caso contrário, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Código gerado pelo Windows Form Designer 24 | 25 | /// 26 | /// Método necessário para suporte ao Designer - não modifique 27 | /// o conteúdo deste método com o editor de código. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmPrincipal)); 32 | this.btnSair = new System.Windows.Forms.Button(); 33 | this.label1 = new System.Windows.Forms.Label(); 34 | this.cbxTurno = new System.Windows.Forms.ComboBox(); 35 | this.txtId = new System.Windows.Forms.TextBox(); 36 | this.dgvFuncionario = new System.Windows.Forms.DataGridView(); 37 | this.txtNome = new System.Windows.Forms.TextBox(); 38 | this.label2 = new System.Windows.Forms.Label(); 39 | this.label3 = new System.Windows.Forms.Label(); 40 | this.txtDataNascimento = new System.Windows.Forms.TextBox(); 41 | this.label4 = new System.Windows.Forms.Label(); 42 | this.txtMatricula = new System.Windows.Forms.TextBox(); 43 | this.label5 = new System.Windows.Forms.Label(); 44 | this.btnInserir = new System.Windows.Forms.Button(); 45 | this.btnEditar = new System.Windows.Forms.Button(); 46 | this.btnExcluir = new System.Windows.Forms.Button(); 47 | this.btnLocalizar = new System.Windows.Forms.Button(); 48 | this.pbxAniversario = new System.Windows.Forms.PictureBox(); 49 | ((System.ComponentModel.ISupportInitialize)(this.dgvFuncionario)).BeginInit(); 50 | ((System.ComponentModel.ISupportInitialize)(this.pbxAniversario)).BeginInit(); 51 | this.SuspendLayout(); 52 | // 53 | // btnSair 54 | // 55 | this.btnSair.BackColor = System.Drawing.Color.Red; 56 | this.btnSair.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 57 | this.btnSair.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 58 | this.btnSair.ForeColor = System.Drawing.Color.White; 59 | this.btnSair.Location = new System.Drawing.Point(558, 180); 60 | this.btnSair.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 61 | this.btnSair.Name = "btnSair"; 62 | this.btnSair.Size = new System.Drawing.Size(138, 49); 63 | this.btnSair.TabIndex = 0; 64 | this.btnSair.Text = "SAIR"; 65 | this.btnSair.UseVisualStyleBackColor = false; 66 | this.btnSair.Click += new System.EventHandler(this.btnSair_Click); 67 | // 68 | // label1 69 | // 70 | this.label1.AutoSize = true; 71 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 72 | this.label1.Location = new System.Drawing.Point(11, 15); 73 | this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 74 | this.label1.Name = "label1"; 75 | this.label1.Size = new System.Drawing.Size(21, 15); 76 | this.label1.TabIndex = 1; 77 | this.label1.Text = "ID"; 78 | // 79 | // cbxTurno 80 | // 81 | this.cbxTurno.FormattingEnabled = true; 82 | this.cbxTurno.Items.AddRange(new object[] { 83 | "Manhã", 84 | "Tarde", 85 | "Noite"}); 86 | this.cbxTurno.Location = new System.Drawing.Point(14, 141); 87 | this.cbxTurno.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 88 | this.cbxTurno.Name = "cbxTurno"; 89 | this.cbxTurno.Size = new System.Drawing.Size(190, 21); 90 | this.cbxTurno.TabIndex = 2; 91 | // 92 | // txtId 93 | // 94 | this.txtId.Location = new System.Drawing.Point(14, 31); 95 | this.txtId.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 96 | this.txtId.Name = "txtId"; 97 | this.txtId.Size = new System.Drawing.Size(76, 20); 98 | this.txtId.TabIndex = 3; 99 | // 100 | // dgvFuncionario 101 | // 102 | this.dgvFuncionario.AllowUserToAddRows = false; 103 | this.dgvFuncionario.AllowUserToDeleteRows = false; 104 | this.dgvFuncionario.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 105 | this.dgvFuncionario.Location = new System.Drawing.Point(9, 230); 106 | this.dgvFuncionario.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 107 | this.dgvFuncionario.Name = "dgvFuncionario"; 108 | this.dgvFuncionario.ReadOnly = true; 109 | this.dgvFuncionario.RowHeadersWidth = 51; 110 | this.dgvFuncionario.RowTemplate.Height = 24; 111 | this.dgvFuncionario.Size = new System.Drawing.Size(539, 188); 112 | this.dgvFuncionario.TabIndex = 4; 113 | this.dgvFuncionario.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvFuncionario_CellContentClick); 114 | // 115 | // txtNome 116 | // 117 | this.txtNome.Location = new System.Drawing.Point(14, 84); 118 | this.txtNome.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 119 | this.txtNome.Name = "txtNome"; 120 | this.txtNome.Size = new System.Drawing.Size(388, 20); 121 | this.txtNome.TabIndex = 6; 122 | // 123 | // label2 124 | // 125 | this.label2.AutoSize = true; 126 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 127 | this.label2.Location = new System.Drawing.Point(11, 68); 128 | this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 129 | this.label2.Name = "label2"; 130 | this.label2.Size = new System.Drawing.Size(48, 15); 131 | this.label2.TabIndex = 5; 132 | this.label2.Text = "NOME"; 133 | // 134 | // label3 135 | // 136 | this.label3.AutoSize = true; 137 | this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 138 | this.label3.Location = new System.Drawing.Point(11, 122); 139 | this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 140 | this.label3.Name = "label3"; 141 | this.label3.Size = new System.Drawing.Size(55, 15); 142 | this.label3.TabIndex = 7; 143 | this.label3.Text = "TURNO"; 144 | // 145 | // txtDataNascimento 146 | // 147 | this.txtDataNascimento.Location = new System.Drawing.Point(14, 196); 148 | this.txtDataNascimento.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 149 | this.txtDataNascimento.Name = "txtDataNascimento"; 150 | this.txtDataNascimento.Size = new System.Drawing.Size(190, 20); 151 | this.txtDataNascimento.TabIndex = 9; 152 | // 153 | // label4 154 | // 155 | this.label4.AutoSize = true; 156 | this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 157 | this.label4.Location = new System.Drawing.Point(11, 180); 158 | this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 159 | this.label4.Name = "label4"; 160 | this.label4.Size = new System.Drawing.Size(157, 15); 161 | this.label4.TabIndex = 8; 162 | this.label4.Text = "DATA DE NASCIMENTO"; 163 | // 164 | // txtMatricula 165 | // 166 | this.txtMatricula.Location = new System.Drawing.Point(243, 196); 167 | this.txtMatricula.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 168 | this.txtMatricula.Name = "txtMatricula"; 169 | this.txtMatricula.Size = new System.Drawing.Size(158, 20); 170 | this.txtMatricula.TabIndex = 11; 171 | // 172 | // label5 173 | // 174 | this.label5.AutoSize = true; 175 | this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 176 | this.label5.Location = new System.Drawing.Point(241, 180); 177 | this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 178 | this.label5.Name = "label5"; 179 | this.label5.Size = new System.Drawing.Size(84, 15); 180 | this.label5.TabIndex = 10; 181 | this.label5.Text = "MATRÍCULA"; 182 | // 183 | // btnInserir 184 | // 185 | this.btnInserir.BackColor = System.Drawing.Color.MidnightBlue; 186 | this.btnInserir.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 187 | this.btnInserir.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 188 | this.btnInserir.ForeColor = System.Drawing.Color.White; 189 | this.btnInserir.Location = new System.Drawing.Point(558, 15); 190 | this.btnInserir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 191 | this.btnInserir.Name = "btnInserir"; 192 | this.btnInserir.Size = new System.Drawing.Size(138, 49); 193 | this.btnInserir.TabIndex = 12; 194 | this.btnInserir.Text = "INSERIR"; 195 | this.btnInserir.UseVisualStyleBackColor = false; 196 | this.btnInserir.Click += new System.EventHandler(this.btnInserir_Click); 197 | // 198 | // btnEditar 199 | // 200 | this.btnEditar.BackColor = System.Drawing.Color.DarkGreen; 201 | this.btnEditar.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 202 | this.btnEditar.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 203 | this.btnEditar.ForeColor = System.Drawing.Color.White; 204 | this.btnEditar.Location = new System.Drawing.Point(558, 69); 205 | this.btnEditar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 206 | this.btnEditar.Name = "btnEditar"; 207 | this.btnEditar.Size = new System.Drawing.Size(138, 49); 208 | this.btnEditar.TabIndex = 13; 209 | this.btnEditar.Text = "EDITAR"; 210 | this.btnEditar.UseVisualStyleBackColor = false; 211 | this.btnEditar.Click += new System.EventHandler(this.btnEditar_Click); 212 | // 213 | // btnExcluir 214 | // 215 | this.btnExcluir.BackColor = System.Drawing.Color.Sienna; 216 | this.btnExcluir.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 217 | this.btnExcluir.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 218 | this.btnExcluir.ForeColor = System.Drawing.Color.White; 219 | this.btnExcluir.Location = new System.Drawing.Point(558, 126); 220 | this.btnExcluir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 221 | this.btnExcluir.Name = "btnExcluir"; 222 | this.btnExcluir.Size = new System.Drawing.Size(138, 49); 223 | this.btnExcluir.TabIndex = 14; 224 | this.btnExcluir.Text = "EXCLUIR"; 225 | this.btnExcluir.UseVisualStyleBackColor = false; 226 | this.btnExcluir.Click += new System.EventHandler(this.btnExcluir_Click); 227 | // 228 | // btnLocalizar 229 | // 230 | this.btnLocalizar.FlatAppearance.BorderSize = 0; 231 | this.btnLocalizar.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 232 | this.btnLocalizar.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 233 | this.btnLocalizar.Location = new System.Drawing.Point(93, 23); 234 | this.btnLocalizar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 235 | this.btnLocalizar.Name = "btnLocalizar"; 236 | this.btnLocalizar.Size = new System.Drawing.Size(112, 34); 237 | this.btnLocalizar.TabIndex = 16; 238 | this.btnLocalizar.Text = "LOCALIZAR"; 239 | this.btnLocalizar.UseVisualStyleBackColor = true; 240 | this.btnLocalizar.Click += new System.EventHandler(this.btnLocalizar_Click); 241 | // 242 | // pbxAniversario 243 | // 244 | this.pbxAniversario.Image = ((System.Drawing.Image)(resources.GetObject("pbxAniversario.Image"))); 245 | this.pbxAniversario.Location = new System.Drawing.Point(558, 253); 246 | this.pbxAniversario.Margin = new System.Windows.Forms.Padding(2); 247 | this.pbxAniversario.Name = "pbxAniversario"; 248 | this.pbxAniversario.Size = new System.Drawing.Size(136, 152); 249 | this.pbxAniversario.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 250 | this.pbxAniversario.TabIndex = 15; 251 | this.pbxAniversario.TabStop = false; 252 | this.pbxAniversario.Click += new System.EventHandler(this.pbxAniversario_Click); 253 | // 254 | // frmPrincipal 255 | // 256 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 257 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 258 | this.BackColor = System.Drawing.Color.White; 259 | this.ClientSize = new System.Drawing.Size(704, 428); 260 | this.Controls.Add(this.btnLocalizar); 261 | this.Controls.Add(this.pbxAniversario); 262 | this.Controls.Add(this.btnExcluir); 263 | this.Controls.Add(this.btnEditar); 264 | this.Controls.Add(this.btnInserir); 265 | this.Controls.Add(this.txtMatricula); 266 | this.Controls.Add(this.label5); 267 | this.Controls.Add(this.txtDataNascimento); 268 | this.Controls.Add(this.label4); 269 | this.Controls.Add(this.label3); 270 | this.Controls.Add(this.txtNome); 271 | this.Controls.Add(this.label2); 272 | this.Controls.Add(this.dgvFuncionario); 273 | this.Controls.Add(this.txtId); 274 | this.Controls.Add(this.cbxTurno); 275 | this.Controls.Add(this.label1); 276 | this.Controls.Add(this.btnSair); 277 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; 278 | this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 279 | this.MaximizeBox = false; 280 | this.MinimizeBox = false; 281 | this.Name = "frmPrincipal"; 282 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 283 | this.Text = "Cadastro de Funcionários"; 284 | this.Load += new System.EventHandler(this.frmPrincipal_Load); 285 | ((System.ComponentModel.ISupportInitialize)(this.dgvFuncionario)).EndInit(); 286 | ((System.ComponentModel.ISupportInitialize)(this.pbxAniversario)).EndInit(); 287 | this.ResumeLayout(false); 288 | this.PerformLayout(); 289 | 290 | } 291 | 292 | #endregion 293 | 294 | private System.Windows.Forms.Button btnSair; 295 | private System.Windows.Forms.Label label1; 296 | private System.Windows.Forms.ComboBox cbxTurno; 297 | private System.Windows.Forms.TextBox txtId; 298 | private System.Windows.Forms.DataGridView dgvFuncionario; 299 | private System.Windows.Forms.TextBox txtNome; 300 | private System.Windows.Forms.Label label2; 301 | private System.Windows.Forms.Label label3; 302 | private System.Windows.Forms.TextBox txtDataNascimento; 303 | private System.Windows.Forms.Label label4; 304 | private System.Windows.Forms.TextBox txtMatricula; 305 | private System.Windows.Forms.Label label5; 306 | private System.Windows.Forms.Button btnInserir; 307 | private System.Windows.Forms.Button btnEditar; 308 | private System.Windows.Forms.Button btnExcluir; 309 | private System.Windows.Forms.PictureBox pbxAniversario; 310 | private System.Windows.Forms.Button btnLocalizar; 311 | } 312 | } 313 | 314 | -------------------------------------------------------------------------------- /frmPrincipal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace AppFuncionario 12 | { 13 | public partial class frmPrincipal : Form 14 | { 15 | public frmPrincipal() 16 | { 17 | InitializeComponent(); 18 | Funcionario funcionario = new Funcionario(); 19 | string data = DateTime.Now.ToString("dd/MM/yyyy"); 20 | if (funcionario.Aniversario(data) == false) 21 | { 22 | pbxAniversario.Visible = false; 23 | } 24 | } 25 | 26 | private void btnSair_Click(object sender, EventArgs e) 27 | { 28 | Environment.Exit(0); 29 | } 30 | 31 | private void frmPrincipal_Load(object sender, EventArgs e) 32 | { 33 | Funcionario funcionario = new Funcionario(); 34 | List func = funcionario.Listafuncionario(); 35 | dgvFuncionario.DataSource = func; 36 | btnEditar.Enabled = false; 37 | btnExcluir.Enabled = false; 38 | this.ActiveControl = txtNome; 39 | } 40 | 41 | private void btnInserir_Click(object sender, EventArgs e) 42 | { 43 | if (txtNome.Text == "" || txtMatricula.Text == "") 44 | { 45 | MessageBox.Show("Por favor, preencha todos os campos!"); 46 | return; 47 | } 48 | try 49 | { 50 | Funcionario funcionario = new Funcionario(); 51 | if (funcionario.RegistroRepetido(txtMatricula.Text) == true) 52 | { 53 | MessageBox.Show("Funcionário já existe em nossa base de dados!"); 54 | txtNome.Text = string.Empty; 55 | txtMatricula.Text = string.Empty; 56 | txtDataNascimento.Text = string.Empty; 57 | cbxTurno.Text = string.Empty; 58 | this.ActiveControl = txtNome; 59 | } 60 | else 61 | { 62 | string turno = cbxTurno.SelectedItem.ToString(); 63 | funcionario.Inserir(txtNome.Text, turno, txtDataNascimento.Text, txtMatricula.Text); 64 | MessageBox.Show("Funcionário cadastrado com sucesso!"); 65 | List func = funcionario.Listafuncionario(); 66 | dgvFuncionario.DataSource = func; 67 | txtNome.Text = string.Empty; 68 | txtMatricula.Text = string.Empty; 69 | txtDataNascimento.Text = string.Empty; 70 | cbxTurno.Text = string.Empty; 71 | string data = DateTime.Now.ToString("dd/MM/yyyy"); 72 | if (funcionario.Aniversario(data) == false) 73 | { 74 | pbxAniversario.Visible = false; 75 | } 76 | else 77 | { 78 | pbxAniversario.Visible = true; 79 | } 80 | } 81 | } 82 | catch (Exception erro) 83 | { 84 | MessageBox.Show(erro.Message); 85 | } 86 | } 87 | 88 | private void btnLocalizar_Click(object sender, EventArgs e) 89 | { 90 | if (txtId.Text == "") 91 | { 92 | MessageBox.Show("Por favor, preencha com um ID válido!"); 93 | this.ActiveControl = txtId; 94 | return; 95 | } 96 | try 97 | { 98 | Funcionario funcionario = new Funcionario(); 99 | int Id = Convert.ToInt32(txtId.Text.Trim()); 100 | if (funcionario.ExisteId(Id) == false) 101 | { 102 | MessageBox.Show("Por favor, preencha com um ID válido!"); 103 | txtId.Text = string.Empty; 104 | this.ActiveControl = txtId; 105 | return; 106 | } 107 | else 108 | { 109 | funcionario.Localizar(Id); 110 | txtNome.Text = funcionario.nome; 111 | txtMatricula.Text = funcionario.matricula; 112 | cbxTurno.Text = funcionario.turno; 113 | txtDataNascimento.Text = funcionario.data_nascimento; 114 | if (txtNome.Text != null) 115 | { 116 | btnEditar.Enabled = true; 117 | btnExcluir.Enabled = true; 118 | } 119 | } 120 | } 121 | catch (Exception erro) 122 | { 123 | MessageBox.Show(erro.Message); 124 | } 125 | } 126 | 127 | private void btnEditar_Click(object sender, EventArgs e) 128 | { 129 | try 130 | { 131 | Funcionario funcionario = new Funcionario(); 132 | int Id = Convert.ToInt32(txtId.Text.Trim()); 133 | if (funcionario.ExisteId(Id) == false) 134 | { 135 | MessageBox.Show("Por favor, digite um ID válido!"); 136 | txtId.Text = string.Empty; 137 | this.ActiveControl = txtId; 138 | return; 139 | } 140 | else 141 | { 142 | funcionario.Atualizar(Id, txtNome.Text, cbxTurno.Text, txtDataNascimento.Text, txtMatricula.Text); 143 | MessageBox.Show("Funcionário atualizado com sucesso!"); 144 | List func = funcionario.Listafuncionario(); 145 | dgvFuncionario.DataSource = func; 146 | txtId.Text = string.Empty; 147 | txtNome.Text = string.Empty; 148 | txtDataNascimento.Text = string.Empty; 149 | txtMatricula.Text = string.Empty; 150 | cbxTurno.Text = string.Empty; 151 | btnEditar.Enabled = false; 152 | btnExcluir.Enabled = false; 153 | string data = DateTime.Now.ToString("dd/MM/yyyy"); 154 | if (funcionario.Aniversario(data) == false) 155 | { 156 | pbxAniversario.Visible = false; 157 | } 158 | else 159 | { 160 | pbxAniversario.Visible = true; 161 | } 162 | } 163 | } 164 | catch (Exception erro) 165 | { 166 | MessageBox.Show(erro.Message); 167 | } 168 | } 169 | 170 | private void btnExcluir_Click(object sender, EventArgs e) 171 | { 172 | try 173 | { 174 | Funcionario funcionario = new Funcionario(); 175 | if (txtId.Text == "") 176 | { 177 | MessageBox.Show("Por favor, Digite um ID válido para proceder com a exclusão do funcionário"); 178 | return; 179 | } 180 | int Id = Convert.ToInt32(txtId.Text.Trim()); 181 | if(funcionario.ExisteId(Id) == false) 182 | { 183 | MessageBox.Show("Por favor digite um Id válido"); 184 | txtId.Text = string.Empty; 185 | this.ActiveControl = txtId; 186 | return; 187 | } 188 | else 189 | { 190 | funcionario.Excluir(Id); 191 | MessageBox.Show("Funcionario excluido com sucesso"); 192 | List func = funcionario.Listafuncionario(); 193 | dgvFuncionario.DataSource = func; 194 | txtId.Text = string.Empty; 195 | txtNome.Text = string.Empty; 196 | txtMatricula.Text = string.Empty; 197 | txtDataNascimento.Text = string.Empty; 198 | cbxTurno.Text = string.Empty; 199 | this.ActiveControl = txtNome; 200 | btnEditar.Enabled = false; 201 | btnExcluir.Enabled = false; 202 | string data = DateTime.Now.ToString("dd,MM,yyyy"); 203 | if(funcionario.Aniversario(data) == false) 204 | { 205 | pbxAniversario.Visible = false; 206 | } 207 | else 208 | { 209 | pbxAniversario.Visible=true; 210 | } 211 | 212 | } 213 | } 214 | catch (Exception erro) 215 | { 216 | MessageBox.Show(erro.Message); 217 | } 218 | } 219 | 220 | private void dgvFuncionario_CellContentClick(object sender, DataGridViewCellEventArgs e) 221 | { 222 | if (e.RowIndex >= 0) 223 | { 224 | DataGridViewRow row = this.dgvFuncionario.Rows[e.RowIndex]; 225 | this.dgvFuncionario.Rows[e.RowIndex].Selected = true; 226 | txtId.Text = row.Cells[0].Value.ToString(); 227 | txtNome.Text = row.Cells[1].Value.ToString(); 228 | cbxTurno.Text = row.Cells[2].Value.ToString(); 229 | txtDataNascimento.Text = row.Cells[3].Value.ToString(); 230 | txtMatricula.Text = row.Cells[4].Value.ToString(); 231 | } 232 | btnEditar.Enabled = true; 233 | btnExcluir.Enabled = true; 234 | } 235 | 236 | private void pbxAniversario_Click(object sender, EventArgs e) 237 | { 238 | frmAniversario aniversario = new frmAniversario(); 239 | aniversario.Show(); 240 | } 241 | } 242 | } 243 | 244 | --------------------------------------------------------------------------------