Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions Application/Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=6.2.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.6.2.2\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="EntityFramework" Version="6.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Owin" Version="1.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Web" />
</ItemGroup>
Expand All @@ -48,7 +48,6 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Domain\Domain.csproj">
Expand Down
7 changes: 0 additions & 7 deletions Application/packages.config

This file was deleted.

9 changes: 9 additions & 0 deletions Data/BaseRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Configuration;

namespace Data
{
public abstract class BaseRepository
{
public string Connstring = ConfigurationManager.ConnectionStrings["SqlServerConnString"].ConnectionString;
}
}
16 changes: 16 additions & 0 deletions Data/Dapper/INotaFiscalRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Domain.Entities;
using System.Collections.Generic;

namespace Data.Dapper
{
public interface INotaFiscalRepository
{
List<NotaFiscal> RetornaListaNotas();

bool InsereNotaFiscal(NotaFiscal notaFiscal);

bool AtualizaNotaFiscal(NotaFiscal notaFiscal);

bool ExcluiNotaFiscal(NotaFiscal notaFiscal);
}
}
58 changes: 58 additions & 0 deletions Data/Dapper/NotaFiscalRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using Dapper;
using Domain.Entities;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;

namespace Data.Dapper
{
public class NotaFiscalRepository : BaseRepository, INotaFiscalRepository
{
public List<NotaFiscal> RetornaListaNotas()
{
List<NotaFiscal> ret;
using (var db = new SqlConnection(Connstring))
{
const string sql = @"SELECT notaFiscalId, numeroNf, valorTotal, dataNf, cnpjEmissorNf, cnpjDestinatarioNf from NotaFiscal";

ret = db.Query<NotaFiscal>(sql, commandType: CommandType.Text).ToList();
}

return ret;
}

public bool InsereNotaFiscal(NotaFiscal notaFiscal)
{
using (var db = new SqlConnection(Connstring))
{
const string sql = @"INSERT INTO NotaFiscal (numeroNf, valorTotal, dataNf, cnpjEmissorNf, cnpjDestinatarioNf) VALUES (@numeroNf, @valorTotal, @dataNf, @cnpjEmissorNf, @cnpjDestinatarioNf) ";

db.Execute(sql, new { notaFiscal.numeroNf, notaFiscal.valorTotal, notaFiscal.dataNf, notaFiscal.cnpjEmissorNf, notaFiscal.cnpjDestinatarioNf }, commandType: CommandType.Text);
}
return true;
}

public bool AtualizaNotaFiscal(NotaFiscal notaFiscal)
{
using (var db = new SqlConnection(Connstring))
{
const string sql = @"UPDATE NotaFiscal SET numeroNf = @numeroNf, valorTotal = @valorTotal, dataNf = @dataNf, cnpjEmissorNf = @cnpjEmissorNf, cnpjDestinatarioNf = @cnpjDestinatarioNf WHERE notaFiscalId = @notaFiscalId";

db.Execute(sql, new { notaFiscal.notaFiscalId, notaFiscal.numeroNf, notaFiscal.valorTotal, notaFiscal.dataNf, notaFiscal.cnpjEmissorNf, notaFiscal.cnpjDestinatarioNf }, commandType: CommandType.Text);
}
return true;
}

public bool ExcluiNotaFiscal(NotaFiscal notaFiscal)
{
using (var db = new SqlConnection(Connstring))
{
const string sql = @"DELETE FROM NotaFiscal WHERE notaFiscalId = @notaFiscalId";

db.Execute(sql, new { notaFiscal.notaFiscalId }, commandType: CommandType.Text);
}
return true;
}
}
}
22 changes: 12 additions & 10 deletions Data/Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Dapper" Version="1.50.4" />
<PackageReference Include="EntityFramework" Version="6.2.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseRepository.cs" />
<Compile Include="Context\SystemContext.cs" />
<Compile Include="Dapper\INotaFiscalRepository.cs" />
<Compile Include="Dapper\NotaFiscalRepository.cs" />
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand All @@ -41,24 +49,18 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=6.2.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.6.2.2\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Context\UnitOfWork\" />
Expand Down
5 changes: 0 additions & 5 deletions Data/packages.config

This file was deleted.

22 changes: 6 additions & 16 deletions DevpartnerHelper/DevpartnerHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=6.2.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.6.2.2\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
</Reference>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="EntityFramework" Version="6.2.0" />
<PackageReference Include="Microsoft.AspNet.Identity.Core" Version="2.2.1" />
<PackageReference Include="Microsoft.AspNet.Identity.EntityFramework" Version="2.2.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
Expand All @@ -64,7 +55,6 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
7 changes: 0 additions & 7 deletions DevpartnerHelper/packages.config

This file was deleted.

16 changes: 5 additions & 11 deletions Domain/Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=6.2.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.6.2.2\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="EntityFramework" Version="6.2.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
Expand All @@ -52,18 +47,17 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Entities\NotaFiscal.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Entities\" />
<Folder Include="Enum\" />
<Folder Include="Interfaces\Repository\" />
<Folder Include="Interfaces\Services\" />
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mapeamento\Mapeamento.csproj">
Expand Down
22 changes: 22 additions & 0 deletions Domain/Entities/NotaFiscal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace Domain.Entities
{
public class NotaFiscal
{
public int notaFiscalId { get; set; }

[MaxLength(20)]
public string numeroNf { get; set; }

public double valorTotal { get; set; }
public DateTime dataNf { get; set; }

[MaxLength(20)]
public string cnpjEmissorNf { get; set; }

[MaxLength(20)]
public string cnpjDestinatarioNf { get; set; }
}
}
5 changes: 0 additions & 5 deletions Domain/packages.config

This file was deleted.

18 changes: 5 additions & 13 deletions IoC/IoC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="EntityFramework" Version="6.2.0" />
<PackageReference Include="SimpleInjector" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="BootStrapper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand All @@ -48,26 +53,13 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=6.2.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.6.2.2\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="SimpleInjector, Version=4.1.0.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleInjector.4.1.0\lib\net45\SimpleInjector.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Runtime.Serialization" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
6 changes: 0 additions & 6 deletions IoC/packages.config

This file was deleted.

Loading