├── .gitattributes ├── .gitignore ├── LICENSE ├── Nuget └── ACBr.Net.Consulta.nuspec ├── README.md └── src ├── ACBr.Net.Consulta.Demo ├── ACBr.Net.Consulta.Demo.csproj ├── ACBrConsultaCNPJ.ico ├── Extensions.cs ├── FrmCaptcha.Designer.cs ├── FrmCaptcha.cs ├── FrmCaptcha.resx ├── FrmMain.Designer.cs ├── FrmMain.cs ├── FrmMain.resx ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings └── packages.config ├── ACBr.Net.Consulta.sln └── ACBr.Net.Consulta ├── ACBr.Net.Consulta.csproj ├── ACBrCEP.bmp ├── ACBrCaptchaException.cs ├── ACBrComponentConsulta.cs ├── ACBrConsultaCNPJ.bmp ├── ACBrConsultaCPF.bmp ├── ACBrConsultaSintegra.bmp ├── ACBrEmpresa.cs ├── ACBrEndereco.cs ├── ACBrIBGE.bmp ├── ACBrMunicipio.cs ├── ACBrPessoa.cs ├── CEP ├── ACBrCEP.cs ├── CEPWebService.cs ├── CepWsClass.cs ├── CorreiosWebservice.cs └── ViaCepWebservice.cs ├── CaptchaEventArgs.cs ├── ConsultaExtensions.cs ├── ConsultaUF.cs ├── IBGE └── ACBrIBGE.cs ├── Properties └── AssemblyInfo.cs ├── Receita ├── ACBrConsultaCNPJ.cs └── ACBrConsultaCPF.cs ├── Sintegra ├── ACBrConsultaSintegra.cs ├── ConsultaSintegraBA.cs ├── ConsultaSintegraBase.cs ├── ConsultaSintegraDF.cs ├── ConsultaSintegraES.cs ├── ConsultaSintegraGO.cs ├── ConsultaSintegraMS.cs ├── ConsultaSintegraMT.cs ├── ConsultaSintegraPI.cs ├── ConsultaSintegraSP.cs └── IConsultaSintegra.cs └── packages.config /.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 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Microsoft Azure Build Output 166 | csx/ 167 | *.build.csdef 168 | 169 | # Microsoft Azure Emulator 170 | ecf/ 171 | rcf/ 172 | 173 | # Windows Store app package directories and files 174 | AppPackages/ 175 | BundleArtifacts/ 176 | Package.StoreAssociation.xml 177 | _pkginfo.txt 178 | 179 | # Visual Studio cache files 180 | # files ending in .cache can be ignored 181 | *.[Cc]ache 182 | # but keep track of directories ending in .cache 183 | !*.[Cc]ache/ 184 | 185 | # Others 186 | ClientBin/ 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # Since there are multiple workflows, uncomment next line to ignore bower_components 197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 | #bower_components/ 199 | 200 | # RIA/Silverlight projects 201 | Generated_Code/ 202 | 203 | # Backup & report files from converting an old project file 204 | # to a newer Visual Studio version. Backup files are not needed, 205 | # because we have git ;-) 206 | _UpgradeReport_Files/ 207 | Backup*/ 208 | UpgradeLog*.XML 209 | UpgradeLog*.htm 210 | 211 | # SQL Server files 212 | *.mdf 213 | *.ldf 214 | 215 | # Business Intelligence projects 216 | *.rdl.data 217 | *.bim.layout 218 | *.bim_*.settings 219 | 220 | # Microsoft Fakes 221 | FakesAssemblies/ 222 | 223 | # GhostDoc plugin setting file 224 | *.GhostDoc.xml 225 | 226 | # Node.js Tools for Visual Studio 227 | .ntvs_analysis.dat 228 | 229 | # Visual Studio 6 build log 230 | *.plg 231 | 232 | # Visual Studio 6 workspace options file 233 | *.opt 234 | 235 | # Visual Studio LightSwitch build output 236 | **/*.HTMLClient/GeneratedArtifacts 237 | **/*.DesktopClient/GeneratedArtifacts 238 | **/*.DesktopClient/ModelManifest.xml 239 | **/*.Server/GeneratedArtifacts 240 | **/*.Server/ModelManifest.xml 241 | _Pvt_Extensions 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | paket-files/ 246 | 247 | # FAKE - F# Make 248 | .fake/ 249 | 250 | # JetBrains Rider 251 | .idea/ 252 | *.sln.iml 253 | /src/ACBr.Net.Consulta.tss 254 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 ACBr.Net - Automação Comercial Brasil .Net 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Nuget/ACBr.Net.Consulta.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ACBr.Net.Consulta 5 | 1.0.1.0 6 | ACBr.Net.Consulta 7 | Grupo ACBr.Net 8 | Grupo ACBr.Net 9 | https://acbrnet.github.io 10 | https://avatars2.githubusercontent.com/u/7342977?v=3&s=200 11 | false 12 | Biblioteca para consulta de CNPJ, CPF, Dados do IBGE, CEP e Consulta ao Sintegra de alguns estados 13 | Copyright © Grupo ACBr.Net 2014 - 2017 14 | pt-BR 15 | ACBr ACBr.Net Automação Comercial IBGE CNPJ CPF Sintegra CEP 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Nuget count](http://img.shields.io/nuget/v/ACBr.Net.Consulta.svg)](https://www.nuget.org/packages/ACBr.Net.Consulta/) 2 | 3 | # ACBr.Net.Consulta 4 | 5 | Biblioteca para consulta de CNPJ e CPF na Receita Federal e para consulta de dados do IBGE -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/ACBr.Net.Consulta.Demo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8580A59B-944A-4743-9888-762348F1BF74} 8 | WinExe 9 | Properties 10 | ACBr.Net.Consulta.Demo 11 | ACBr.Net.Consulta.Demo 12 | v4.0 13 | 512 14 | publish\ 15 | true 16 | Disk 17 | false 18 | Foreground 19 | 7 20 | Days 21 | false 22 | false 23 | true 24 | 0 25 | 1.0.0.%2a 26 | false 27 | false 28 | true 29 | 30 | 31 | AnyCPU 32 | true 33 | full 34 | false 35 | bin\Debug\ 36 | DEBUG;TRACE 37 | prompt 38 | 4 39 | 40 | 41 | AnyCPU 42 | pdbonly 43 | true 44 | bin\Release\ 45 | TRACE 46 | prompt 47 | 4 48 | 49 | 50 | ACBrConsultaCNPJ.ico 51 | 52 | 53 | 54 | ..\packages\ACBr.Net.Core.1.2.0.0\lib\net40\ACBr.Net.Core.dll 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | Form 71 | 72 | 73 | FrmCaptcha.cs 74 | 75 | 76 | Form 77 | 78 | 79 | FrmMain.cs 80 | 81 | 82 | 83 | 84 | FrmCaptcha.cs 85 | 86 | 87 | FrmMain.cs 88 | 89 | 90 | ResXFileCodeGenerator 91 | Resources.Designer.cs 92 | Designer 93 | 94 | 95 | True 96 | Resources.resx 97 | True 98 | 99 | 100 | 101 | SettingsSingleFileGenerator 102 | Settings.Designer.cs 103 | 104 | 105 | True 106 | Settings.settings 107 | True 108 | 109 | 110 | 111 | 112 | {138b3db9-7cfd-4089-aeff-e66b7b4a76f0} 113 | ACBr.Net.Consulta 114 | 115 | 116 | 117 | 118 | False 119 | Microsoft .NET Framework 4 %28x86 and x64%29 120 | true 121 | 122 | 123 | False 124 | .NET Framework 3.5 SP1 125 | false 126 | 127 | 128 | False 129 | Windows Installer 4.5 130 | true 131 | 132 | 133 | 134 | 135 | 136 | 137 | 144 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/ACBrConsultaCNPJ.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta.Demo/ACBrConsultaCNPJ.ico -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using ACBr.Net.Core.Exceptions; 4 | 5 | namespace ACBr.Net.Consulta.Demo 6 | { 7 | public static class Extensions 8 | { 9 | public static void EnumDataSource(this ComboBox cmb, T? valorPadrao = null) where T : struct 10 | { 11 | Guard.Against(!typeof(T).IsEnum, "O tipo precisar ser um Enum."); 12 | 13 | cmb.DataSource = Enum.GetValues(typeof(T)); 14 | if (valorPadrao.HasValue) cmb.SelectedItem = valorPadrao.Value; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/FrmCaptcha.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ACBr.Net.Consulta.Demo 2 | { 3 | partial class FrmCaptcha 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.panel1 = new System.Windows.Forms.Panel(); 32 | this.captchaLinkLabel = new System.Windows.Forms.LinkLabel(); 33 | this.captchaPictureBox = new System.Windows.Forms.PictureBox(); 34 | this.enviarCaptchaButton = new System.Windows.Forms.Button(); 35 | this.captchaTextBox = new System.Windows.Forms.TextBox(); 36 | this.panel1.SuspendLayout(); 37 | ((System.ComponentModel.ISupportInitialize)(this.captchaPictureBox)).BeginInit(); 38 | this.SuspendLayout(); 39 | // 40 | // panel1 41 | // 42 | this.panel1.BackColor = System.Drawing.Color.White; 43 | this.panel1.Controls.Add(this.captchaLinkLabel); 44 | this.panel1.Controls.Add(this.captchaPictureBox); 45 | this.panel1.Location = new System.Drawing.Point(12, 6); 46 | this.panel1.Name = "panel1"; 47 | this.panel1.Size = new System.Drawing.Size(352, 117); 48 | this.panel1.TabIndex = 8; 49 | // 50 | // captchaLinkLabel 51 | // 52 | this.captchaLinkLabel.Dock = System.Windows.Forms.DockStyle.Top; 53 | this.captchaLinkLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 54 | this.captchaLinkLabel.Location = new System.Drawing.Point(0, 85); 55 | this.captchaLinkLabel.Name = "captchaLinkLabel"; 56 | this.captchaLinkLabel.Size = new System.Drawing.Size(352, 32); 57 | this.captchaLinkLabel.TabIndex = 2; 58 | this.captchaLinkLabel.TabStop = true; 59 | this.captchaLinkLabel.Text = "Atualizar Captcha"; 60 | this.captchaLinkLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 61 | this.captchaLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.captchaCnpjLinkLabel_LinkClicked); 62 | // 63 | // captchaPictureBox 64 | // 65 | this.captchaPictureBox.BackColor = System.Drawing.Color.White; 66 | this.captchaPictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 67 | this.captchaPictureBox.Dock = System.Windows.Forms.DockStyle.Top; 68 | this.captchaPictureBox.Location = new System.Drawing.Point(0, 0); 69 | this.captchaPictureBox.Name = "captchaPictureBox"; 70 | this.captchaPictureBox.Size = new System.Drawing.Size(352, 85); 71 | this.captchaPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 72 | this.captchaPictureBox.TabIndex = 1; 73 | this.captchaPictureBox.TabStop = false; 74 | // 75 | // enviarCaptchaButton 76 | // 77 | this.enviarCaptchaButton.Location = new System.Drawing.Point(270, 129); 78 | this.enviarCaptchaButton.Name = "enviarCaptchaButton"; 79 | this.enviarCaptchaButton.Size = new System.Drawing.Size(94, 38); 80 | this.enviarCaptchaButton.TabIndex = 7; 81 | this.enviarCaptchaButton.Text = "Enviar"; 82 | this.enviarCaptchaButton.UseVisualStyleBackColor = true; 83 | this.enviarCaptchaButton.Click += new System.EventHandler(this.enviarCaptchaButton_Click); 84 | // 85 | // captchaTextBox 86 | // 87 | this.captchaTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 88 | this.captchaTextBox.Location = new System.Drawing.Point(12, 129); 89 | this.captchaTextBox.Name = "captchaTextBox"; 90 | this.captchaTextBox.Size = new System.Drawing.Size(252, 38); 91 | this.captchaTextBox.TabIndex = 10; 92 | // 93 | // FrmCaptcha 94 | // 95 | this.AcceptButton = this.enviarCaptchaButton; 96 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 97 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 98 | this.ClientSize = new System.Drawing.Size(376, 179); 99 | this.ControlBox = false; 100 | this.Controls.Add(this.panel1); 101 | this.Controls.Add(this.enviarCaptchaButton); 102 | this.Controls.Add(this.captchaTextBox); 103 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 104 | this.KeyPreview = true; 105 | this.Name = "FrmCaptcha"; 106 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 107 | this.Text = "Digite o Captcha"; 108 | this.Shown += new System.EventHandler(this.FrmCaptcha_Shown); 109 | this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.FrmCaptcha_KeyUp); 110 | this.panel1.ResumeLayout(false); 111 | ((System.ComponentModel.ISupportInitialize)(this.captchaPictureBox)).EndInit(); 112 | this.ResumeLayout(false); 113 | this.PerformLayout(); 114 | 115 | } 116 | 117 | #endregion 118 | 119 | private System.Windows.Forms.Panel panel1; 120 | private System.Windows.Forms.LinkLabel captchaLinkLabel; 121 | private System.Windows.Forms.PictureBox captchaPictureBox; 122 | private System.Windows.Forms.Button enviarCaptchaButton; 123 | private System.Windows.Forms.TextBox captchaTextBox; 124 | } 125 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/FrmCaptcha.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | using ACBr.Net.Core.Extensions; 8 | 9 | namespace ACBr.Net.Consulta.Demo 10 | { 11 | public partial class FrmCaptcha : Form 12 | { 13 | #region Fields 14 | 15 | private Func getCaptcha; 16 | 17 | #endregion Fields 18 | 19 | #region Constructors 20 | 21 | public FrmCaptcha() 22 | { 23 | InitializeComponent(); 24 | } 25 | 26 | #endregion Constructors 27 | 28 | #region Methods 29 | 30 | #region EventHandlers 31 | 32 | private void FrmCaptcha_Shown(object sender, EventArgs e) 33 | { 34 | RefreshCaptcha(); 35 | } 36 | 37 | private void FrmCaptcha_KeyUp(object sender, KeyEventArgs e) 38 | { 39 | if (e.KeyCode != Keys.Escape) return; 40 | 41 | captchaTextBox.Text = string.Empty; 42 | Close(); 43 | } 44 | 45 | private void captchaCnpjLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 46 | { 47 | RefreshCaptcha(); 48 | } 49 | 50 | private void enviarCaptchaButton_Click(object sender, EventArgs e) 51 | { 52 | if (captchaTextBox.Text.IsEmpty()) 53 | { 54 | MessageBox.Show(this, @"Digite o captcha !"); 55 | return; 56 | } 57 | 58 | Close(); 59 | } 60 | 61 | #endregion EventHandlers 62 | 63 | private void RefreshCaptcha() 64 | { 65 | var primaryTask = Task.Factory.StartNew(() => getCaptcha()); 66 | primaryTask.ContinueWith(task => 67 | { 68 | if (task.Result.IsNull()) return; 69 | 70 | captchaPictureBox.Image = task.Result; 71 | captchaTextBox.Text = string.Empty; 72 | }, CancellationToken.None, TaskContinuationOptions.NotOnCanceled | TaskContinuationOptions.NotOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 73 | 74 | primaryTask.ContinueWith(task => MessageBox.Show(this, task.Exception.InnerExceptions.Select(x => x.Message).AsString()), 75 | CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 76 | } 77 | 78 | public static string GetCaptcha(Form parent, Func getCaptchaImage) 79 | { 80 | using (var form = new FrmCaptcha()) 81 | { 82 | form.getCaptcha = getCaptchaImage; 83 | form.ShowDialog(parent); 84 | 85 | return form.captchaTextBox.Text; 86 | } 87 | } 88 | 89 | #endregion Methods 90 | } 91 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/FrmCaptcha.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 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/FrmMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | using ACBr.Net.Consulta.CEP; 7 | using ACBr.Net.Core.Extensions; 8 | 9 | namespace ACBr.Net.Consulta.Demo 10 | { 11 | public partial class FrmMain : Form 12 | { 13 | #region Constructors 14 | 15 | public FrmMain() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | #endregion Constructors 21 | 22 | #region Methods 23 | 24 | #region EventHandlers 25 | 26 | private void FrmMain_Shown(object sender, EventArgs e) 27 | { 28 | cnpjMaskedTextBox.Focus(); 29 | webserviceCepComboBox.EnumDataSource(CEPWebService.None); 30 | ufCepComboBox.EnumDataSource(ConsultaUF.MS); 31 | ufSintegraComboBox.EnumDataSource(ConsultaUF.MS); 32 | } 33 | 34 | private void procurarCnpjButton_Click(object sender, EventArgs e) 35 | { 36 | ProcurarCNPJ(); 37 | } 38 | 39 | private void procurarCpfButton_Click(object sender, EventArgs e) 40 | { 41 | ProcurarCPF(); 42 | } 43 | 44 | private void procurarSintegraCnpjButton_Click(object sender, EventArgs e) 45 | { 46 | ProcurarSintegra(); 47 | } 48 | 49 | private void procurarIbgeCodigoButton_Click(object sender, EventArgs e) 50 | { 51 | var primaryTask = Task.Factory.StartNew(() => acbrIbge.BuscarPorCodigo(codigoIbgeTextBox.Text.ToInt32())); 52 | primaryTask.ContinueWith( 53 | task => MessageBox.Show(this, task.Exception.InnerExceptions.Select(x => x.Message).AsString(), this.Text), 54 | CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 55 | } 56 | 57 | private void procurarIbgeNomeButton_Click(object sender, EventArgs e) 58 | { 59 | var primaryTask = Task.Factory.StartNew(() => acbrIbge.BuscarPorNome(nomeIbgeTextBox.Text)); 60 | primaryTask.ContinueWith( 61 | task => MessageBox.Show(this, task.Exception.InnerExceptions.Select(x => x.Message).AsString(), this.Text), 62 | CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 63 | } 64 | 65 | private void buscaCepButton_Click(object sender, EventArgs e) 66 | { 67 | var primaryTask = Task.Factory.StartNew(() => acbrCEP.BuscarPorCEP(cepTextBox.Text)); 68 | primaryTask.ContinueWith( 69 | task => MessageBox.Show(this, task.Exception.InnerExceptions.Select(x => x.Message).AsString(), this.Text), 70 | CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 71 | } 72 | 73 | private void buscaLogradouroButton_Click(object sender, EventArgs e) 74 | { 75 | var uf = (ConsultaUF)ufCepComboBox.SelectedItem; 76 | var municipio = municipioCepTextBox.Text; 77 | var logradouro = logradouroCepTextBox.Text; 78 | 79 | var primaryTask = Task.Factory.StartNew(() => acbrCEP.BuscarPorLogradouro(uf, municipio, logradouro)); 80 | primaryTask.ContinueWith( 81 | task => MessageBox.Show(this, task.Exception.InnerExceptions.Select(x => x.Message).AsString(), this.Text), 82 | CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 83 | } 84 | 85 | private void webserviceCepComboBox_SelectedIndexChanged(object sender, EventArgs e) 86 | { 87 | acbrCEP.WebService = (CEPWebService)webserviceCepComboBox.SelectedItem; 88 | } 89 | 90 | private void acbrCpf_OnGetCaptcha(object sender, CaptchaEventArgs e) 91 | { 92 | e.Captcha = FrmCaptcha.GetCaptcha(this, () => acbrCpf.GetCaptcha()); 93 | } 94 | 95 | private void acbrCnpj_OnGetCaptcha(object sender, CaptchaEventArgs e) 96 | { 97 | e.Captcha = FrmCaptcha.GetCaptcha(this, () => acbrCnpj.GetCaptcha()); 98 | } 99 | 100 | private void acbrConsultaSintegra_OnGetCaptcha(object sender, CaptchaEventArgs e) 101 | { 102 | var uf = (ConsultaUF)ufSintegraComboBox.SelectedItem; 103 | e.Captcha = FrmCaptcha.GetCaptcha(this, () => acbrConsultaSintegra.GetCaptcha(uf)); 104 | } 105 | 106 | private void acbrIbge_OnBuscaEfetuada(object sender, EventArgs eventArgs) 107 | { 108 | ibgeDataGridView.DataSource = null; 109 | ibgeDataGridView.DataSource = acbrIbge.Resultados; 110 | } 111 | 112 | private void acbrCEP_OnBuscaEfetuada(object sender, EventArgs e) 113 | { 114 | cepDataGridView.DataSource = null; 115 | cepDataGridView.DataSource = acbrCEP.Resultados; 116 | } 117 | 118 | #endregion EventHandlers 119 | 120 | private void ProcurarCNPJ() 121 | { 122 | var primaryTask = Task.Factory.StartNew(() => acbrCnpj.Consulta(cnpjMaskedTextBox.Text)); 123 | primaryTask.ContinueWith(task => 124 | { 125 | var retorno = task.Result; 126 | tipoEmpresaTextBox.Text = retorno.TipoEmpresa; 127 | razaoSocialTextBox.Text = retorno.RazaoSocial; 128 | dataAberturaTextBox.Text = retorno.DataAbertura.ToShortDateString(); 129 | nomeFantasiaTextBox.Text = retorno.NomeFantasia; 130 | cnaePrimarioTextBox.Text = retorno.CNAE1; 131 | logradouroTextBox.Text = retorno.Logradouro; 132 | numeroTextBox.Text = retorno.Numero; 133 | complementoTextBox.Text = retorno.Complemento; 134 | bairroTextBox.Text = retorno.Bairro; 135 | municipioTextBox.Text = retorno.Municipio; 136 | ufTextBox.Text = retorno.UF.ToString(); 137 | cepCnpjTextBox.Text = retorno.CEP; 138 | situacaoTextBox.Text = retorno.Situacao; 139 | naturezaJuridicaTextBox.Text = retorno.NaturezaJuridica; 140 | cnaeSecundariosTextBox.Text = retorno.CNAE2.AsString(); 141 | }, CancellationToken.None, TaskContinuationOptions.NotOnCanceled | TaskContinuationOptions.NotOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 142 | 143 | primaryTask.ContinueWith(task => MessageBox.Show(this, task.Exception.InnerExceptions.Select(x => x.Message).AsString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error), 144 | CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 145 | } 146 | 147 | private void ProcurarCPF() 148 | { 149 | var primaryTask = Task.Factory.StartNew(() => acbrCpf.Consulta(cpfMaskedTextBox.Text, dataNascimentoMaskedTextBox.Text.ToData())); 150 | primaryTask.ContinueWith(task => 151 | { 152 | var retorno = task.Result; 153 | nomeTextBox.Text = retorno.Nome; 154 | situacaoCpfTextBox.Text = retorno.Situacao; 155 | digitoTextBox.Text = retorno.DigitoVerificador; 156 | comprovanteTextBox.Text = retorno.Emissao; 157 | dataInscricaoTextBox.Text = retorno.DataInscricao.ToShortDateString(); 158 | codControleTextBox.Text = retorno.CodCtrlControle; 159 | }, CancellationToken.None, TaskContinuationOptions.NotOnCanceled | TaskContinuationOptions.NotOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 160 | 161 | primaryTask.ContinueWith(task => MessageBox.Show(this, task.Exception.InnerExceptions.Select(x => x.Message).AsString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error), 162 | CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 163 | } 164 | 165 | private void ProcurarSintegra() 166 | { 167 | LimparCamposSintegra(); 168 | 169 | var uf = (ConsultaUF)ufSintegraComboBox.SelectedItem; 170 | var cnpj = cnpjSintegraMaskedTextBox.Text; 171 | var ie = inscricaoSintegraTextBox.Text; 172 | 173 | if (!cnpj.IsEmpty() && !cnpj.IsCNPJ()) 174 | { 175 | MessageBox.Show(this, "CNPJ informado não é valido.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); 176 | return; 177 | } 178 | 179 | if (!ie.IsEmpty() && !ie.IsIE(uf.Sigla())) 180 | { 181 | MessageBox.Show(this, "IE informado não é valido.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); 182 | return; 183 | } 184 | 185 | var primaryTask = Task.Factory.StartNew(() => acbrConsultaSintegra.Consulta(uf, cnpj, ie)); 186 | primaryTask.ContinueWith(task => 187 | { 188 | var retorno = task.Result; 189 | razaoSocialSintegraTextBox.Text = retorno.RazaoSocial; 190 | dataAberturaSintegraTextBox.Text = retorno.DataAbertura.ToShortDateString(); 191 | cnpjSintegraTextBox.Text = retorno.CNPJ; 192 | ieSintegraTextBox.Text = retorno.InscricaoEstadual; 193 | logradouroSintegraTextBox.Text = retorno.Logradouro; 194 | numeroSintegraTextBox.Text = retorno.Numero; 195 | complementoSintegraTextBox.Text = retorno.Complemento; 196 | bairroSintegraTextBox.Text = retorno.Bairro; 197 | municipioSintegraTextBox.Text = retorno.Municipio; 198 | ufSintegraTextBox.Text = retorno.UF.ToString(); 199 | cepSintegraTextBox.Text = retorno.CEP; 200 | situacaoSintegraTextBox.Text = retorno.Situacao; 201 | }, CancellationToken.None, TaskContinuationOptions.NotOnCanceled | TaskContinuationOptions.NotOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 202 | 203 | primaryTask.ContinueWith(task => MessageBox.Show(this, task.Exception.InnerExceptions.Select(x => x.Message).AsString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error), 204 | CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); 205 | } 206 | 207 | private void LimparCamposSintegra() 208 | { 209 | razaoSocialSintegraTextBox.Text = string.Empty; 210 | dataAberturaSintegraTextBox.Text = string.Empty; 211 | cnpjSintegraTextBox.Text = string.Empty; 212 | ieSintegraTextBox.Text = string.Empty; 213 | logradouroSintegraTextBox.Text = string.Empty; 214 | numeroSintegraTextBox.Text = string.Empty; 215 | complementoSintegraTextBox.Text = string.Empty; 216 | bairroSintegraTextBox.Text = string.Empty; 217 | municipioSintegraTextBox.Text = string.Empty; 218 | ufSintegraTextBox.Text = string.Empty; 219 | cepSintegraTextBox.Text = string.Empty; 220 | situacaoSintegraTextBox.Text = string.Empty; 221 | } 222 | 223 | #endregion Methods 224 | } 225 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/FrmMain.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 | 17, 17 122 | 123 | 124 | 117, 17 125 | 126 | 127 | 211, 17 128 | 129 | 130 | 310, 17 131 | 132 | 133 | 406, 17 134 | 135 | 136 | 137 | 138 | AAABAAEAGBgAAAEAIACICQAAFgAAACgAAAAYAAAAMAAAAAEAIAAAAAAAAAkAAMMOAADDDgAAAAAAAAAA 139 | AAByNwD/cjcA/3I3AP9yNwD/cjcA/3I3AP9yNwD/cjcA/3I3AP9yNwD/cjcA/3I3AP9yNwD/cjcA/3I3 140 | AP9yNwD/cjcA/3I3AP9yNwD/cjcA/3I3AP9yNwD/cjcA/3I3AP9yNwD/cjcA/3I3AP///////////3I3 141 | AP9yNwD//////3I3AP9yNwD//////3I3AP//////cjcA/3I3AP9yNwD/cjcA/3I3AP///////////3I3 142 | AP9yNwD/cjcA/3I3AP9yNwD/cjcA//////9yNwD/cjcA/3I3AP9yNwD//////3I3AP9yNwD//////3I3 143 | AP////////////////9yNwD/cjcA//////9yNwD/cjcA//////9yNwD/cjcA/3I3AP9yNwD/cjcA//// 144 | //9yNwD/cjcA/3I3AP9yNwD//////3I3AP///////////3I3AP//////cjcA/3I3AP//////cjcA/3I3 145 | AP9yNwD/cjcA//////9yNwD/cjcA/3I3AP9yNwD/cjcA//////9yNwD/cjcA/3I3AP9yNwD///////// 146 | //9yNwD//////3I3AP//////cjcA/3I3AP//////cjcA/3I3AP9yNwD/cjcA//////9yNwD/cjcA/3I3 147 | AP9yNwD/cjcA/3I3AP///////////3I3AP9yNwD//////3I3AP9yNwD//////3I3AP////////////// 148 | //9yNwD/cjcA/3I3AP9yNwD///////////9yNwD/cjcA/3I3AP90OgT/dDkD/3I3AP9yNwD/cjcA/3I3 149 | AP9yNwD/czgB/3M5Av9yNwD/cjcA/3I3AP9yNwD/dDkD/3I4Af9yNwD/cjcA/3M5Av9yOAH/cjcA/3I3 150 | AP9yNwD/cjcA/3M5Av///////////////////////////////////////////////////////////+bb 151 | 0f/g08f///////////////////////////////////////////////////////////////////////// 152 | ////////////////////////////////////////4dXJ/3tEFv90Og3/5NjN//////////////////// 153 | //////////////////////////////////////////////////////////////////////////////// 154 | ///m3NP/fkke/20wAP9uMQD/g08m/+LVy/////////////////////////////////////////////// 155 | /////////////////////////////////////////////+HUyP+MXDT/bS8A/3I3AP9yNwD/bC0A/4JN 156 | Iv/Zyrv///////////////////////////////////////////////////////////////////////// 157 | ////////5NnP/35IIf9sLwD/cjcA/3I3AP9yNwD/cjgA/2wvAP9zOAn/5NnP//////////////////// 158 | ///////////////////////////////////////////////////czcD/iFYs/2wvAP9yNwD/cjcA/3I3 159 | AP9yNwD/cTUA/2stAP+qhmn/8+7q//////////////////////////////////////////////////// 160 | /////////////9nIuf98RRj/bzIA/3I3AP9yNwD/cjcA/3I3AP9vMwD/cDQC/8Ssl//6+Pf///////// 161 | ////////////////////////////////////////////////////////8Onk/4JPKf9uMQD/cjcA/3I3 162 | AP9yNwD/cjYA/28yAP+EUCT/1MKz//v5+P/49PH/4tbM/8mzn/+og2T/0b6u/////v////////////// 163 | //////////////79/f///////f38/593Vf9tMAD/cjcA/3I3AP9wNQD/cDQE/5xyTv/NuKb/up2D/5ht 164 | R/+BTBz/dDoG/3E0Av9vMgH/cTYH/8iwm//8+/r/////////////////8u3o/8+8rP/f0sf//////+rh 165 | 2P9vMwT/cTUA/24xAP95QBb/vKGI//r39f/59vP/tZd8/3c+Fv9sLwD/cTYA/3I3AP9yNwD/cDUA/24w 166 | AP+3mX//9PDr///////s49z/nXRT/2YoAP+ASx7/0Luq//v6+P+tjG3/aiwA/5BiO//Ouqf/28y+/7yf 167 | iP+6nob/3M2//9K/rv+SZUH/bzEA/28zAP9yNwD/cjcA/3E2AP9sLwD/lmpI/+ri2v/dz8L/ilgz/20w 168 | AP9qLQD/bC0A/6yIbP/Hr5v/qoZq//Lt6P/Ks6D/aywA/2suAP9sLwD/bC0A/8q0ov/07+v/s5N4/3U7 169 | Df9tMAD/cTUA/28zAP9uMAD/g08p/93Pw///////8Onk/8Oqlf99SBz/aywA/2goAP98RRf/uJuA//Tv 170 | 6//Dqpb/bTAB/20wAP9tLwD/bC4A/8SrmP/28u//xa2Y/8+6qP+geFf/bjIA/3xEF/+8oIj/6uLa//// 171 | ///////////////////l2tD/t5h//3Q5Cf9pKgD/bjEA/5NnRP+2mH7/spF0/7GQdP+3mYD/w6qU/8my 172 | nf+ccVD/bjIC/+7m3//z7ur/08Gw/93Pw//+/v7/////////////////////////////////+vj2/+TZ 173 | z/+wj3L/iFcs/39KHf+Zbkj/zLel/9vLvf/LtaL/oHhV/3U7EP9nKAD/bjEA/+zk3f////////////// 174 | ///////////////////////////////////////////////////59vT/8Onj/+/p4//g08f/sZB2/4RQ 175 | JP91OxH/bC8A/4JOIv+8oIf/593U//38+/////////////////////////////////////////////// 176 | ///////////////////////////////////6+Pb/1sW2/6WAX/+lgGD/2sq8//Pt6f/8+/n///////// 177 | //////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 178 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 179 | AAA= 180 | 181 | 182 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace ACBr.Net.Consulta.Demo 5 | { 6 | internal static class Program 7 | { 8 | /// 9 | /// The main entry point for the application. 10 | /// 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new FrmMain()); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("ACBr.Net.ConsultaCNPJ.Demo")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("ACBr.Net.ConsultaCNPJ.Demo")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("8580a59b-944a-4743-9888-762348f1bf74")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/Properties/Resources.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 ACBr.Net.Consulta.Demo.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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 | /// Returns the cached ResourceManager instance used by this class. 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("ACBr.Net.Consulta.Demo.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 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 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/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 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/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 ACBr.Net.Consulta.Demo.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.Demo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACBr.Net.Consulta", "ACBr.Net.Consulta\ACBr.Net.Consulta.csproj", "{138B3DB9-7CFD-4089-AEFF-E66B7B4A76F0}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACBr.Net.Consulta.Demo", "ACBr.Net.Consulta.Demo\ACBr.Net.Consulta.Demo.csproj", "{8580A59B-944A-4743-9888-762348F1BF74}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {138B3DB9-7CFD-4089-AEFF-E66B7B4A76F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {138B3DB9-7CFD-4089-AEFF-E66B7B4A76F0}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {138B3DB9-7CFD-4089-AEFF-E66B7B4A76F0}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {138B3DB9-7CFD-4089-AEFF-E66B7B4A76F0}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {8580A59B-944A-4743-9888-762348F1BF74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {8580A59B-944A-4743-9888-762348F1BF74}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {8580A59B-944A-4743-9888-762348F1BF74}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {8580A59B-944A-4743-9888-762348F1BF74}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBr.Net.Consulta.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {138B3DB9-7CFD-4089-AEFF-E66B7B4A76F0} 8 | Library 9 | Properties 10 | ACBr.Net.Consulta 11 | ACBr.Net.Consulta 12 | v4.0 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | ..\..\bin\Debug\ACBr.Net.Consulta.xml 25 | 26 | 27 | pdbonly 28 | true 29 | ..\..\bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | ..\..\bin\Release\ACBr.Net.Consulta.xml 34 | 35 | 36 | 37 | ..\packages\ACBr.Net.Core.1.2.0.0\lib\net40\ACBr.Net.Core.dll 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | ACBr.Net 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | ACBr.Net 67 | 68 | 69 | ACBr.Net 70 | 71 | 72 | ACBr.Net 73 | 74 | 75 | ACBr.Net 76 | 77 | 78 | 79 | 80 | ACBr.Net 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 | 110 | Designer 111 | 112 | 113 | 114 | 121 | -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrCEP.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/ACBrCEP.bmp -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrCaptchaException.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-16-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-21-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | using System.Runtime.Serialization; 34 | 35 | namespace ACBr.Net.Consulta 36 | { 37 | public class ACBrCaptchaException : ApplicationException 38 | { 39 | /// 40 | /// Initializes a new instance of the class with a specified error message. 41 | /// 42 | /// The message that describes the error. 43 | public ACBrCaptchaException(string message) 44 | : base(message) 45 | { 46 | } 47 | 48 | /// 49 | /// Initializes a new instance of the class. 50 | /// 51 | public ACBrCaptchaException() 52 | { 53 | } 54 | 55 | /// 56 | /// Initializes a new instance of the class. 57 | /// 58 | /// The format. 59 | /// The arguments. 60 | public ACBrCaptchaException(string format, params object[] args) 61 | : base(string.Format(format, args)) 62 | { 63 | } 64 | 65 | /// 66 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 67 | /// 68 | /// The error message that explains the reason for the exception. 69 | /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. 70 | public ACBrCaptchaException(string message, Exception innerException) 71 | : base(message, innerException) 72 | { 73 | } 74 | 75 | /// 76 | /// Initializes a new instance of the class. 77 | /// 78 | /// The inner exception. 79 | /// The message. 80 | /// The arguments. 81 | public ACBrCaptchaException(Exception innerException, string message, params object[] args) 82 | : base(string.Format(message, args), innerException) 83 | { 84 | } 85 | 86 | /// 87 | /// Initializes a new instance of the class with serialized data. 88 | /// 89 | /// The that holds the serialized object data about the exception being thrown. 90 | /// The that contains contextual information about the source or destination. 91 | protected ACBrCaptchaException(SerializationInfo info, StreamingContext context) 92 | : base(info, context) 93 | { 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrComponentConsulta.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-16-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-16-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System.IO; 33 | using System.Net; 34 | using System.Text; 35 | using ACBr.Net.Core; 36 | using ACBr.Net.Core.Exceptions; 37 | using ACBr.Net.Core.Extensions; 38 | 39 | namespace ACBr.Net.Consulta 40 | { 41 | /// 42 | /// Classe ACBrComponentConsulta. 43 | /// 44 | /// 45 | public abstract class ACBrComponentConsulta : ACBrComponent 46 | { 47 | #region Field 48 | 49 | protected CookieContainer cookies; 50 | 51 | #endregion Field 52 | 53 | #region Method 54 | 55 | #region Protected Method 56 | 57 | protected virtual HttpWebRequest GetClient(string url) 58 | { 59 | var webRequest = (HttpWebRequest)WebRequest.Create(url); 60 | webRequest.CookieContainer = cookies; 61 | webRequest.ProtocolVersion = HttpVersion.Version11; 62 | webRequest.UserAgent = "Mozilla/4.0 (compatible; Synapse)"; 63 | 64 | webRequest.KeepAlive = true; 65 | webRequest.Headers.Add(HttpRequestHeader.KeepAlive, "300"); 66 | 67 | return webRequest; 68 | } 69 | 70 | protected override void OnInitialize() 71 | { 72 | cookies = new CookieContainer(); 73 | } 74 | 75 | protected override void OnDisposing() 76 | { 77 | } 78 | 79 | #endregion Protected Method 80 | 81 | #endregion Method 82 | } 83 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrConsultaCNPJ.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/ACBrConsultaCNPJ.bmp -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrConsultaCPF.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/ACBrConsultaCPF.bmp -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrConsultaSintegra.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/ACBrConsultaSintegra.bmp -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrEmpresa.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-16-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-16-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | 34 | namespace ACBr.Net.Consulta 35 | { 36 | /// 37 | /// Classe ACBrEmpresa. Esta classe não pode ser herdada. 38 | /// 39 | // ReSharper disable once InconsistentNaming 40 | public sealed class ACBrEmpresa 41 | { 42 | #region Constructors 43 | 44 | /// 45 | /// Initializes a new instance of the class. 46 | /// 47 | internal ACBrEmpresa() 48 | { 49 | } 50 | 51 | #endregion Constructors 52 | 53 | #region Properties 54 | 55 | /// 56 | /// Retorna o CNPJ. 57 | /// 58 | /// O CNPJ. 59 | public string CNPJ { get; internal set; } 60 | 61 | /// 62 | /// Retorna a inscrição estadual. 63 | /// 64 | /// The inscricao estadual. 65 | public string InscricaoEstadual { get; internal set; } 66 | 67 | /// 68 | /// Retorna o tipo empresa. 69 | /// 70 | /// O tipo empresa. 71 | public string TipoEmpresa { get; internal set; } 72 | 73 | /// 74 | /// Retorna a data abertura. 75 | /// 76 | /// A data abertura. 77 | public DateTime DataAbertura { get; internal set; } 78 | 79 | /// 80 | /// Retorna a razao social. 81 | /// 82 | /// The razao social. 83 | public string RazaoSocial { get; internal set; } 84 | 85 | /// 86 | /// Retorna o Nome Fantasia. 87 | /// 88 | /// The nomefantasia. 89 | public string NomeFantasia { get; internal set; } 90 | 91 | /// 92 | /// Retorna o cna e1. 93 | /// 94 | /// The cna e1. 95 | public string CNAE1 { get; internal set; } 96 | 97 | /// 98 | /// Gets the atividade economica. 99 | /// 100 | /// The atividade economica. 101 | public string AtividadeEconomica { get; internal set; } 102 | 103 | /// 104 | /// Retorna o logradouro. 105 | /// 106 | /// The logradouro. 107 | public string Logradouro { get; internal set; } 108 | 109 | /// 110 | /// Retorna o numero. 111 | /// 112 | /// The numero. 113 | public string Numero { get; internal set; } 114 | 115 | /// 116 | /// Retorna o complemento. 117 | /// 118 | /// The complemento. 119 | public string Complemento { get; internal set; } 120 | 121 | /// 122 | /// Retorna o cep. 123 | /// 124 | /// The cep. 125 | public string CEP { get; internal set; } 126 | 127 | /// 128 | /// Retorna o bairro. 129 | /// 130 | /// The bairro. 131 | public string Bairro { get; internal set; } 132 | 133 | /// 134 | /// Retorna o municipio. 135 | /// 136 | /// The municipio. 137 | public string Municipio { get; internal set; } 138 | 139 | /// 140 | /// Retorna o uf. 141 | /// 142 | /// The uf. 143 | public ConsultaUF UF { get; internal set; } 144 | 145 | /// 146 | /// Retorna o situacao. 147 | /// 148 | /// The situacao. 149 | public string Situacao { get; internal set; } 150 | 151 | /// 152 | /// Retorna o data situacao. 153 | /// 154 | /// The data situacao. 155 | public DateTime DataSituacao { get; internal set; } 156 | 157 | /// 158 | /// Retorna o natureza juridica. 159 | /// 160 | /// The natureza juridica. 161 | public string NaturezaJuridica { get; internal set; } 162 | 163 | /// 164 | /// Retorna o end eletronico. 165 | /// 166 | /// The end eletronico. 167 | public string EndEletronico { get; internal set; } 168 | 169 | /// 170 | /// Retorna o telefone. 171 | /// 172 | /// The telefone. 173 | public string Telefone { get; internal set; } 174 | 175 | /// 176 | /// Retorna o ENTE FEDERATIVO RESPONSÁVEL (EFR). 177 | /// 178 | /// The efr. 179 | public string EFR { get; internal set; } 180 | 181 | /// 182 | /// Retorna o motivo situacao. 183 | /// 184 | /// The motivo situacao. 185 | public string MotivoSituacao { get; internal set; } 186 | 187 | /// 188 | /// Retorna o cna e2. 189 | /// 190 | /// The cna e2. 191 | public string[] CNAE2 { get; internal set; } 192 | 193 | /// 194 | /// Retorna o situacao especial. 195 | /// 196 | /// The situacao especial. 197 | public string SituacaoEspecial { get; internal set; } 198 | 199 | /// 200 | /// Retorna o data situacao especial. 201 | /// 202 | /// The data situacao especial. 203 | public DateTime DataSituacaoEspecial { get; internal set; } 204 | 205 | /// 206 | /// Gets the data inicio atividade. 207 | /// 208 | /// The data inicio atividade. 209 | public DateTime DataInicioAtividade { get; internal set; } 210 | 211 | /// 212 | /// Gets the regime apuracao. 213 | /// 214 | /// The regime apuracao. 215 | public string RegimeApuracao { get; internal set; } 216 | 217 | /// 218 | /// Gets the data emitente n fe. 219 | /// 220 | /// The data emitente n fe. 221 | public DateTime DataEmitenteNFe { get; internal set; } 222 | 223 | #endregion Properties 224 | } 225 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrEndereco.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-16-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-16-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | namespace ACBr.Net.Consulta 33 | { 34 | /// 35 | /// Class ACBrEndereco. This class cannot be inherited. 36 | /// 37 | public sealed class ACBrEndereco 38 | { 39 | public string CEP { get; set; } 40 | 41 | public string TipoLogradouro { get; set; } 42 | 43 | public string Logradouro { get; set; } 44 | 45 | public string Complemento { get; set; } 46 | 47 | public string Bairro { get; set; } 48 | 49 | public string Municipio { get; set; } 50 | 51 | public ConsultaUF UF { get; set; } 52 | 53 | public string IBGEMunicipio { get; set; } 54 | 55 | public string IBGEUF { get; set; } 56 | } 57 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrIBGE.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/ACBrIBGE.bmp -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrMunicipio.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-18-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-18-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | namespace ACBr.Net.Consulta 33 | { 34 | public sealed class ACBrMunicipio 35 | { 36 | public int Codigo { get; internal set; } 37 | 38 | public string Nome { get; internal set; } 39 | 40 | public ConsultaUF UF { get; internal set; } 41 | 42 | public int CodigoUF { get; internal set; } 43 | 44 | public decimal Area { get; internal set; } 45 | } 46 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ACBrPessoa.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/ACBrPessoa.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/CEP/ACBrCEP.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/CEP/ACBrCEP.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/CEP/CEPWebService.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-21-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-21-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | namespace ACBr.Net.Consulta.CEP 33 | { 34 | public enum CEPWebService 35 | { 36 | None, 37 | Correios, 38 | ViaCep 39 | } 40 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/CEP/CepWsClass.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-21-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-21-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | 34 | namespace ACBr.Net.Consulta.CEP 35 | { 36 | internal abstract class CepWsClass 37 | { 38 | public virtual ACBrEndereco[] BuscarPorCEP(string cep) 39 | { 40 | throw new NotSupportedException("Este provedor não possui pesquisa por CEP."); 41 | } 42 | 43 | public virtual ACBrEndereco[] BuscarPorLogradouro(ConsultaUF uf, string municipio, string logradouro, string tipoLogradouro = "", 44 | string bairro = "") 45 | { 46 | throw new NotSupportedException("Este provedor não possui pesquisa por logradouro."); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/CEP/CorreiosWebservice.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-26-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-26-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | using System.IO; 34 | using System.Net; 35 | using System.Text; 36 | using System.Xml.Linq; 37 | using ACBr.Net.Core; 38 | using ACBr.Net.Core.Extensions; 39 | 40 | namespace ACBr.Net.Consulta.CEP 41 | { 42 | internal sealed class CorreiosWebservice : CepWsClass 43 | { 44 | #region Fields 45 | 46 | private const string CORREIOS_URL = "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl"; 47 | 48 | #endregion Fields 49 | 50 | #region Methods 51 | 52 | public override ACBrEndereco[] BuscarPorCEP(string cep) 53 | { 54 | try 55 | { 56 | var request = (HttpWebRequest)WebRequest.Create(CORREIOS_URL); 57 | request.ProtocolVersion = HttpVersion.Version10; 58 | request.UserAgent = "Mozilla/4.0 (compatible; Synapse)"; 59 | request.Method = "POST"; 60 | 61 | var postData = "" + 62 | " " + 64 | " " + 65 | " " + 66 | " " + 67 | " " + cep.OnlyNumbers() + "" + 68 | " " + 69 | " " + 70 | " "; 71 | 72 | var byteArray = Encoding.UTF8.GetBytes(postData); 73 | var dataStream = request.GetRequestStream(); 74 | dataStream.Write(byteArray, 0, byteArray.Length); 75 | dataStream.Close(); 76 | 77 | string retorno; 78 | 79 | // ReSharper disable once AssignNullToNotNullAttribute 80 | using (var stHtml = new StreamReader(request.GetResponse().GetResponseStream(), ACBrEncoding.ISO88591)) 81 | retorno = stHtml.ReadToEnd(); 82 | 83 | var doc = XDocument.Parse(retorno); 84 | var element = doc.ElementAnyNs("Envelope").ElementAnyNs("Body").ElementAnyNs("consultaCEPResponse").ElementAnyNs("return"); 85 | 86 | var endereco = new ACBrEndereco(); 87 | endereco.CEP = element.Element("cep").GetValue(); 88 | endereco.Bairro = element.Element("bairro").GetValue(); 89 | endereco.Municipio = element.Element("cidade").GetValue(); 90 | endereco.Complemento = $"{element.Element("complemento").GetValue()}{Environment.NewLine}{element.Element("complemento2").GetValue()}"; 91 | endereco.Logradouro = element.Element("end").GetValue(); 92 | endereco.UF = (ConsultaUF)Enum.Parse(typeof(ConsultaUF), element.Element("uf").GetValue()); 93 | 94 | endereco.TipoLogradouro = endereco.Logradouro.Split(' ')[0]; 95 | endereco.Logradouro = endereco.Logradouro.SafeReplace(endereco.TipoLogradouro, string.Empty); 96 | 97 | return new[] { endereco }; 98 | } 99 | catch (Exception exception) 100 | { 101 | throw new ACBrException(exception, "Erro ao consulta CEP."); 102 | } 103 | } 104 | 105 | #endregion Methods 106 | } 107 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/CEP/ViaCepWebservice.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-26-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-26-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | using System.Collections.Generic; 34 | using System.Linq; 35 | using System.Net; 36 | using System.Xml.Linq; 37 | using ACBr.Net.Core; 38 | using ACBr.Net.Core.Extensions; 39 | 40 | namespace ACBr.Net.Consulta.CEP 41 | { 42 | internal sealed class ViaCepWebservice : CepWsClass 43 | { 44 | #region Fields 45 | 46 | private const string VIACEP_URL = "https://viacep.com.br/ws"; 47 | 48 | #endregion Fields 49 | 50 | #region Methods 51 | 52 | #region Interface Methods 53 | 54 | public override ACBrEndereco[] BuscarPorCEP(string cep) 55 | { 56 | var url = $"{VIACEP_URL}/{cep.OnlyNumbers()}/xml"; 57 | var ret = ConsultaCEP(url); 58 | return ret.ToArray(); 59 | } 60 | 61 | public override ACBrEndereco[] BuscarPorLogradouro(ConsultaUF uf, string municipio, string logradouro, string tipoLogradouro = "", string bairro = "") 62 | { 63 | var url = $"{VIACEP_URL}/{uf}/{municipio.ToLower().ToTitleCase()}/{logradouro.ToLower().ToTitleCase()}/xml"; 64 | var ret = ConsultaCEP(url); 65 | 66 | if (!tipoLogradouro.IsEmpty()) 67 | { 68 | ret.RemoveAll(x => !string.Equals(x.TipoLogradouro.RemoveAccent(), tipoLogradouro.RemoveAccent(), StringComparison.CurrentCultureIgnoreCase)); 69 | } 70 | 71 | if (!bairro.IsEmpty()) 72 | { 73 | ret.RemoveAll(x => !string.Equals(x.Bairro.RemoveAccent(), bairro.RemoveAccent(), StringComparison.CurrentCultureIgnoreCase)); 74 | } 75 | 76 | return ret.ToArray(); 77 | } 78 | 79 | #endregion Interface Methods 80 | 81 | #region Private Methods 82 | 83 | private static List ConsultaCEP(string url) 84 | { 85 | try 86 | { 87 | var webRequest = (HttpWebRequest)WebRequest.Create(url); 88 | webRequest.ProtocolVersion = HttpVersion.Version10; 89 | webRequest.UserAgent = "Mozilla/4.0 (compatible; Synapse)"; 90 | 91 | webRequest.KeepAlive = true; 92 | webRequest.Headers.Add(HttpRequestHeader.KeepAlive, "300"); 93 | 94 | var response = webRequest.GetResponse(); 95 | var xmlStream = response.GetResponseStream(); 96 | var doc = XDocument.Load(xmlStream); 97 | 98 | var ret = new List(); 99 | 100 | var rootElement = doc.Element("xmlcep"); 101 | if (rootElement == null) return ret; 102 | 103 | if (rootElement.Element("enderecos") != null) 104 | { 105 | var element = rootElement.Element("enderecos"); 106 | if (element == null) return ret; 107 | 108 | var elements = element.Elements("endereco"); 109 | ret.AddRange(elements.Select(ProcessElement)); 110 | } 111 | else 112 | { 113 | var endereco = ProcessElement(rootElement); 114 | ret.Add(endereco); 115 | } 116 | 117 | return ret; 118 | } 119 | catch (Exception e) 120 | { 121 | throw new ACBrException(e, "Erro ao consutar CEP."); 122 | } 123 | } 124 | 125 | private static ACBrEndereco ProcessElement(XElement element) 126 | { 127 | var endereco = new ACBrEndereco 128 | { 129 | CEP = element.ElementAnyNs("cep").GetValue(), 130 | Logradouro = element.ElementAnyNs("logradouro").GetValue(), 131 | Complemento = element.ElementAnyNs("complemento").GetValue(), 132 | Bairro = element.ElementAnyNs("bairro").GetValue(), 133 | Municipio = element.ElementAnyNs("localidade").GetValue(), 134 | UF = element.ElementAnyNs("uf").GetValue(), 135 | IBGEMunicipio = element.ElementAnyNs("ibge").GetValue(), 136 | }; 137 | 138 | endereco.TipoLogradouro = endereco.Logradouro.Split(' ')[0]; 139 | endereco.Logradouro = endereco.Logradouro.SafeReplace(endereco.TipoLogradouro, string.Empty); 140 | 141 | return endereco; 142 | } 143 | 144 | #endregion Private Methods 145 | 146 | #endregion Methods 147 | } 148 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/CaptchaEventArgs.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-16-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-21-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | 34 | namespace ACBr.Net.Consulta 35 | { 36 | public sealed class CaptchaEventArgs : EventArgs 37 | { 38 | #region Constructors 39 | 40 | public CaptchaEventArgs() 41 | { 42 | } 43 | 44 | #endregion Constructors 45 | 46 | #region Proprieties 47 | 48 | public string Captcha { get; set; } 49 | 50 | #endregion Proprieties 51 | } 52 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ConsultaExtensions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/ConsultaExtensions.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/ConsultaUF.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/ConsultaUF.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/IBGE/ACBrIBGE.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/IBGE/ACBrIBGE.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("ACBr.Net.Consulta")] 8 | [assembly: AssemblyDescription("ACBr.Net Consulta")] 9 | [assembly: AssemblyProduct("ACBr.Net Consulta")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("ACBr.Net")] 12 | [assembly: AssemblyCopyright("Copyright © Grupo ACBr.Net 2014 - 2017")] 13 | [assembly: AssemblyTrademark("Grupo ACBr.Net https://acbrnet.github.io")] 14 | 15 | // Setting ComVisible to false makes the types in this assembly not visible 16 | // to COM components. If you need to access a type in this assembly from 17 | // COM, set the ComVisible attribute to true on that type. 18 | [assembly: ComVisible(false)] 19 | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM 21 | [assembly: Guid("138b3db9-7cfd-4089-aeff-e66b7b4a76f0")] 22 | 23 | // Version information for an assembly consists of the following four values: 24 | // 25 | // Major Version 26 | // Minor Version 27 | // Build Number 28 | // Revision 29 | // 30 | // You can specify all the values or you can default the Build and Revision Numbers 31 | // by using the '*' as shown below: 32 | // [assembly: AssemblyVersion("1.0.*")] 33 | [assembly: AssemblyVersion("1.1.0.0")] 34 | [assembly: AssemblyFileVersion("1.1.0.0")] -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Receita/ACBrConsultaCNPJ.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-16-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-16-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | using System.Collections.Generic; 34 | using System.Drawing; 35 | using System.IO; 36 | using System.Text; 37 | using ACBr.Net.Core; 38 | using ACBr.Net.Core.Exceptions; 39 | using ACBr.Net.Core.Extensions; 40 | 41 | namespace ACBr.Net.Consulta.Receita 42 | { 43 | /// 44 | /// Class ACBrConsultaCNPJ. This class cannot be inherited. 45 | /// 46 | /// 47 | [ToolboxBitmap(typeof(ACBrConsultaCNPJ), "ACBr.Net.Consulta.ACBrConsultaCNPJ.bmp")] 48 | public sealed class ACBrConsultaCNPJ : ACBrComponentConsulta 49 | { 50 | #region Field 51 | 52 | private const string urlBaseReceitaFederal = "http://www.receita.fazenda.gov.br/pessoajuridica/cnpj/cnpjreva/"; 53 | private const string paginaValidacao = "valida.asp"; 54 | private const string paginaPrincipal = "cnpjreva_solicitacao3.asp"; 55 | private const string paginaCaptcha = "captcha/gerarCaptcha.asp"; 56 | 57 | #endregion Field 58 | 59 | #region Events 60 | 61 | /// 62 | /// Evento disparado se a consultar for chamada com o captcha vazio. 63 | /// 64 | public event EventHandler OnGetCaptcha; 65 | 66 | #endregion Events 67 | 68 | #region Method 69 | 70 | /// 71 | /// Retorna a imagem do Captcha para fazer a consulta. 72 | /// 73 | /// Imagem Captcha. 74 | public Image GetCaptcha() 75 | { 76 | var request = GetClient(urlBaseReceitaFederal + paginaPrincipal); 77 | var response = request.GetResponse(); 78 | 79 | string htmlResult; 80 | using (var reader = new StreamReader(response.GetResponseStream())) 81 | { 82 | htmlResult = reader.ReadToEnd(); 83 | } 84 | 85 | if (htmlResult.Length < 1) return null; 86 | 87 | request = GetClient(urlBaseReceitaFederal + paginaCaptcha); 88 | response = request.GetResponse(); 89 | 90 | var captchaStream = response.GetResponseStream(); 91 | Guard.Against(captchaStream.IsNull(), "Erro ao carregar captcha"); 92 | 93 | return Image.FromStream(captchaStream); 94 | } 95 | 96 | /// 97 | /// Consulta o CNPJ especifico. 98 | /// 99 | /// O CNPJ. 100 | /// O captcha. 101 | /// Dados da empresa. 102 | public ACBrEmpresa Consulta(string cnpj, string captcha = "") 103 | { 104 | Guard.Against(cnpj.IsEmpty(), "Necessário informar o CNPJ."); 105 | Guard.Against(!cnpj.IsCNPJ(), "CNPJ inválido."); 106 | 107 | if (captcha.IsEmpty() && OnGetCaptcha != null) 108 | { 109 | var e = new CaptchaEventArgs(); 110 | OnGetCaptcha.Raise(this, e); 111 | 112 | captcha = e.Captcha; 113 | } 114 | 115 | Guard.Against(captcha.IsEmpty(), "Necessário digitar o captcha."); 116 | 117 | var request = GetClient(urlBaseReceitaFederal + paginaValidacao); 118 | 119 | var postData = new Dictionary 120 | { 121 | {"origem", "comprovante"}, 122 | {"cnpj", cnpj.OnlyNumbers()}, 123 | {"txtTexto_captcha_serpro_gov_br", captcha}, 124 | {"submit1", "Consultar"}, 125 | {"search_type", "cnpj"} 126 | }; 127 | 128 | var retorno = request.SendPost(postData); 129 | 130 | Guard.Against(retorno.Contains("Imagem com os caracteres anti robô"), "Catpcha errado."); 131 | Guard.Against(retorno.Contains("Erro na Consulta"), "Erro na Consulta."); 132 | Guard.Against(retorno.Contains("Verifique se o mesmo foi digitado corretamente"), $"Não existe no Cadastro de Pessoas Jurídicas o número de CNPJ informado.{Environment.NewLine}Verifique se o mesmo foi digitado corretamente."); 133 | Guard.Against(retorno.Contains("a. No momento não podemos atender a sua solicitação. Por favor tente mais tarde."), "Erro no site da receita federal. Tente mais tarde."); 134 | 135 | return ProcessResponse(retorno); 136 | } 137 | 138 | #region Private Methods 139 | 140 | private static ACBrEmpresa ProcessResponse(string retorno) 141 | { 142 | var result = new ACBrEmpresa(); 143 | 144 | try 145 | { 146 | var retornoRfb = new List(); 147 | retornoRfb.AddText(retorno.StripHtml()); 148 | retornoRfb.RemoveEmptyLines(); 149 | 150 | result.CNPJ = LerCampo(retornoRfb, "NÚMERO DE INSCRIÇÃO"); 151 | if (!result.CNPJ.IsEmpty()) result.TipoEmpresa = LerCampo(retornoRfb, result.CNPJ); 152 | result.DataAbertura = LerCampo(retornoRfb, "DATA DE ABERTURA").ToData(); 153 | result.RazaoSocial = LerCampo(retornoRfb, "NOME EMPRESARIAL"); 154 | result.NomeFantasia = LerCampo(retornoRfb, "TÍTULO DO ESTABELECIMENTO (NOME DE FANTASIA)"); 155 | result.CNAE1 = LerCampo(retornoRfb, "CÓDIGO E DESCRIÇÃO DA ATIVIDADE ECONÔMICA PRINCIPAL"); 156 | result.Logradouro = LerCampo(retornoRfb, "LOGRADOURO"); 157 | result.Numero = LerCampo(retornoRfb, "NÚMERO"); 158 | result.Complemento = LerCampo(retornoRfb, "COMPLEMENTO"); 159 | result.CEP = LerCampo(retornoRfb, "CEP").FormataCEP(); 160 | result.Bairro = LerCampo(retornoRfb, "BAIRRO/DISTRITO"); 161 | result.Municipio = LerCampo(retornoRfb, "MUNICÍPIO"); 162 | result.UF = (ConsultaUF)Enum.Parse(typeof(ConsultaUF), LerCampo(retornoRfb, "UF").ToUpper()); 163 | result.Situacao = LerCampo(retornoRfb, "SITUAÇÃO CADASTRAL"); 164 | result.DataSituacao = LerCampo(retornoRfb, "DATA DA SITUAÇÃO CADASTRAL").ToData(); 165 | result.NaturezaJuridica = LerCampo(retornoRfb, "CÓDIGO E DESCRIÇÃO DA NATUREZA JURÍDICA"); 166 | result.EndEletronico = LerCampo(retornoRfb, "ENDEREÇO ELETRÔNICO"); 167 | if (result.EndEletronico == "TELEFONE") result.EndEletronico = string.Empty; 168 | result.Telefone = LerCampo(retornoRfb, "TELEFONE"); 169 | result.EFR = LerCampo(retornoRfb, "ENTE FEDERATIVO RESPONSÁVEL (EFR)"); 170 | result.MotivoSituacao = LerCampo(retornoRfb, "MOTIVO DE SITUAÇÃO CADASTRAL"); 171 | result.SituacaoEspecial = LerCampo(retornoRfb, "SITUAÇÃO ESPECIAL"); 172 | result.DataSituacaoEspecial = LerCampo(retornoRfb, "DATA DA SITUAÇÃO ESPECIAL").ToData(); 173 | 174 | var listCNAE2 = new List(); 175 | var aux = LerCampo(retornoRfb, "CÓDIGO E DESCRIÇÃO DAS ATIVIDADES ECONÔMICAS SECUNDÁRIAS"); 176 | if (!aux.IsEmpty()) listCNAE2.Add(aux.RemoveDoubleSpaces()); 177 | 178 | do 179 | { 180 | aux = LerCampo(retornoRfb, aux); 181 | if (!aux.IsEmpty()) listCNAE2.Add(aux.RemoveDoubleSpaces()); 182 | } while (!aux.IsEmpty()); 183 | 184 | result.CNAE2 = listCNAE2.ToArray(); 185 | } 186 | catch (Exception exception) 187 | { 188 | throw new ACBrException(exception, "Erro ao processar retorno."); 189 | } 190 | 191 | return result; 192 | } 193 | 194 | private static string LerCampo(IList retorno, string campo) 195 | { 196 | var ret = string.Empty; 197 | for (var i = 0; i < retorno.Count; i++) 198 | { 199 | var linha = retorno[i].Trim(); 200 | if (linha != campo) continue; 201 | 202 | ret = retorno[i + 1].Trim().Replace(" ", string.Empty); 203 | retorno.RemoveAt(i); 204 | break; 205 | } 206 | 207 | return ret; 208 | } 209 | 210 | #endregion Private Methods 211 | 212 | #endregion Method 213 | } 214 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Receita/ACBrConsultaCPF.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/Receita/ACBrConsultaCPF.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ACBrConsultaSintegra.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/Sintegra/ACBrConsultaSintegra.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraBA.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 07-05-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 07-05-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | using System.Collections.Generic; 34 | using System.Drawing; 35 | using System.Text; 36 | using ACBr.Net.Core; 37 | using ACBr.Net.Core.Exceptions; 38 | using ACBr.Net.Core.Extensions; 39 | 40 | namespace ACBr.Net.Consulta.Sintegra 41 | { 42 | internal class ConsultaSintegraBA : ConsultaSintegraBase 43 | { 44 | #region Fields 45 | 46 | private const string URL_CONSULTA = @"http://www.sefaz.ba.gov.br/Sintegra/Result.asp"; 47 | 48 | #endregion Fields 49 | 50 | #region Constructors 51 | 52 | public ConsultaSintegraBA() 53 | { 54 | HasCaptcha = false; 55 | } 56 | 57 | #endregion Constructors 58 | 59 | #region Methods 60 | 61 | public override Image GetCaptcha() 62 | { 63 | return null; 64 | } 65 | 66 | public override ACBrEmpresa Consulta(string cnpj, string ie, string captcha) 67 | { 68 | var request = GetClient(URL_CONSULTA); 69 | 70 | var postData = new Dictionary 71 | { 72 | { "txt_CNPJ", cnpj.OnlyNumbers() }, 73 | { "txt_IE", ie.OnlyNumbers() }, 74 | { "EstadoSelecionado", "da+Bahia" }, 75 | { "SiglaEstadoSelecionado", "BA" } 76 | }; 77 | var retorno = request.SendPost(postData, Encoding.UTF8); 78 | 79 | Guard.Against(retorno.Contains("Nenhum resultado encontrado"), $"Não existe no Cadastro do sintegra o número de CNPJ/IE informado.{Environment.NewLine}Verifique se o mesmo foi digitado corretamente."); 80 | Guard.Against(retorno.Contains("a. No momento não podemos atender a sua solicitação. Por favor tente mais tarde."), "Erro no site do sintegra. Tente mais tarde."); 81 | Guard.Against(retorno.Contains("Atenção"), "Erro ao fazer a consulta"); 82 | 83 | return ProcessResponse(retorno); 84 | } 85 | 86 | #region Private Methods 87 | 88 | /// 89 | /// Processa o retorno html e retorno o objeto tipo ACBrEmpresa com dados 90 | /// 91 | /// 92 | /// objeto tipo ACBrEmpresa 93 | private static ACBrEmpresa ProcessResponse(string retorno) 94 | { 95 | var result = new ACBrEmpresa(); 96 | 97 | try 98 | { 99 | var dadosRetorno = new List(); 100 | dadosRetorno.AddText(retorno.StripHtml()); 101 | dadosRetorno.RemoveEmptyLines(); 102 | 103 | result.CNPJ = LerCampo(dadosRetorno, "CNPJ:"); 104 | result.InscricaoEstadual = LerCampo(dadosRetorno, "Inscrição Estadual:"); 105 | result.RazaoSocial = LerCampo(dadosRetorno, "Social:"); 106 | result.Logradouro = LerCampo(dadosRetorno, "Logradouro:"); 107 | result.Numero = LerCampo(dadosRetorno, "Número:"); 108 | result.Complemento = LerCampo(dadosRetorno, "Complemento:"); 109 | result.Bairro = LerCampo(dadosRetorno, "Bairro:"); 110 | result.Municipio = LerCampo(dadosRetorno, "Município:"); 111 | result.UF = (ConsultaUF)Enum.Parse(typeof(ConsultaUF), LerCampo(dadosRetorno, "UF:").ToUpper()); 112 | result.CEP = LerCampo(dadosRetorno, "CEP:").FormataCEP(); 113 | result.EndEletronico = LerCampo(dadosRetorno, "Eletrônico:"); 114 | result.Telefone = LerCampo(dadosRetorno, "Telefone:"); 115 | result.AtividadeEconomica = LerCampo(dadosRetorno, "Econômica:"); 116 | result.DataAbertura = LerCampo(dadosRetorno, "da Inscrição Estadual:").ToData(); 117 | result.Situacao = LerCampo(dadosRetorno, "Situação Cadastral Atual:"); 118 | result.DataSituacao = LerCampo(dadosRetorno, "desta Situação Cadastral:").ToData(); 119 | result.RegimeApuracao = LerCampo(dadosRetorno, "de Apuração de ICMS:"); 120 | result.DataEmitenteNFe = LerCampo(dadosRetorno, "Emitente de NFe desde:").ToData(); 121 | } 122 | catch (Exception exception) 123 | { 124 | throw new ACBrException(exception, "Erro ao processar retorno."); 125 | } 126 | 127 | return result; 128 | } 129 | 130 | private static string LerCampo(IList retorno, string campo) 131 | { 132 | var ret = string.Empty; 133 | for (var i = 0; i < retorno.Count; i++) 134 | { 135 | var linha = retorno[i].Trim(); 136 | if (linha != campo) continue; 137 | 138 | ret = retorno[i + 1].Trim().Replace(" ", string.Empty); 139 | retorno.RemoveAt(i); 140 | break; 141 | } 142 | 143 | return ret.RemoveDoubleSpaces(); 144 | } 145 | 146 | #endregion Private Methods 147 | 148 | #endregion Methods 149 | } 150 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraBase.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-16-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-16-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System; 33 | using System.Collections.Generic; 34 | using System.Drawing; 35 | using System.IO; 36 | using System.Net; 37 | using System.Text; 38 | using ACBr.Net.Core; 39 | using ACBr.Net.Core.Exceptions; 40 | 41 | namespace ACBr.Net.Consulta.Sintegra 42 | { 43 | internal abstract class ConsultaSintegraBase : IConsultaSintegra where T : class, IConsultaSintegra 44 | { 45 | #region Field 46 | 47 | protected CookieContainer cookies; 48 | protected Dictionary urlParams; 49 | private static T instance; 50 | 51 | #endregion Field 52 | 53 | #region Constructors 54 | 55 | protected ConsultaSintegraBase() 56 | { 57 | cookies = new CookieContainer(); 58 | urlParams = new Dictionary(); 59 | HasCaptcha = true; 60 | } 61 | 62 | #endregion Constructors 63 | 64 | #region Properties 65 | 66 | public static T Instance => instance ?? (instance = Activator.CreateInstance()); 67 | 68 | public bool HasCaptcha { get; protected set; } 69 | 70 | #endregion Properties 71 | 72 | #region Method 73 | 74 | #region Interface Methods 75 | 76 | public abstract Image GetCaptcha(); 77 | 78 | public abstract ACBrEmpresa Consulta(string cnpj, string ie, string captcha); 79 | 80 | #endregion Interface Methods 81 | 82 | #region Protected Method 83 | 84 | protected HttpWebRequest GetClient(string url) 85 | { 86 | var webRequest = (HttpWebRequest)WebRequest.Create(url); 87 | webRequest.CookieContainer = cookies; 88 | webRequest.ProtocolVersion = HttpVersion.Version11; 89 | webRequest.UserAgent = "Mozilla/4.0 (compatible; Synapse)"; 90 | 91 | webRequest.KeepAlive = true; 92 | webRequest.Headers.Add(HttpRequestHeader.KeepAlive, "300"); 93 | 94 | return webRequest; 95 | } 96 | 97 | #endregion Protected Method 98 | 99 | #endregion Method 100 | } 101 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraDF.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : Regis Araujo 4 | // Created : 05-04-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 05-08-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using ACBr.Net.Core; 33 | using ACBr.Net.Core.Exceptions; 34 | using ACBr.Net.Core.Extensions; 35 | using System; 36 | using System.Collections.Generic; 37 | using System.Drawing; 38 | using System.Linq; 39 | using System.Net; 40 | using System.Text; 41 | using System.Text.RegularExpressions; 42 | 43 | namespace ACBr.Net.Consulta.Sintegra 44 | { 45 | internal class ConsultaSintegraDF : ConsultaSintegraBase 46 | { 47 | #region Fields 48 | 49 | private const string URL_CONSULTA = @"http://www.fazenda.df.gov.br/aplicacoes/sintegra/consulta.cfm"; 50 | private const string URL_CONSULTA_DET = @"http://www.fazenda.df.gov.br/aplicacoes/sintegra/detalhamento.cfm"; 51 | private const string URL_REFERER1 = @"http://www.fazenda.df.gov.br/area.cfm?id_area=110"; 52 | 53 | #endregion Fields 54 | 55 | #region Constructors 56 | 57 | public ConsultaSintegraDF() 58 | { 59 | HasCaptcha = false; 60 | } 61 | 62 | #endregion Constructors 63 | 64 | #region Methods 65 | 66 | public override Image GetCaptcha() 67 | { 68 | return null; 69 | } 70 | 71 | public override ACBrEmpresa Consulta(string cnpj, string ie, string captcha) 72 | { 73 | var request = GetClient(URL_CONSULTA); 74 | request.Referer = URL_REFERER1; 75 | 76 | var postData = new Dictionary 77 | { 78 | { "sefp", "1" }, 79 | { "estado", "DF" } 80 | }; 81 | if (cnpj.IsEmpty()) 82 | { 83 | postData.Add("identificador", "3"); 84 | postData.Add("argumento", ie); 85 | } 86 | else 87 | { 88 | postData.Add("identificador", "2"); 89 | postData.Add("argumento", cnpj); 90 | } 91 | 92 | var retorno = request.SendPost(postData, Encoding.UTF8); 93 | var dadosRetorno = new List(); 94 | dadosRetorno.AddText(WebUtility.HtmlDecode(retorno.StripHtml().Replace(" ", Environment.NewLine))); 95 | dadosRetorno.RemoveEmptyLines(); 96 | 97 | var cfdf = LerCampo(dadosRetorno, "SITUAÇÃO"); 98 | if (cfdf != string.Empty) 99 | { 100 | request = GetClient(URL_CONSULTA_DET); 101 | request.Referer = URL_CONSULTA; 102 | 103 | postData.Clear(); 104 | postData.Add("cCFDF", cfdf); 105 | retorno = request.SendPost(postData, Encoding.UTF8); 106 | } 107 | 108 | Guard.Against(retorno.Contains("Nenhum resultado encontrado"), $"Não existe no Cadastro do sintegra o número de CNPJ/IE informado.{Environment.NewLine}Verifique se o mesmo foi digitado corretamente."); 109 | Guard.Against(retorno.Contains("a. No momento não podemos atender a sua solicitação. Por favor tente mais tarde."), "Erro no site do sintegra. Tente mais tarde."); 110 | Guard.Against(retorno.Contains("Atenção"), "Erro ao fazer a consulta"); 111 | 112 | return ProcessResponse(retorno); 113 | } 114 | 115 | #region Private Methods 116 | 117 | /// 118 | /// Processa o retorno html e retorno o objeto tipo ACBrEmpresa com dados 119 | /// 120 | /// 121 | /// objeto tipo ACBrEmpresa 122 | private static ACBrEmpresa ProcessResponse(string retorno) 123 | { 124 | const string tableExpression = "(.*?)"; 125 | const string trPattern = ""; 126 | const string tdPattern = "(.*?)"; 127 | 128 | var result = new ACBrEmpresa(); 129 | try 130 | { 131 | var dadosRetorno = new List(); 132 | var tableContents = GetContents(retorno, tableExpression); 133 | foreach (var tableContent in tableContents) 134 | { 135 | var trContents = GetContents(tableContent, trPattern); 136 | foreach (var trContent in trContents) 137 | { 138 | var tdContents = GetContents(trContent, tdPattern); 139 | foreach (var item in tdContents) 140 | { 141 | dadosRetorno.AddText((Regex.Replace(item, "<.*?>", string.Empty).Trim())); 142 | } 143 | } 144 | } 145 | result.CNPJ = LerCampo(dadosRetorno, "CNPJ/CPF"); 146 | result.InscricaoEstadual = LerCampo(dadosRetorno, "CF/DF"); 147 | result.RazaoSocial = LerCampo(dadosRetorno, "RAZÃO SOCIAL"); 148 | result.Logradouro = LerCampo(dadosRetorno, "LOGRADOURO"); 149 | result.Numero = LerCampo(dadosRetorno, "Número:"); 150 | result.Complemento = LerCampo(dadosRetorno, "Complemento:"); 151 | result.Bairro = LerCampo(dadosRetorno, "BAIRRO"); 152 | result.Municipio = LerCampo(dadosRetorno, "MUNICÍPIO"); 153 | result.UF = (ConsultaUF)Enum.Parse(typeof(ConsultaUF), LerCampo(dadosRetorno, "UF").ToUpper()); 154 | result.CEP = LerCampo(dadosRetorno, "CEP").FormataCEP(); 155 | result.Telefone = LerCampo(dadosRetorno, "Telefone"); 156 | result.AtividadeEconomica = LerCampo(dadosRetorno, "ATIVIDADE PRINCIPAL"); 157 | result.DataAbertura = LerCampo(dadosRetorno, "DATA DESSA SITUAÇÃO CADASTRAL").ToData(); 158 | result.Situacao = LerCampo(dadosRetorno, "SITUAÇÃO CADASTRAL"); 159 | result.DataSituacao = LerCampo(dadosRetorno, "DATA DESSA SITUAÇÃO CADASTRAL").ToData(); 160 | result.RegimeApuracao = LerCampo(dadosRetorno, "REGIME DE APURAÇÃO"); 161 | result.DataEmitenteNFe = LerCampo(dadosRetorno, "Emitente de NFe desde:").ToData(); 162 | } 163 | catch (Exception exception) 164 | { 165 | throw new ACBrException(exception, "Erro ao processar retorno."); 166 | } 167 | 168 | return result; 169 | } 170 | 171 | /// 172 | /// Efetua a pesquisa na Lista de Retorno 173 | /// 174 | /// Lista a ser Pesquisa tipo Ilist 175 | /// String a ser pesquisada. 176 | /// 177 | private static string LerCampo(IList retorno, string campo) 178 | { 179 | var ret = string.Empty; 180 | var log = string.Empty; 181 | for (var i = 0; i < retorno.Count; i++) 182 | { 183 | var linha = retorno[i].Trim(); 184 | if (linha != campo) continue; 185 | 186 | if (campo == "ATIVIDADE PRINCIPAL") 187 | { 188 | ret = retorno[i + 1].Trim().Replace(" ", string.Empty); 189 | log = retorno[i + 2].Trim().Replace(" ", string.Empty); 190 | ret = ret + " " + log; 191 | break; 192 | } 193 | ret = retorno[i + 1].Trim().Replace(" ", string.Empty); 194 | retorno.RemoveAt(i); 195 | break; 196 | } 197 | 198 | return ret; 199 | } 200 | 201 | private static List GetContents(string input, string pattern) 202 | 203 | { 204 | var matches = Regex.Matches(input, pattern, RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); 205 | return (from Match match in matches select match.Value).ToList(); 206 | } 207 | 208 | #endregion Private Methods 209 | 210 | #endregion Methods 211 | } 212 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraES.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraES.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraGO.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : Regis Araujo 4 | // Created : 05-04-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 05-08-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using ACBr.Net.Core; 33 | using ACBr.Net.Core.Exceptions; 34 | using ACBr.Net.Core.Extensions; 35 | using System; 36 | using System.Collections.Generic; 37 | using System.Drawing; 38 | using System.Linq; 39 | using System.Net; 40 | using System.Text; 41 | using System.Text.RegularExpressions; 42 | 43 | namespace ACBr.Net.Consulta.Sintegra 44 | { 45 | internal class ConsultaSintegraGO : ConsultaSintegraBase 46 | { 47 | #region Fields 48 | 49 | private const string URL_CONSULTA = @"http://appasp.sefaz.go.gov.br/Sintegra/Consulta/consultar.asp"; 50 | 51 | #endregion Fields 52 | 53 | #region Constructors 54 | 55 | public ConsultaSintegraGO() 56 | { 57 | HasCaptcha = false; 58 | } 59 | 60 | #endregion Constructors 61 | 62 | #region Methods 63 | 64 | public override Image GetCaptcha() 65 | { 66 | return null; 67 | } 68 | 69 | public override ACBrEmpresa Consulta(string cnpj, string ie, string captcha) 70 | { 71 | var request = GetClient(URL_CONSULTA); 72 | 73 | var postData = new Dictionary(); 74 | if (cnpj.IsEmpty()) 75 | { 76 | postData.Add("rTipoDoc", "1"); 77 | postData.Add("tDoc", ie.Replace(",", ".")); 78 | postData.Add("tCCE", ie.Replace(",", ".")); 79 | postData.Add("tCNPJ", "&tCPF=&btCGC=Consultar&zion.SystemAction=consultarSintegra%28%29&zion.OnSubmited=&zion.FormElementPosted=zionFormID_1&zionPostMethod=&zionRichValidator=true"); 80 | } 81 | else 82 | { 83 | postData.Add("rTipoDoc", "2"); 84 | postData.Add("tDoc=", cnpj.Replace(",", ".")); 85 | postData.Add("tCCE=&tCNPJ", cnpj.Replace(",", ".")); 86 | postData.Add("tCPF", "&btCGC=Consultar&zion.SystemAction=consultarSintegra%28%29&zion.OnSubmited=&zion.FormElementPosted=zionFormID_1&zionPostMethod=&zionRichValidator=true"); 87 | } 88 | 89 | var retorno = request.SendPost(postData); 90 | 91 | Guard.Against(retorno.Contains("Nenhum resultado encontrado"), $"Não existe no Cadastro do sintegra o número de CNPJ/IE informado.{Environment.NewLine}Verifique se o mesmo foi digitado corretamente."); 92 | Guard.Against(retorno.Contains("a. No momento não podemos atender a sua solicitação. Por favor tente mais tarde."), "Erro no site do sintegra. Tente mais tarde."); 93 | Guard.Against(retorno.Contains("Atenção"), "Erro ao fazer a consulta"); 94 | 95 | return ProcessResponse(retorno); 96 | } 97 | 98 | #region Private Methods 99 | 100 | private static List GetContents(string entrada, string regex) 101 | { 102 | var padrao = Regex.Matches(entrada, regex, RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); 103 | return (from Match match in padrao select match.Value).ToList(); 104 | } 105 | 106 | private static List ProcessTableHtml(string retorno) 107 | { 108 | const string tableExpression = "(.*?)"; 109 | const string trPattern = ""; 110 | const string tdPattern = "(.*?)"; 111 | var dadosRetorno = new List(); 112 | var tableContents = GetContents(retorno, tableExpression); 113 | foreach (var tableContent in tableContents) 114 | { 115 | var trContents = GetContents(tableContent, trPattern); 116 | foreach (var trContent in trContents) 117 | { 118 | var tdContents = GetContents(trContent, tdPattern); 119 | foreach (var item in tdContents) 120 | { 121 | dadosRetorno.AddText(WebUtility.HtmlDecode(item.StripHtml().Replace(" ", string.Empty)).Trim()); 122 | dadosRetorno.RemoveEmptyLines(); 123 | } 124 | } 125 | } 126 | return dadosRetorno; 127 | } 128 | 129 | /// 130 | /// Processa o retorno html e retorno o objeto tipo ACBrEmpresa com dados 131 | /// 132 | /// 133 | /// objeto tipo ACBrEmpresa 134 | private static ACBrEmpresa ProcessResponse(string retorno) 135 | { 136 | var result = new ACBrEmpresa(); 137 | var dadosRetorno = ProcessTableHtml(retorno); 138 | try 139 | { 140 | result.CNPJ = LerCampo(dadosRetorno, "CNPJ:"); 141 | result.InscricaoEstadual = LerCampo(dadosRetorno, "Inscrição Estadual - CCE :"); 142 | result.RazaoSocial = LerCampo(dadosRetorno, "Nome Empresarial:"); 143 | result.Logradouro = LerCampo(dadosRetorno, "Logradouro:"); 144 | result.Numero = LerCampo(dadosRetorno, "Número:"); 145 | result.Complemento = LerCampo(dadosRetorno, "Complemento:"); 146 | 147 | var dadosRetorno2 = new List(); 148 | dadosRetorno2.AddText(WebUtility.HtmlDecode(retorno.StripHtml().Replace(" ", Environment.NewLine)).Trim()); 149 | dadosRetorno2.RemoveEmptyLines(); 150 | result.Bairro = LerCampo(dadosRetorno2, "Bairro:"); 151 | dadosRetorno2 = null; 152 | 153 | result.Municipio = LerCampo(dadosRetorno, "Município:"); 154 | result.UF = (ConsultaUF)Enum.Parse(typeof(ConsultaUF), LerCampo(dadosRetorno, "UF:").ToUpper()); 155 | result.CEP = LerCampo(dadosRetorno, "CEP:").FormataCEP(); 156 | result.Telefone = LerCampo(dadosRetorno, "Telefone:"); 157 | result.AtividadeEconomica = LerCampo(dadosRetorno, "Atividade Principal"); 158 | result.DataAbertura = LerCampo(dadosRetorno, "Data de Cadastramento:").ToData(); 159 | result.Situacao = LerCampo(dadosRetorno, "Situação Cadastral Vigente:"); 160 | result.DataSituacao = LerCampo(dadosRetorno, "Data desta Situação Cadastral:").ToData(); 161 | result.RegimeApuracao = LerCampo(dadosRetorno, "Regime de Apuração:"); 162 | result.DataEmitenteNFe = LerCampo(dadosRetorno, "Emitente de NFe desde:").ToData(); 163 | } 164 | catch (Exception exception) 165 | { 166 | throw new ACBrException(exception, "Erro ao processar retorno."); 167 | } 168 | 169 | return result; 170 | } 171 | 172 | private static string LerCampo(IList retorno, string campo) 173 | { 174 | var ret = string.Empty; 175 | var log = string.Empty; 176 | for (var i = 0; i < retorno.Count; i++) 177 | { 178 | var linha = retorno[i].Trim(); 179 | if (linha != campo) continue; 180 | 181 | ret = retorno[i + 1].Trim().Replace(" ", string.Empty); 182 | retorno.RemoveAt(i); 183 | break; 184 | } 185 | 186 | return ret; 187 | } 188 | 189 | #endregion Private Methods 190 | 191 | #endregion Methods 192 | } 193 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraMS.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraMS.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraMT.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraMT.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraPI.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraPI.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraSP.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACBrNet/ACBr.Net.Consulta/eb2962703b0d1f00777487efb435c570dc833809/src/ACBr.Net.Consulta/Sintegra/ConsultaSintegraSP.cs -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/Sintegra/IConsultaSintegra.cs: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // Assembly : ACBr.Net.Consulta 3 | // Author : RFTD 4 | // Created : 02-20-2017 5 | // 6 | // Last Modified By : RFTD 7 | // Last Modified On : 02-20-2017 8 | // *********************************************************************** 9 | // 10 | // The MIT License (MIT) 11 | // Copyright (c) 2014 - 2017 Grupo ACBr.Net 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining 14 | // a copy of this software and associated documentation files (the "Software"), 15 | // to deal in the Software without restriction, including without limitation 16 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | // and/or sell copies of the Software, and to permit persons to whom the 18 | // Software is furnished to do so, subject to the following conditions: 19 | // The above copyright notice and this permission notice shall be 20 | // included in all copies or substantial portions of the Software. 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | // DEALINGS IN THE SOFTWARE. 28 | // 29 | // 30 | // *********************************************************************** 31 | 32 | using System.Drawing; 33 | 34 | namespace ACBr.Net.Consulta.Sintegra 35 | { 36 | internal interface IConsultaSintegra 37 | { 38 | #region Properties 39 | 40 | bool HasCaptcha { get; } 41 | 42 | #endregion Properties 43 | 44 | #region Methods 45 | 46 | Image GetCaptcha(); 47 | 48 | ACBrEmpresa Consulta(string cnpj, string ie, string captcha); 49 | 50 | #endregion Methods 51 | } 52 | } -------------------------------------------------------------------------------- /src/ACBr.Net.Consulta/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------