Skip to content

Commit a8319ca

Browse files
committed
v1.0.4
1 parent d849271 commit a8319ca

9 files changed

Lines changed: 630 additions & 2 deletions

File tree

.gitignore

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.userosscache
8+
*.sln.docstates
9+
10+
PublishProfiles
11+
12+
# User-specific files (MonoDevelop/Xamarin Studio)
13+
*.userprefs
14+
15+
# Build results
16+
[Dd]ebug/
17+
[Dd]ebugPublic/
18+
[Rr]elease/
19+
[Rr]eleases/
20+
[Xx]64/
21+
[Xx]86/
22+
[Bb]uild/
23+
bld/
24+
[Bb]in/
25+
[Oo]bj/
26+
27+
# Visual Studio 2015 cache/options directory
28+
.vs/
29+
# Uncomment if you have tasks that create the project's static files in wwwroot
30+
#wwwroot/
31+
32+
# MSTest test Results
33+
[Tt]est[Rr]esult*/
34+
[Bb]uild[Ll]og.*
35+
36+
# NUNIT
37+
*.VisualState.xml
38+
TestResult.xml
39+
40+
# Build Results of an ATL Project
41+
[Dd]ebugPS/
42+
[Rr]eleasePS/
43+
dlldata.c
44+
45+
# DNX
46+
project.lock.json
47+
artifacts/
48+
49+
*_i.c
50+
*_p.c
51+
*_i.h
52+
*.ilk
53+
*.meta
54+
*.obj
55+
*.pch
56+
*.pdb
57+
*.pgc
58+
*.pgd
59+
*.rsp
60+
*.sbr
61+
*.tlb
62+
*.tli
63+
*.tlh
64+
*.tmp
65+
*.tmp_proj
66+
*.log
67+
*.vspscc
68+
*.vssscc
69+
.builds
70+
*.pidb
71+
*.svclog
72+
*.scc
73+
74+
# Chutzpah Test files
75+
_Chutzpah*
76+
77+
# Visual C++ cache files
78+
ipch/
79+
*.aps
80+
*.ncb
81+
*.opendb
82+
*.opensdf
83+
*.sdf
84+
*.cachefile
85+
*.VC.db
86+
87+
# Visual Studio profiler
88+
*.psess
89+
*.vsp
90+
*.vspx
91+
*.sap
92+
93+
# TFS 2012 Local Workspace
94+
$tf/
95+
96+
# Guidance Automation Toolkit
97+
*.gpState
98+
99+
# ReSharper is a .NET coding add-in
100+
_ReSharper*/
101+
*.[Rr]e[Ss]harper
102+
*.DotSettings.user
103+
104+
# JustCode is a .NET coding add-in
105+
.JustCode
106+
107+
# TeamCity is a build add-in
108+
_TeamCity*
109+
110+
# DotCover is a Code Coverage Tool
111+
*.dotCover
112+
113+
# NCrunch
114+
_NCrunch_*
115+
.*crunch*.local.xml
116+
nCrunchTemp_*
117+
118+
# MightyMoose
119+
*.mm.*
120+
AutoTest.Net/
121+
122+
# Web workbench (sass)
123+
.sass-cache/
124+
125+
# Installshield output folder
126+
[Ee]xpress/
127+
128+
# DocProject is a documentation generator add-in
129+
DocProject/buildhelp/
130+
DocProject/Help/*.HxT
131+
DocProject/Help/*.HxC
132+
DocProject/Help/*.hhc
133+
DocProject/Help/*.hhk
134+
DocProject/Help/*.hhp
135+
DocProject/Help/Html2
136+
DocProject/Help/html
137+
138+
# Click-Once directory
139+
publish/
140+
141+
# Publish Web Output
142+
*.[Pp]ublish.xml
143+
*.azurePubxml
144+
145+
# TODO: Un-comment the next line if you do not want to checkin
146+
# your web deploy settings because they may include unencrypted
147+
# passwords
148+
#*.pubxml
149+
*.publishproj
150+
151+
# NuGet Packages
152+
*.nupkg
153+
# The packages folder can be ignored because of Package Restore
154+
**/packages/*
155+
# except build/, which is used as an MSBuild target.
156+
!**/packages/build/
157+
# Uncomment if necessary however generally it will be regenerated when needed
158+
#!**/packages/repositories.config
159+
# NuGet v3's project.json files produces more ignoreable files
160+
*.nuget.props
161+
*.nuget.targets
162+
163+
# Microsoft Azure Build Output
164+
csx/
165+
*.build.csdef
166+
167+
# Microsoft Azure Emulator
168+
ecf/
169+
rcf/
170+
171+
# Windows Store app package directory
172+
AppPackages/
173+
BundleArtifacts/
174+
175+
# Visual Studio cache files
176+
# files ending in .cache can be ignored
177+
*.[Cc]ache
178+
# but keep track of directories ending in .cache
179+
!*.[Cc]ache/
180+
181+
# Others
182+
ClientBin/
183+
[Ss]tyle[Cc]op.*
184+
~$*
185+
*~
186+
*.dbmdl
187+
*.dbproj.schemaview
188+
*.pfx
189+
*.publishsettings
190+
node_modules/
191+
orleans.codegen.cs
192+
193+
# RIA/Silverlight projects
194+
Generated_Code/
195+
196+
# Backup & report files from converting an old project file
197+
# to a newer Visual Studio version. Backup files are not needed,
198+
# because we have git ;-)
199+
_UpgradeReport_Files/
200+
Backup*/
201+
UpgradeLog*.XML
202+
UpgradeLog*.htm
203+
204+
# SQL Server files
205+
*.mdf
206+
*.ldf
207+
208+
# Business Intelligence projects
209+
*.rdl.data
210+
*.bim.layout
211+
*.bim_*.settings
212+
213+
# Microsoft Fakes
214+
FakesAssemblies/
215+
216+
# GhostDoc plugin setting file
217+
*.GhostDoc.xml
218+
219+
# Node.js Tools for Visual Studio
220+
.ntvs_analysis.dat
221+
222+
# Visual Studio 6 build log
223+
*.plg
224+
225+
# Visual Studio 6 workspace options file
226+
*.opt
227+
228+
# Visual Studio LightSwitch build output
229+
**/*.HTMLClient/GeneratedArtifacts
230+
**/*.DesktopClient/GeneratedArtifacts
231+
**/*.DesktopClient/ModelManifest.xml
232+
**/*.Server/GeneratedArtifacts
233+
**/*.Server/ModelManifest.xml
234+
_Pvt_Extensions
235+
236+
# LightSwitch generated files
237+
GeneratedArtifacts/
238+
ModelManifest.xml
239+
240+
# Paket dependency manager
241+
.paket/paket.exe
242+
243+
# FAKE - F# Make
244+
.fake/
245+
/ASP.NET Core/03 - WebAPI/Projetos/01 MinhaAPICompleta 3.1/API/MinhaAPICompleta.sln.DotSettings.zip
246+
/ASP.NET Core/04 - Enterprise Applications/Projetos/Instrutor/NerdStoreEnterprise/ComunicacaoFilaIdentidadeCliente.rar

NetDevPack.Brasil.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30011.22
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetDevPack.Brasil", "src\NetDevPack.Brasil\NetDevPack.Brasil.csproj", "{4C0DA22B-9B47-4C84-8B89-726DDE56763C}"
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+
{4C0DA22B-9B47-4C84-8B89-726DDE56763C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{4C0DA22B-9B47-4C84-8B89-726DDE56763C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{4C0DA22B-9B47-4C84-8B89-726DDE56763C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{4C0DA22B-9B47-4C84-8B89-726DDE56763C}.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 = {BA06990C-4C58-49E9-9079-6F31B305B38A}
24+
EndGlobalSection
25+
EndGlobal

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
1-
# NetDevPackBr
2-
.NET DevPack BR é uma coleção de utilidades como classes de documentos nacionais (CPF, CNPJ) com validação e classes de utilidade em geral. Desenvolvido para ser utilizado junto com o NetDevPack
1+
2+
<img src="https://raw.githubusercontent.com/EduardoPires/NetDevPack/master/img/IconGHReadME.png" alt=".NET DevPack" width="300px" />
3+
4+
What is the .NET DevPack?
5+
=====================
6+
A smart set of common classes and implementations to improve your development productivity.
7+
8+
## Give a Star! :star:
9+
If you liked the project or if NetDevPack helped you, please give a star ;)
10+
11+
## Get Started
12+
.NET DevPack can be installed using the Nuget package manager or the `dotnet` CLI.
13+
14+
```
15+
dotnet add package NetDevPack
16+
```
17+
18+
For ASP.NET Core Identity Pack:
19+
```
20+
dotnet add package NetDevPack.Identity
21+
```
22+
23+
---
24+
25+
| Package | Version | Popularity |
26+
| ------- | ----- | ----- |
27+
| `NetDevPack` | [![NuGet](https://img.shields.io/nuget/v/NetDevPack.svg)](https://nuget.org/packages/NetDevPack) | [![Nuget](https://img.shields.io/nuget/dt/NetDevPack.svg)](https://nuget.org/packages/NetDevPack) |
28+
| `NetDevPack.Identity` | [![NuGet](https://img.shields.io/nuget/v/NetDevPack.Identity.svg)](https://nuget.org/packages/NetDevPack.Identity) | [![Nuget](https://img.shields.io/nuget/dt/NetDevPack.Identity.svg)](https://nuget.org/packages/NetDevPack.Identity)
29+
| `NetDevPackBr` | [![NuGet](https://img.shields.io/nuget/v/NetDevPackBr.svg)](https://nuget.org/packages/NetDevPackBr) | [![Nuget](https://img.shields.io/nuget/dt/NetDevPackBr.svg)](https://nuget.org/packages/NetDevPackBr)
30+
31+
32+
### Examples
33+
- Coming soon.
34+
35+
### Documentation
36+
37+
- Coming soon.
38+
39+
40+
## About
41+
.NET DevPack was developed by [Eduardo Pires](http://eduardopires.net.br) under the [MIT license](LICENSE).
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using NetDevPack.Domain;
3+
using NetDevPack.Utilities;
4+
using NetDevPack.Brasil.Documentos.Validacao;
5+
6+
namespace NetDevPack.Brasil.Documentos
7+
{
8+
public class Cnpj
9+
{
10+
public string Numero { get; }
11+
12+
public Cnpj(string numero)
13+
{
14+
Numero = numero.OnlyNumbers(numero);
15+
if (!EstaValido()) throw new DomainException("CNPJ Inválido");
16+
}
17+
18+
public override string ToString() => SemMascara();
19+
20+
public string ComMascara()
21+
{
22+
if (Numero == "")
23+
return "";
24+
25+
const string pattern = @"{0:00\.000\.000\/0000\-00}";
26+
return string.Format(pattern, Convert.ToUInt64(Numero));
27+
}
28+
29+
public string SemMascara() => Numero;
30+
31+
public bool EstaValido() => new CnpjValidador(Numero).EstaValido();
32+
33+
public bool Equals(Cnpj cnpj) => Numero == cnpj.SemMascara();
34+
}
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using NetDevPack.Domain;
3+
using NetDevPack.Utilities;
4+
using NetDevPack.Brasil.Documentos.Validacao;
5+
6+
namespace NetDevPack.Brasil.Documentos
7+
{
8+
public class Cpf
9+
{
10+
public string Numero { get; }
11+
12+
public Cpf(string numero)
13+
{
14+
Numero = numero.OnlyNumbers(numero);
15+
if (!EstaValido()) throw new DomainException("CPF Inválido");
16+
}
17+
18+
public override string ToString() => SemMascara();
19+
20+
public string ComMascara()
21+
{
22+
if (Numero == "")
23+
return "";
24+
25+
const string pattern = @"{0:000\.000\.000\-00}";
26+
return string.Format(pattern, Convert.ToUInt64(Numero));
27+
}
28+
29+
public string SemMascara() => Numero;
30+
31+
public bool EstaValido() => new CpfValidador(Numero).EstaValido();
32+
33+
public bool Equals(Cpf cpf) => Numero == cpf.SemMascara();
34+
}
35+
}

0 commit comments

Comments
 (0)