├── .gitignore ├── .vs └── config │ └── applicationhost.config ├── ProjetoDDD.Domain ├── 2.1 - ProjetoDDD.Domain.csproj ├── Entities │ ├── ModulosAcesso.cs │ ├── PerfilUsuario.cs │ └── Usuario.cs ├── Interfaces │ ├── Domain │ │ └── IServicoDeUsuarioDomain.cs │ ├── Infrastructure │ │ ├── IGerenciadorDeRepositorio.cs │ │ └── IUnidadeDeTrabalho.cs │ └── Repositories │ │ ├── IRepositorioBase.cs │ │ ├── IRepositorioDePerfilDeUsuario.cs │ │ └── IRepositorioDeUsuarios.cs ├── Properties │ └── AssemblyInfo.cs ├── Services │ ├── ServicoDeDominioBase.cs │ └── ServicoDeUsuarioDomain.cs └── packages.config ├── ProjetoDDD.Infrastructure.Data ├── 3.1 - ProjetoDDD.Infrastructure.Data.csproj ├── App.config ├── Confinguration │ ├── ConfiguracoesEF.cs │ ├── GerenciadorDeRepositorio.cs │ └── UnidadeDeTrabalhoEF.cs ├── Context │ └── ContextoBanco.cs ├── Initializer │ └── UserDatabaseInitializer.cs ├── Migrations │ └── Configuration.cs ├── Properties │ └── AssemblyInfo.cs ├── Repositories │ ├── RepositorioBase.cs │ ├── RepositorioDePerfilDeUsuario.cs │ └── RepositorioDeUsuarios.cs ├── Security.zip ├── Security │ ├── Constants.cs │ └── Crypto.cs └── packages.config ├── ProjetoDDD.Infrastructure.IoC ├── 3.2 - ProjetoDDD.Infrastructure.IoC.csproj ├── Bindings.cs ├── Properties │ └── AssemblyInfo.cs ├── app.config └── packages.config ├── ProjetoDDD.UI.Web ├── 0.1 - ProjetoDDD.UI.Web.csproj ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ ├── RouteConfig.cs │ └── SimpleInjectorInitializer.cs ├── ApplicationInsights.config ├── Content │ ├── Site.css │ ├── bootstrap.css │ └── bootstrap.min.css ├── Controllers │ ├── AccountController.cs │ └── HomeController.cs ├── Global.asax ├── Global.asax.cs ├── Project_Readme.html ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ ├── _references.js │ ├── ai.0.15.0-build58334.js │ ├── ai.0.15.0-build58334.min.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.10.2.intellisense.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-2.6.2.js │ ├── respond.js │ └── respond.min.js ├── Util │ ├── Functions.cs │ └── SessionManager.cs ├── ViewModels │ ├── LoginViewModel.cs │ └── RegisterViewModel.cs ├── Views │ ├── Account │ │ ├── Login.cshtml │ │ └── Register.cshtml │ ├── Home │ │ ├── About.cshtml │ │ ├── Contact.cshtml │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff └── packages.config ├── ProjetoDDD.sln └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | [Oo]bj/ 4 | [Bb]in/ 5 | *.user 6 | /TestResults 7 | *.vspscc 8 | *.vssscc 9 | deploy 10 | deploy/* 11 | *.suo 12 | *.cache 13 | packages/ -------------------------------------------------------------------------------- /ProjetoDDD.Domain/2.1 - ProjetoDDD.Domain.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {9D5FA0CE-2FA8-4BC7-B372-15C362C2D6D4} 8 | Library 9 | Properties 10 | ProjetoDDD.Domain 11 | ProjetoDDD.Domain 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll 35 | True 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Entities/ModulosAcesso.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ProjetoDDD.Domain.Entities 5 | { 6 | public partial class ModulosAcesso 7 | { 8 | public ModulosAcesso() 9 | { 10 | this.PerfisUsuario = new List(); 11 | } 12 | public int IdModulo { get; set; } 13 | public string NomeModulo { get; set; } 14 | public string NomeMenuAcesso { get; set; } 15 | public string UrlMenu { get; set; } 16 | public bool FlAtivo { get; set; } 17 | public DateTime DataCadastro { get; set; } 18 | public int? IdModuloPai { get; set; } 19 | public virtual ModulosAcesso ModulosAcessos { get; set; } 20 | public virtual ICollection PerfisUsuario { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Entities/PerfilUsuario.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ProjetoDDD.Domain.Entities 8 | { 9 | public partial class PerfilUsuario 10 | { 11 | public PerfilUsuario() 12 | { 13 | this.Usuarios = new List(); 14 | this.ModulosAcesso = new List(); 15 | } 16 | public int IdPerfilUsuario { get; set; } 17 | public string NomPerfil { get; set; } 18 | public DateTime DataCadastro { get; set; } 19 | public bool FlAdminMaster { get; set; } 20 | public bool FlAtivo { get; set; } 21 | public virtual ICollection Usuarios { get; set; } 22 | public virtual ICollection ModulosAcesso { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Entities/Usuario.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ProjetoDDD.Domain.Entities 8 | { 9 | public partial class Usuario 10 | { 11 | public int IdUsuario { get; set; } 12 | public int IdPerfilUsuario { get; set; } 13 | public string Nome { get; set; } 14 | public string Email { get; set; } 15 | public string Senha { get; set; } 16 | public string SenhaKey { get; set; } 17 | public DateTime DataCadastro { get; set; } 18 | public virtual PerfilUsuario PerfilUsuario { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Interfaces/Domain/IServicoDeUsuarioDomain.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ProjetoDDD.Domain.Interfaces.Domain 9 | { 10 | public interface IServicoDeUsuarioDomain 11 | { 12 | Usuario LogaUsuario(string email, string senha); 13 | Usuario RecuperaUsuarioPorEmail(string email); 14 | List RecuperaUsuariosDoPerfil(int idPerfilUsuario); 15 | List RecuperaTodosPerfisAtivos(); 16 | void CadastraUsuario(Usuario usuario); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Interfaces/Infrastructure/IGerenciadorDeRepositorio.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ProjetoDDD.Domain.Interfaces.Infrastructure 8 | { 9 | public interface IGerenciadorDeRepositorio 10 | { 11 | void Finalizar(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Interfaces/Infrastructure/IUnidadeDeTrabalho.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ProjetoDDD.Domain.Interfaces.Infrastructure 8 | { 9 | public interface IUnidadeDeTrabalho 10 | { 11 | void Iniciar(); 12 | void Persistir(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Interfaces/Repositories/IRepositorioBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ProjetoDDD.Domain.Interfaces.Repositories 8 | { 9 | public interface IRepositorioBase where TEntidade : class 10 | { 11 | IList RecuperarTodos(); 12 | TEntidade RecuperarPorID(int id); 13 | void Inserir(TEntidade obj); 14 | void Alterar(TEntidade obj); 15 | void Remover(TEntidade obj); 16 | void Remover(int id); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Interfaces/Repositories/IRepositorioDePerfilDeUsuario.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using System.Collections.Generic; 3 | 4 | namespace ProjetoDDD.Domain.Interfaces.Repositories 5 | { 6 | public interface IRepositorioDePerfilDeUsuario : IRepositorioBase 7 | { 8 | List RetornaUsuariosDoPerfil(int idPerfilUsuario); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Interfaces/Repositories/IRepositorioDeUsuarios.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ProjetoDDD.Domain.Interfaces.Repositories 9 | { 10 | public interface IRepositorioDeUsuarios : IRepositorioBase 11 | { 12 | Usuario RecuperarUsuarioPorEmail(string email); 13 | Usuario LogaUsuario(string email, string senha); 14 | Usuario CadastraUsuario(Usuario user); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ProjetoDDD.Domain")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ProjetoDDD.Domain")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9d5fa0ce-2fa8-4bc7-b372-15c362c2d6d4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Services/ServicoDeDominioBase.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Practices.ServiceLocation; 2 | using ProjetoDDD.Domain.Interfaces.Infrastructure; 3 | 4 | namespace ProjetoDDD.Domain.Services 5 | { 6 | public class ServicoDeDominioBase 7 | { 8 | private IUnidadeDeTrabalho _unidadeDeTrabalho; 9 | 10 | public virtual void IniciarTransação() 11 | { 12 | _unidadeDeTrabalho = ServiceLocator.Current.GetInstance(); 13 | _unidadeDeTrabalho.Iniciar(); 14 | } 15 | 16 | public virtual void PersistirTransação() 17 | { 18 | _unidadeDeTrabalho.Persistir(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/Services/ServicoDeUsuarioDomain.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using ProjetoDDD.Domain.Interfaces.Domain; 3 | using ProjetoDDD.Domain.Interfaces.Repositories; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | 8 | namespace ProjetoDDD.Domain.Services 9 | { 10 | public class ServicoDeUsuarioDomain : ServicoDeDominioBase, IServicoDeUsuarioDomain 11 | { 12 | private readonly IRepositorioDeUsuarios _repositorioUsuario; 13 | private readonly IRepositorioDePerfilDeUsuario _repositorioPerfil; 14 | 15 | public ServicoDeUsuarioDomain(IRepositorioDeUsuarios repositorioUsuario, IRepositorioDePerfilDeUsuario repositorioPerfil) 16 | { 17 | _repositorioUsuario = repositorioUsuario; 18 | _repositorioPerfil = repositorioPerfil; 19 | } 20 | 21 | public Usuario LogaUsuario(string email, string senha) 22 | { 23 | var usuarioRetorno = _repositorioUsuario.LogaUsuario(email, senha); 24 | return usuarioRetorno; 25 | } 26 | 27 | public Usuario RecuperaUsuarioPorEmail(string email) 28 | { 29 | var usuarioRetorno = _repositorioUsuario.RecuperarUsuarioPorEmail(email); 30 | return usuarioRetorno; 31 | } 32 | 33 | public List RecuperaUsuariosDoPerfil(int idPerfilUsuario) 34 | { 35 | var usuariosDoPerfil = _repositorioPerfil.RetornaUsuariosDoPerfil(idPerfilUsuario); 36 | return usuariosDoPerfil; 37 | } 38 | 39 | public List RecuperaTodosPerfisAtivos() 40 | { 41 | return _repositorioPerfil.RecuperarTodos().Where(x => x.FlAtivo && !x.FlAdminMaster).ToList(); 42 | } 43 | 44 | public void CadastraUsuario(Usuario usuario) 45 | { 46 | try 47 | { 48 | IniciarTransação(); 49 | _repositorioUsuario.CadastraUsuario(usuario); 50 | PersistirTransação(); 51 | } 52 | catch (Exception ex) 53 | { 54 | throw new ApplicationException(ex.Message); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ProjetoDDD.Domain/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/3.1 - ProjetoDDD.Infrastructure.Data.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7BFBE834-5008-4913-9DC5-718368ACFD87} 8 | Library 9 | Properties 10 | ProjetoDDD.Infrastructure.Data 11 | ProjetoDDD.Infrastructure.Data 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 35 | True 36 | 37 | 38 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 39 | True 40 | 41 | 42 | ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll 43 | True 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | {9d5fa0ce-2fa8-4bc7-b372-15c362c2d6d4} 77 | 2.1 - ProjetoDDD.Domain 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 92 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Confinguration/ConfiguracoesEF.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using System.Data.Entity.Infrastructure.Annotations; 6 | using System.Data.Entity.ModelConfiguration; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ProjetoDDD.Infrastructure.Data.Confinguration 12 | { 13 | public class ModulosAcessoMap : EntityTypeConfiguration 14 | { 15 | public ModulosAcessoMap() 16 | { 17 | this.HasKey(t => t.IdModulo); 18 | 19 | this.Property(t => t.NomeModulo) 20 | .IsRequired() 21 | .HasMaxLength(200); 22 | 23 | this.Property(t => t.NomeMenuAcesso) 24 | .IsRequired() 25 | .HasMaxLength(200); 26 | 27 | this.Property(t => t.UrlMenu) 28 | .IsRequired() 29 | .HasMaxLength(300); 30 | 31 | this.ToTable("ModulosAcesso", "dbo"); 32 | 33 | this.HasMany(t => t.PerfisUsuario) 34 | .WithMany(t => t.ModulosAcesso) 35 | .Map(m => 36 | { 37 | m.ToTable("PerfilModulos", "dbo"); 38 | m.MapLeftKey("IdModulo"); 39 | m.MapRightKey("IdPerfilUsuario"); 40 | } 41 | ); 42 | } 43 | } 44 | 45 | public class PerfilUsuarioMap : EntityTypeConfiguration 46 | { 47 | public PerfilUsuarioMap() 48 | { 49 | this.HasKey(t => t.IdPerfilUsuario); 50 | 51 | this.Property(t => t.NomPerfil) 52 | .IsRequired() 53 | .HasMaxLength(200); 54 | 55 | this.ToTable("PerfilUsuario", "dbo"); 56 | } 57 | } 58 | 59 | public class UsuarioMap : EntityTypeConfiguration 60 | { 61 | public UsuarioMap() 62 | { 63 | this.HasKey(t => t.IdUsuario); 64 | 65 | this.Property(t => t.Nome) 66 | .IsRequired() 67 | .HasMaxLength(200); 68 | 69 | this.Property(t => t.Email) 70 | .IsRequired() 71 | .HasMaxLength(200) 72 | .HasColumnAnnotation( 73 | IndexAnnotation.AnnotationName, 74 | new IndexAnnotation( 75 | new IndexAttribute("IX_LoginNameUser", 1) { IsUnique = true })); 76 | 77 | this.Property(t => t.Senha) 78 | .IsRequired() 79 | .HasMaxLength(2048); 80 | 81 | this.Property(t => t.DataCadastro).HasColumnType("datetime2"); 82 | 83 | this.HasRequired(t => t.PerfilUsuario) 84 | .WithMany(t => t.Usuarios) 85 | .HasForeignKey(d => d.IdPerfilUsuario); 86 | 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Confinguration/GerenciadorDeRepositorio.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Interfaces.Infrastructure; 2 | using ProjetoDDD.Infrastructure.Data.Context; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Web; 9 | 10 | namespace ProjetoDDD.Infrastructure.Data.Confinguration 11 | { 12 | public class GerenciadorDeRepositorio : IGerenciadorDeRepositorio 13 | { 14 | public const string ContextoHttp = "ContextoHttp"; 15 | 16 | public ContextoBanco Contexto 17 | { 18 | get 19 | { 20 | if (HttpContext.Current.Items[ContextoHttp] == null) 21 | HttpContext.Current.Items[ContextoHttp] = new ContextoBanco(); 22 | return HttpContext.Current.Items[ContextoHttp] as ContextoBanco; 23 | } 24 | } 25 | 26 | public void Finalizar() 27 | { 28 | if (HttpContext.Current.Items[ContextoHttp] != null) 29 | (HttpContext.Current.Items[ContextoHttp] as ContextoBanco).Dispose(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Confinguration/UnidadeDeTrabalhoEF.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Practices.ServiceLocation; 2 | using ProjetoDDD.Domain.Interfaces.Infrastructure; 3 | using ProjetoDDD.Infrastructure.Data.Context; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ProjetoDDD.Infrastructure.Data.Confinguration 11 | { 12 | public class UnidadeDeTrabalhoEF : IUnidadeDeTrabalho 13 | { 14 | private ContextoBanco _contexto; 15 | 16 | public void Iniciar() 17 | { 18 | var gerenciador = ServiceLocator.Current.GetInstance() 19 | as GerenciadorDeRepositorio; 20 | 21 | _contexto = gerenciador.Contexto; 22 | } 23 | 24 | public void Persistir() 25 | { 26 | _contexto.SaveChanges(); 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Context/ContextoBanco.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using ProjetoDDD.Infrastructure.Data.Confinguration; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Data.Entity; 6 | using System.Data.Entity.ModelConfiguration.Conventions; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ProjetoDDD.Infrastructure.Data.Context 12 | { 13 | public class ContextoBanco : DbContext 14 | { 15 | public ContextoBanco() : base("projetoDDDContext") 16 | { 17 | 18 | } 19 | 20 | public DbSet Usuarios { get; set; } 21 | public DbSet PerfilUsuario { get; set; } 22 | public DbSet ModulosAcesso { get; set; } 23 | 24 | protected override void Dispose(bool disposing) 25 | { 26 | base.Dispose(disposing); 27 | } 28 | 29 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 30 | { 31 | modelBuilder.Conventions.Remove(); 32 | modelBuilder.Conventions.Remove(); 33 | modelBuilder.Conventions.Remove(); 34 | 35 | modelBuilder.Properties().Where(p => p.Name == p.ReflectedType.Name + "Id").Configure(p => p.IsKey()); 36 | modelBuilder.Properties().Configure(p => p.HasColumnType("varchar")); 37 | modelBuilder.Properties().Configure(p => p.HasMaxLength(100)); 38 | 39 | modelBuilder.Properties().Where(p => p.Name.Contains("Descricao")).Configure(p => p.HasMaxLength(400)); 40 | modelBuilder.Properties().Where(p => p.Name.Contains("UF")).Configure(p => p.HasMaxLength(2)); 41 | 42 | modelBuilder.Configurations.Add(new ModulosAcessoMap()); 43 | modelBuilder.Configurations.Add(new PerfilUsuarioMap()); 44 | modelBuilder.Configurations.Add(new UsuarioMap()); 45 | 46 | base.OnModelCreating(modelBuilder); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Initializer/UserDatabaseInitializer.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ProjetoDDD.Infrastructure.Data.Initializer 9 | { 10 | public class UserDatabaseInitializer 11 | { 12 | public static List GetModulosAcesso() 13 | { 14 | var modulos = new List 15 | { 16 | new ModulosAcesso 17 | { 18 | IdModulo = 1, 19 | FlAtivo = true, 20 | NomeMenuAcesso = "Administração", 21 | NomeModulo = "Admin", 22 | UrlMenu = "#", 23 | DataCadastro = DateTime.Now 24 | 25 | }, 26 | new ModulosAcesso 27 | { 28 | IdModulo = 2, 29 | FlAtivo = true, 30 | NomeMenuAcesso = "Cadastro", 31 | NomeModulo = "Cadastro", 32 | UrlMenu = "#", 33 | DataCadastro = DateTime.Now, 34 | IdModuloPai = 1 35 | }, 36 | new ModulosAcesso 37 | { 38 | IdModulo = 3, 39 | FlAtivo = true, 40 | NomeMenuAcesso = "Perfil de Usuário", 41 | NomeModulo = "Perfil de Usuário", 42 | UrlMenu = "#", 43 | DataCadastro = DateTime.Now, 44 | IdModuloPai = 2 45 | } 46 | }; 47 | 48 | return modulos; 49 | } 50 | public static List GetPerfisUsuarios() 51 | { 52 | var perfisUsuario = new List 53 | { 54 | new PerfilUsuario 55 | { 56 | IdPerfilUsuario = 1, 57 | DataCadastro = DateTime.Now, 58 | FlAdminMaster =true, 59 | FlAtivo = true, 60 | NomPerfil = "Administrador Master", 61 | ModulosAcesso = GetModulosAcesso() 62 | } 63 | }; 64 | return perfisUsuario; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Migrations/Configuration.cs: -------------------------------------------------------------------------------- 1 | namespace ProjetoDDD.Infrastructure.Data.Migrations 2 | { 3 | using Initializer; 4 | using System; 5 | using System.Data.Entity.Migrations; 6 | using System.IO; 7 | using System.Linq; 8 | internal sealed class Configuration : DbMigrationsConfiguration 9 | { 10 | public Configuration() 11 | { 12 | AutomaticMigrationsEnabled = true; 13 | } 14 | 15 | protected override void Seed(Context.ContextoBanco context) 16 | { 17 | if (context.PerfilUsuario.Where(x => x.NomPerfil == "Administrador Master").Count() == 0) 18 | UserDatabaseInitializer.GetPerfisUsuarios().ForEach(c => context.PerfilUsuario.Add(c)); 19 | 20 | // Delete all stored procs, views 21 | foreach (var file in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.Replace("bin\\Debug", ""), "Sql\\Seed"), "*.sql")) 22 | { 23 | context.Database.ExecuteSqlCommand(File.ReadAllText(file), new object[0]); 24 | } 25 | 26 | // Add Stored Procedures 27 | foreach (var file in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.Replace("bin\\Debug", ""), "Sql\\StoredProcs"), "*.sql")) 28 | { 29 | context.Database.ExecuteSqlCommand(File.ReadAllText(file), new object[0]); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ProjetoDDD.Infrastructure.Data")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ProjetoDDD.Infrastructure.Data")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7bfbe834-5008-4913-9dc5-718368acfd87")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Repositories/RepositorioBase.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Practices.ServiceLocation; 2 | using ProjetoDDD.Domain.Interfaces.Infrastructure; 3 | using ProjetoDDD.Domain.Interfaces.Repositories; 4 | using ProjetoDDD.Infrastructure.Data.Confinguration; 5 | using ProjetoDDD.Infrastructure.Data.Context; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Data.Entity; 12 | 13 | namespace ProjetoDDD.Infrastructure.Data.Repositories 14 | { 15 | public class RepositorioBase : IRepositorioBase where TEntidade : class 16 | { 17 | protected readonly ContextoBanco _contexto; 18 | 19 | public RepositorioBase() 20 | { 21 | var gerenciador = (GerenciadorDeRepositorio)ServiceLocator.Current.GetInstance(); 22 | _contexto = gerenciador.Contexto; 23 | } 24 | 25 | public void Alterar(TEntidade obj) 26 | { 27 | _contexto.Entry(obj).State = EntityState.Modified; 28 | } 29 | 30 | public void Inserir(TEntidade obj) 31 | { 32 | _contexto.Set().Add(obj); 33 | } 34 | 35 | public TEntidade RecuperarPorID(int id) 36 | { 37 | return _contexto.Set().Find(id); 38 | } 39 | 40 | public IList RecuperarTodos() 41 | { 42 | return _contexto.Set().ToList(); 43 | } 44 | 45 | public void Remover(int id) 46 | { 47 | TEntidade obj = RecuperarPorID(id); 48 | Remover(obj); 49 | } 50 | 51 | public void Remover(TEntidade obj) 52 | { 53 | _contexto.Set().Remove(obj); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Repositories/RepositorioDePerfilDeUsuario.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ProjetoDDD.Domain.Entities; 4 | using ProjetoDDD.Domain.Interfaces.Repositories; 5 | using System.Linq; 6 | 7 | namespace ProjetoDDD.Infrastructure.Data.Repositories 8 | { 9 | public class RepositorioDePerfilDeUsuario : RepositorioBase, IRepositorioDePerfilDeUsuario 10 | { 11 | public List RetornaUsuariosDoPerfil(int idPerfilUsuario) 12 | { 13 | var perfil = _contexto.PerfilUsuario.Where(x => x.IdPerfilUsuario == idPerfilUsuario).FirstOrDefault(); 14 | return perfil.Usuarios.ToList(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Repositories/RepositorioDeUsuarios.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using ProjetoDDD.Domain.Interfaces.Repositories; 3 | using ProjetoDDD.Infrastructure.Data.Security; 4 | using System.Linq; 5 | using System; 6 | 7 | namespace ProjetoDDD.Infrastructure.Data.Repositories 8 | { 9 | public class RepositorioDeUsuarios : RepositorioBase, IRepositorioDeUsuarios 10 | { 11 | public Usuario CadastraUsuario(Usuario user) 12 | { 13 | user.Senha = Crypto.EncryptStringAES(user.Senha, user.SenhaKey); 14 | return _contexto.Usuarios.Add(user); 15 | } 16 | 17 | public Usuario LogaUsuario(string email, string senha) 18 | { 19 | var usuario = _contexto.Usuarios.Where(u => u.Email == email).FirstOrDefault(); 20 | if (usuario == null) 21 | return null; 22 | 23 | string passDecrypt = Crypto.DecryptStringAES(usuario.Senha, usuario.SenhaKey); 24 | 25 | if (passDecrypt == senha) 26 | return usuario; 27 | else return null; 28 | } 29 | 30 | public Usuario RecuperarUsuarioPorEmail(string email) 31 | { 32 | var usuario = _contexto.Usuarios.Where(u => u.Email == email).FirstOrDefault(); 33 | return usuario; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Security.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplificandoNET/ProjetoDDD/9ff331539bb3ca80bd83b4154eb4172770d1178a/ProjetoDDD.Infrastructure.Data/Security.zip -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Security/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace ProjetoDDD.Infrastructure.Data.Security 2 | { 3 | public static class Constants 4 | { 5 | public const string SharedSecret = "*KapirotoXYZ*"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/Security/Crypto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Security.Cryptography; 4 | using System.Text; 5 | 6 | namespace ProjetoDDD.Infrastructure.Data.Security 7 | { 8 | public class Crypto 9 | { 10 | private static byte[] _salt = Encoding.ASCII.GetBytes("o6806642kbM7c5"); 11 | 12 | //private static byte[] _salt = Encoding.ASCII.GetBytes(RandomStringGenerate(10)); 13 | 14 | /// 15 | /// Criptografar a string usando AES. A seqüência pode ser decifrada usando DecryptStringAES (). Os parâmetros SharedSecret devem corresponder. 16 | /// 17 | /// O texto para criptografar. 18 | /// a String Chave para criptografar e decriptografar a string plainText. 19 | public static string EncryptStringAES(string plainText, string sharedSecret) 20 | { 21 | if (string.IsNullOrEmpty(plainText)) 22 | throw new ArgumentNullException("plainText"); 23 | if (string.IsNullOrEmpty(sharedSecret)) 24 | throw new ArgumentNullException("sharedSecret"); 25 | 26 | string outStr = null; // Encrypted string to return 27 | RijndaelManaged aesAlg = null; // RijndaelManaged object used to encrypt the data. 28 | 29 | try 30 | { 31 | // generate the key from the shared secret and the salt 32 | Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(sharedSecret, _salt); 33 | 34 | // Create a RijndaelManaged object 35 | aesAlg = new RijndaelManaged(); 36 | aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8); 37 | 38 | // Create a decrytor to perform the stream transform. 39 | ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV); 40 | 41 | // Create the streams used for encryption. 42 | using (MemoryStream msEncrypt = new MemoryStream()) 43 | { 44 | // prepend the IV 45 | msEncrypt.Write(BitConverter.GetBytes(aesAlg.IV.Length), 0, sizeof(int)); 46 | msEncrypt.Write(aesAlg.IV, 0, aesAlg.IV.Length); 47 | using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)) 48 | { 49 | using (StreamWriter swEncrypt = new StreamWriter(csEncrypt)) 50 | { 51 | //Write all data to the stream. 52 | swEncrypt.Write(plainText); 53 | } 54 | } 55 | outStr = Convert.ToBase64String(msEncrypt.ToArray()); 56 | } 57 | } 58 | finally 59 | { 60 | // Clear the RijndaelManaged object. 61 | if (aesAlg != null) 62 | aesAlg.Clear(); 63 | } 64 | 65 | // Return the encrypted bytes from the memory stream. 66 | return outStr; 67 | } 68 | 69 | /// 70 | /// Decrypt string. Assume que a string foi criptografada usando EncryptStringAES (), usando um SharedSecret idêntico ao usado no Crypt. 71 | /// 72 | /// O texto para criptografar 73 | /// a String Chave para criptografar e decriptografar a string plainText. 74 | public static string DecryptStringAES(string cipherText, string sharedSecret) 75 | { 76 | if (string.IsNullOrEmpty(cipherText)) 77 | throw new ArgumentNullException("cipherText"); 78 | if (string.IsNullOrEmpty(sharedSecret)) 79 | throw new ArgumentNullException("sharedSecret"); 80 | 81 | // Declare the RijndaelManaged object 82 | // used to decrypt the data. 83 | RijndaelManaged aesAlg = null; 84 | 85 | // Declare the string used to hold 86 | // the decrypted text. 87 | string plaintext = null; 88 | 89 | try 90 | { 91 | // generate the key from the shared secret and the salt 92 | Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(sharedSecret, _salt); 93 | 94 | // Create the streams used for decryption. 95 | byte[] bytes = Convert.FromBase64String(cipherText); 96 | using (MemoryStream msDecrypt = new MemoryStream(bytes)) 97 | { 98 | // Create a RijndaelManaged object 99 | // with the specified key and IV. 100 | aesAlg = new RijndaelManaged(); 101 | aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8); 102 | // Get the initialization vector from the encrypted stream 103 | aesAlg.IV = ReadByteArray(msDecrypt); 104 | // Create a decrytor to perform the stream transform. 105 | ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV); 106 | using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)) 107 | { 108 | using (StreamReader srDecrypt = new StreamReader(csDecrypt)) 109 | 110 | // Read the decrypted bytes from the decrypting stream 111 | // and place them in a string. 112 | plaintext = srDecrypt.ReadToEnd(); 113 | } 114 | } 115 | } 116 | finally 117 | { 118 | // Clear the RijndaelManaged object. 119 | if (aesAlg != null) 120 | aesAlg.Clear(); 121 | } 122 | 123 | return plaintext; 124 | } 125 | 126 | private static byte[] ReadByteArray(Stream s) 127 | { 128 | byte[] rawLength = new byte[sizeof(int)]; 129 | if (s.Read(rawLength, 0, rawLength.Length) != rawLength.Length) 130 | { 131 | throw new SystemException("Stream did not contain properly formatted byte array"); 132 | } 133 | 134 | byte[] buffer = new byte[BitConverter.ToInt32(rawLength, 0)]; 135 | if (s.Read(buffer, 0, buffer.Length) != buffer.Length) 136 | { 137 | throw new SystemException("Did not read byte array properly"); 138 | } 139 | 140 | return buffer; 141 | } 142 | 143 | private static Random random = new Random((int)DateTime.Now.Ticks); 144 | private static string RandomStringGenerate(int size) 145 | { 146 | StringBuilder builder = new StringBuilder(); 147 | char ch; 148 | for (int i = 0; i < size; i++) 149 | { 150 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))); 151 | builder.Append(ch); 152 | } 153 | 154 | return builder.ToString(); 155 | } 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.Data/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.IoC/3.2 - ProjetoDDD.Infrastructure.IoC.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2B4192C7-492C-4B26-9C1D-135FA787D90E} 8 | Library 9 | Properties 10 | ProjetoDDD.Infrastructure.IoC 11 | ProjetoDDD.Infrastructure.IoC 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\CommonServiceLocator.SimpleInjectorAdapter.2.8.2\lib\portable-net4+sl4+wp8+win8+wpa81\CommonServiceLocator.SimpleInjectorAdapter.dll 35 | True 36 | 37 | 38 | ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll 39 | True 40 | 41 | 42 | ..\packages\SimpleInjector.3.1.3\lib\net45\SimpleInjector.dll 43 | True 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {9d5fa0ce-2fa8-4bc7-b372-15c362c2d6d4} 61 | 2.1 - ProjetoDDD.Domain 62 | 63 | 64 | {7bfbe834-5008-4913-9dc5-718368acfd87} 65 | 3.1 - ProjetoDDD.Infrastructure.Data 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 80 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.IoC/Bindings.cs: -------------------------------------------------------------------------------- 1 | using CommonServiceLocator.SimpleInjectorAdapter; 2 | using Microsoft.Practices.ServiceLocation; 3 | using ProjetoDDD.Domain.Interfaces.Domain; 4 | using ProjetoDDD.Domain.Interfaces.Infrastructure; 5 | using ProjetoDDD.Domain.Interfaces.Repositories; 6 | using ProjetoDDD.Domain.Services; 7 | using ProjetoDDD.Infrastructure.Data.Confinguration; 8 | using ProjetoDDD.Infrastructure.Data.Repositories; 9 | using SimpleInjector; 10 | 11 | namespace ProjetoDDD.Infrastructure.IoC 12 | { 13 | public class Bindings 14 | { 15 | /// 16 | /// Install-Package SimpleInjector 17 | /// Install-Package CommonServiceLocator -Version 1.3.0 18 | /// Install-Package CommonServiceLocator.SimpleInjectorAdapter 19 | /// 20 | public static void Start(Container container) 21 | { 22 | //Infrastrutura 23 | container.Register(); 24 | container.Register(); 25 | container.Register(typeof(IRepositorioBase<>), typeof(RepositorioBase<>), Lifestyle.Scoped); 26 | container.Register(typeof(IRepositorioDeUsuarios), typeof(RepositorioDeUsuarios), Lifestyle.Scoped); 27 | container.Register(typeof(IRepositorioDePerfilDeUsuario), typeof(RepositorioDePerfilDeUsuario), Lifestyle.Scoped); 28 | 29 | //Dominio 30 | container.Register(typeof(IServicoDeUsuarioDomain), typeof(ServicoDeUsuarioDomain), Lifestyle.Scoped); 31 | 32 | //Aplicacao 33 | //todo 34 | 35 | //Service Locator 36 | ServiceLocator.SetLocatorProvider(() => new SimpleInjectorServiceLocatorAdapter(container)); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.IoC/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ProjetoDDD.Infrastructure.IoC")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ProjetoDDD.Infrastructure.IoC")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2b4192c7-492c-4b26-9c1d-135fa787d90e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.IoC/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ProjetoDDD.Infrastructure.IoC/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/0.1 - ProjetoDDD.UI.Web.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Debug 8 | AnyCPU 9 | 10 | 11 | 2.0 12 | {B6ADAF2A-06AB-408D-B13F-A448B2B13955} 13 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 14 | Library 15 | Properties 16 | ProjetoDDD.UI.Web 17 | ProjetoDDD.UI.Web 18 | v4.5.2 19 | false 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | true 31 | full 32 | false 33 | bin\ 34 | DEBUG;TRACE 35 | prompt 36 | 4 37 | 38 | 39 | pdbonly 40 | true 41 | bin\ 42 | TRACE 43 | prompt 44 | 4 45 | 46 | 47 | 48 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 49 | True 50 | 51 | 52 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 53 | True 54 | 55 | 56 | ..\packages\Microsoft.ApplicationInsights.Agent.Intercept.1.2.0\lib\net45\Microsoft.AI.Agent.Intercept.dll 57 | True 58 | 59 | 60 | ..\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\lib\net45\Microsoft.AI.DependencyCollector.dll 61 | True 62 | 63 | 64 | ..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.1.2.3\lib\net45\Microsoft.AI.PerfCounterCollector.dll 65 | True 66 | 67 | 68 | ..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.1.2.3\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll 69 | True 70 | 71 | 72 | ..\packages\Microsoft.ApplicationInsights.Web.1.2.3\lib\net45\Microsoft.AI.Web.dll 73 | True 74 | 75 | 76 | ..\packages\Microsoft.ApplicationInsights.WindowsServer.1.2.3\lib\net45\Microsoft.AI.WindowsServer.dll 77 | True 78 | 79 | 80 | ..\packages\Microsoft.ApplicationInsights.1.2.3\lib\net45\Microsoft.ApplicationInsights.dll 81 | True 82 | 83 | 84 | ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll 85 | True 86 | 87 | 88 | 89 | ..\packages\SimpleInjector.3.1.3\lib\net45\SimpleInjector.dll 90 | True 91 | 92 | 93 | ..\packages\SimpleInjector.Integration.Web.3.1.3\lib\net40\SimpleInjector.Integration.Web.dll 94 | True 95 | 96 | 97 | ..\packages\SimpleInjector.Integration.Web.Mvc.3.1.3\lib\net40\SimpleInjector.Integration.Web.Mvc.dll 98 | True 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | True 120 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 121 | 122 | 123 | 124 | 125 | 126 | 127 | True 128 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll 129 | 130 | 131 | True 132 | ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll 133 | 134 | 135 | ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll 136 | 137 | 138 | True 139 | ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll 140 | 141 | 142 | True 143 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll 144 | 145 | 146 | True 147 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll 148 | 149 | 150 | True 151 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll 152 | 153 | 154 | ..\packages\WebActivator.1.5.3\lib\net40\WebActivator.dll 155 | True 156 | 157 | 158 | True 159 | ..\packages\WebGrease.1.5.2\lib\WebGrease.dll 160 | 161 | 162 | True 163 | ..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll 164 | 165 | 166 | 167 | 168 | ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | Global.asax 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | PreserveNewest 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | Designer 215 | 216 | 217 | Web.config 218 | 219 | 220 | Web.config 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | {9d5fa0ce-2fa8-4bc7-b372-15c362c2d6d4} 246 | 2.1 - ProjetoDDD.Domain 247 | 248 | 249 | {2b4192c7-492c-4b26-9c1d-135fa787d90e} 250 | 3.2 - ProjetoDDD.Infrastructure.IoC 251 | 252 | 253 | 254 | 10.0 255 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | True 268 | True 269 | 63924 270 | / 271 | http://localhost:63456/ 272 | False 273 | False 274 | 275 | 276 | False 277 | 278 | 279 | 280 | 281 | 282 | 283 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 284 | 285 | 286 | 287 | 288 | 294 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace ProjetoDDD.UI.Web 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/respond.js")); 25 | 26 | bundles.Add(new StyleBundle("~/Content/css").Include( 27 | "~/Content/bootstrap.css", 28 | "~/Content/site.css")); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace ProjetoDDD.UI.Web 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace ProjetoDDD.UI.Web 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/App_Start/SimpleInjectorInitializer.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.UI.Web.App_Start; 2 | using SimpleInjector; 3 | using SimpleInjector.Integration.Web; 4 | using SimpleInjector.Integration.Web.Mvc; 5 | using System.Reflection; 6 | using System.Web.Mvc; 7 | using WebActivator; 8 | 9 | [assembly: PostApplicationStartMethod(typeof(SimpleInjectorInitializer), "Initialize")] 10 | namespace ProjetoDDD.UI.Web.App_Start 11 | { 12 | /// 13 | /// Install-Package SimpleInjector 14 | /// Install-Package SimpleInjector.Integration.Web 15 | /// Install-Package SimpleInjector.Integration.Web.Mvc 16 | /// Install-Package WebActivator -Version 1.5.3 17 | /// 18 | public static class SimpleInjectorInitializer 19 | { 20 | public static void Initialize() 21 | { 22 | var container = new Container(); 23 | container.Options.DefaultScopedLifestyle = new WebRequestLifestyle(); 24 | 25 | // Chamada dos módulos do Simple Injector 26 | InitializeContainer(container); 27 | container.RegisterMvcControllers(Assembly.GetExecutingAssembly()); 28 | container.Verify(); 29 | DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container)); 30 | } 31 | 32 | private static void InitializeContainer(Container container) 33 | { 34 | Infrastructure.IoC.Bindings.Start(container); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/ApplicationInsights.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | /* Set width on the form input elements since they're 100% wide by default */ 20 | input, 21 | select, 22 | textarea { 23 | max-width: 280px; 24 | } 25 | 26 | 27 | 28 | .dropdown-submenu { 29 | position: relative; 30 | } 31 | 32 | .dropdown-submenu>.dropdown-menu { 33 | top: 0; 34 | left: 100%; 35 | margin-top: -6px; 36 | margin-left: -1px; 37 | -webkit-border-radius: 0 6px 6px 6px; 38 | -moz-border-radius: 0 6px 6px; 39 | border-radius: 0 6px 6px 6px; 40 | } 41 | 42 | .dropdown-submenu:hover>.dropdown-menu { 43 | display: block; 44 | } 45 | 46 | .dropdown-submenu>a:after { 47 | display: block; 48 | content: " "; 49 | float: right; 50 | width: 0; 51 | height: 0; 52 | border-color: transparent; 53 | border-style: solid; 54 | border-width: 5px 0 5px 5px; 55 | border-left-color: #ccc; 56 | margin-top: 5px; 57 | margin-right: -10px; 58 | } 59 | 60 | .dropdown-submenu:hover>a:after { 61 | border-left-color: #fff; 62 | } 63 | 64 | .dropdown-submenu.pull-left { 65 | float: none; 66 | } 67 | 68 | .dropdown-submenu.pull-left>.dropdown-menu { 69 | left: -100%; 70 | margin-left: 10px; 71 | -webkit-border-radius: 6px 0 6px 6px; 72 | -moz-border-radius: 6px 0 6px 6px; 73 | border-radius: 6px 0 6px 6px; 74 | } -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Controllers/AccountController.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Interfaces.Domain; 2 | using ProjetoDDD.UI.Web.Util; 3 | using ProjetoDDD.UI.Web.ViewModels; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Web; 8 | using System.Web.Mvc; 9 | 10 | namespace ProjetoDDD.UI.Web.Controllers 11 | { 12 | public class AccountController : Controller 13 | { 14 | private readonly IServicoDeUsuarioDomain _servicoUsuarioDominio; 15 | 16 | public AccountController(IServicoDeUsuarioDomain servicoUsuarioDominio) 17 | { 18 | _servicoUsuarioDominio = servicoUsuarioDominio; 19 | } 20 | 21 | // GET: Account/Login 22 | public ActionResult Login() 23 | { 24 | return View(); 25 | } 26 | 27 | [HttpPost] 28 | public ActionResult Login(LoginViewModel viewModel) 29 | { 30 | if (!ModelState.IsValid) 31 | return View(viewModel); 32 | 33 | var usuario = _servicoUsuarioDominio.LogaUsuario(viewModel.Email, viewModel.Password); 34 | if (usuario == null) 35 | { 36 | ModelState.AddModelError("", "Email ou Senha incorretos."); 37 | return View(viewModel); 38 | } 39 | 40 | SessionManager.UsuarioLogado = usuario; 41 | 42 | return RedirectToAction("Index", "Home"); 43 | } 44 | 45 | public ActionResult Logoff() 46 | { 47 | Session.Abandon(); 48 | Session.RemoveAll(); 49 | return RedirectToAction("Index", "Home"); 50 | } 51 | 52 | [HttpGet] 53 | public ActionResult Register() 54 | { 55 | var viewModel = new RegisterViewModel(); 56 | viewModel.ComboPerfilUsuario = _servicoUsuarioDominio.RecuperaTodosPerfisAtivos().Select(x => new SelectListItem { Text = x.NomPerfil, Value =Convert.ToString(x.IdPerfilUsuario) }); ; 57 | return View(viewModel); 58 | } 59 | 60 | [HttpPost] 61 | public ActionResult Register(RegisterViewModel viewModel) 62 | { 63 | if (!ModelState.IsValid) 64 | return View(viewModel); 65 | 66 | viewModel.ComboPerfilUsuario = _servicoUsuarioDominio.RecuperaTodosPerfisAtivos().Select(x => new SelectListItem { Text = x.NomPerfil, Value = Convert.ToString(x.IdPerfilUsuario) }); ; 67 | 68 | var usuarioExistente =_servicoUsuarioDominio.RecuperaUsuarioPorEmail(viewModel.Email); 69 | if(usuarioExistente != null) 70 | { 71 | ModelState.AddModelError("", "Email está sendo utilizado."); 72 | return View(viewModel); 73 | } 74 | 75 | _servicoUsuarioDominio.CadastraUsuario( 76 | new Domain.Entities.Usuario() 77 | { 78 | Nome = viewModel.Nome, 79 | DataCadastro = DateTime.Now, 80 | Email = viewModel.Email, 81 | IdPerfilUsuario = viewModel.IdPerfilUsuario, 82 | Senha = viewModel.Senha, 83 | SenhaKey = Functions.GetRandomString() 84 | }); 85 | 86 | //var usuario = _servicoUsuarioDominio.LogaUsuario(viewModel.Email, viewModel.Senha); 87 | //if (usuario == null) 88 | //{ 89 | // ModelState.AddModelError("", "Email ou Senha incorretos."); 90 | // return View(viewModel); 91 | //} 92 | 93 | //SessionManager.UsuarioLogado = usuario; 94 | 95 | return RedirectToAction("Index", "Home"); 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace ProjetoDDD.UI.Web.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="ProjetoDDD.UI.Web.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Infrastructure.IoC; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using System.Web.Optimization; 8 | using System.Web.Routing; 9 | 10 | namespace ProjetoDDD.UI.Web 11 | { 12 | public class MvcApplication : System.Web.HttpApplication 13 | { 14 | protected void Application_Start() 15 | { 16 | AreaRegistration.RegisterAllAreas(); 17 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 18 | RouteConfig.RegisterRoutes(RouteTable.Routes); 19 | BundleConfig.RegisterBundles(BundleTable.Bundles); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Project_Readme.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Your ASP.NET application 6 | 95 | 96 | 97 | 98 | 102 | 103 |
104 |
105 |

This application consists of:

106 |
    107 |
  • Sample pages showing basic nav between Home, About, and Contact
  • 108 |
  • Theming using Bootstrap
  • 109 |
  • Authentication, if selected, shows how to register and sign in
  • 110 |
  • ASP.NET features managed using NuGet
  • 111 |
112 |
113 | 114 | 131 | 132 |
133 |

Deploy

134 | 139 |
140 | 141 |
142 |

Get help

143 | 147 |
148 |
149 | 150 | 151 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ProjetoDDD.UI.Web")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ProjetoDDD.UI.Web")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9eff1c52-fc17-4045-aa62-6c3535aefb47")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplificandoNET/ProjetoDDD/9ff331539bb3ca80bd83b4154eb4172770d1178a/ProjetoDDD.UI.Web/Scripts/_references.js -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Scripts/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | 16 | /** 17 | * bootstrap.js v3.0.0 by @fat and @mdo 18 | * Copyright 2013 Twitter Inc. 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | */ 21 | if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");"radio"===b.prop("type")&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(window.jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(window.jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery); -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Scripts/jquery.validate.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation 16 | * Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"Warning: No message defined for "+e.name+"")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery); -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Scripts/jquery.validate.unobtrusive.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | 20 | /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 21 | /*global document: false, jQuery: false */ 22 | 23 | (function ($) { 24 | var $jQval = $.validator, 25 | adapters, 26 | data_validation = "unobtrusiveValidation"; 27 | 28 | function setValidationValues(options, ruleName, value) { 29 | options.rules[ruleName] = value; 30 | if (options.message) { 31 | options.messages[ruleName] = options.message; 32 | } 33 | } 34 | 35 | function splitAndTrim(value) { 36 | return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g); 37 | } 38 | 39 | function escapeAttributeValue(value) { 40 | // As mentioned on http://api.jquery.com/category/selectors/ 41 | return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1"); 42 | } 43 | 44 | function getModelPrefix(fieldName) { 45 | return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); 46 | } 47 | 48 | function appendModelPrefix(value, prefix) { 49 | if (value.indexOf("*.") === 0) { 50 | value = value.replace("*.", prefix); 51 | } 52 | return value; 53 | } 54 | 55 | function onError(error, inputElement) { // 'this' is the form element 56 | var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"), 57 | replaceAttrValue = container.attr("data-valmsg-replace"), 58 | replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null; 59 | 60 | container.removeClass("field-validation-valid").addClass("field-validation-error"); 61 | error.data("unobtrusiveContainer", container); 62 | 63 | if (replace) { 64 | container.empty(); 65 | error.removeClass("input-validation-error").appendTo(container); 66 | } 67 | else { 68 | error.hide(); 69 | } 70 | } 71 | 72 | function onErrors(event, validator) { // 'this' is the form element 73 | var container = $(this).find("[data-valmsg-summary=true]"), 74 | list = container.find("ul"); 75 | 76 | if (list && list.length && validator.errorList.length) { 77 | list.empty(); 78 | container.addClass("validation-summary-errors").removeClass("validation-summary-valid"); 79 | 80 | $.each(validator.errorList, function () { 81 | $("
  • ").html(this.message).appendTo(list); 82 | }); 83 | } 84 | } 85 | 86 | function onSuccess(error) { // 'this' is the form element 87 | var container = error.data("unobtrusiveContainer"), 88 | replaceAttrValue = container.attr("data-valmsg-replace"), 89 | replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null; 90 | 91 | if (container) { 92 | container.addClass("field-validation-valid").removeClass("field-validation-error"); 93 | error.removeData("unobtrusiveContainer"); 94 | 95 | if (replace) { 96 | container.empty(); 97 | } 98 | } 99 | } 100 | 101 | function onReset(event) { // 'this' is the form element 102 | var $form = $(this), 103 | key = '__jquery_unobtrusive_validation_form_reset'; 104 | if ($form.data(key)) { 105 | return; 106 | } 107 | // Set a flag that indicates we're currently resetting the form. 108 | $form.data(key, true); 109 | try { 110 | $form.data("validator").resetForm(); 111 | } finally { 112 | $form.removeData(key); 113 | } 114 | 115 | $form.find(".validation-summary-errors") 116 | .addClass("validation-summary-valid") 117 | .removeClass("validation-summary-errors"); 118 | $form.find(".field-validation-error") 119 | .addClass("field-validation-valid") 120 | .removeClass("field-validation-error") 121 | .removeData("unobtrusiveContainer") 122 | .find(">*") // If we were using valmsg-replace, get the underlying error 123 | .removeData("unobtrusiveContainer"); 124 | } 125 | 126 | function validationInfo(form) { 127 | var $form = $(form), 128 | result = $form.data(data_validation), 129 | onResetProxy = $.proxy(onReset, form), 130 | defaultOptions = $jQval.unobtrusive.options || {}, 131 | execInContext = function (name, args) { 132 | var func = defaultOptions[name]; 133 | func && $.isFunction(func) && func.apply(form, args); 134 | } 135 | 136 | if (!result) { 137 | result = { 138 | options: { // options structure passed to jQuery Validate's validate() method 139 | errorClass: defaultOptions.errorClass || "input-validation-error", 140 | errorElement: defaultOptions.errorElement || "span", 141 | errorPlacement: function () { 142 | onError.apply(form, arguments); 143 | execInContext("errorPlacement", arguments); 144 | }, 145 | invalidHandler: function () { 146 | onErrors.apply(form, arguments); 147 | execInContext("invalidHandler", arguments); 148 | }, 149 | messages: {}, 150 | rules: {}, 151 | success: function () { 152 | onSuccess.apply(form, arguments); 153 | execInContext("success", arguments); 154 | } 155 | }, 156 | attachValidation: function () { 157 | $form 158 | .off("reset." + data_validation, onResetProxy) 159 | .on("reset." + data_validation, onResetProxy) 160 | .validate(this.options); 161 | }, 162 | validate: function () { // a validation function that is called by unobtrusive Ajax 163 | $form.validate(); 164 | return $form.valid(); 165 | } 166 | }; 167 | $form.data(data_validation, result); 168 | } 169 | 170 | return result; 171 | } 172 | 173 | $jQval.unobtrusive = { 174 | adapters: [], 175 | 176 | parseElement: function (element, skipAttach) { 177 | /// 178 | /// Parses a single HTML element for unobtrusive validation attributes. 179 | /// 180 | /// The HTML element to be parsed. 181 | /// [Optional] true to skip attaching the 182 | /// validation to the form. If parsing just this single element, you should specify true. 183 | /// If parsing several elements, you should specify false, and manually attach the validation 184 | /// to the form when you are finished. The default is false. 185 | var $element = $(element), 186 | form = $element.parents("form")[0], 187 | valInfo, rules, messages; 188 | 189 | if (!form) { // Cannot do client-side validation without a form 190 | return; 191 | } 192 | 193 | valInfo = validationInfo(form); 194 | valInfo.options.rules[element.name] = rules = {}; 195 | valInfo.options.messages[element.name] = messages = {}; 196 | 197 | $.each(this.adapters, function () { 198 | var prefix = "data-val-" + this.name, 199 | message = $element.attr(prefix), 200 | paramValues = {}; 201 | 202 | if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy) 203 | prefix += "-"; 204 | 205 | $.each(this.params, function () { 206 | paramValues[this] = $element.attr(prefix + this); 207 | }); 208 | 209 | this.adapt({ 210 | element: element, 211 | form: form, 212 | message: message, 213 | params: paramValues, 214 | rules: rules, 215 | messages: messages 216 | }); 217 | } 218 | }); 219 | 220 | $.extend(rules, { "__dummy__": true }); 221 | 222 | if (!skipAttach) { 223 | valInfo.attachValidation(); 224 | } 225 | }, 226 | 227 | parse: function (selector) { 228 | /// 229 | /// Parses all the HTML elements in the specified selector. It looks for input elements decorated 230 | /// with the [data-val=true] attribute value and enables validation according to the data-val-* 231 | /// attribute values. 232 | /// 233 | /// Any valid jQuery selector. 234 | 235 | // $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one 236 | // element with data-val=true 237 | var $selector = $(selector), 238 | $forms = $selector.parents() 239 | .addBack() 240 | .filter("form") 241 | .add($selector.find("form")) 242 | .has("[data-val=true]"); 243 | 244 | $selector.find("[data-val=true]").each(function () { 245 | $jQval.unobtrusive.parseElement(this, true); 246 | }); 247 | 248 | $forms.each(function () { 249 | var info = validationInfo(this); 250 | if (info) { 251 | info.attachValidation(); 252 | } 253 | }); 254 | } 255 | }; 256 | 257 | adapters = $jQval.unobtrusive.adapters; 258 | 259 | adapters.add = function (adapterName, params, fn) { 260 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation. 261 | /// The name of the adapter to be added. This matches the name used 262 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 263 | /// [Optional] An array of parameter names (strings) that will 264 | /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and 265 | /// mmmm is the parameter name). 266 | /// The function to call, which adapts the values from the HTML 267 | /// attributes into jQuery Validate rules and/or messages. 268 | /// 269 | if (!fn) { // Called with no params, just a function 270 | fn = params; 271 | params = []; 272 | } 273 | this.push({ name: adapterName, params: params, adapt: fn }); 274 | return this; 275 | }; 276 | 277 | adapters.addBool = function (adapterName, ruleName) { 278 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 279 | /// the jQuery Validate validation rule has no parameter values. 280 | /// The name of the adapter to be added. This matches the name used 281 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 282 | /// [Optional] The name of the jQuery Validate rule. If not provided, the value 283 | /// of adapterName will be used instead. 284 | /// 285 | return this.add(adapterName, function (options) { 286 | setValidationValues(options, ruleName || adapterName, true); 287 | }); 288 | }; 289 | 290 | adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) { 291 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 292 | /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and 293 | /// one for min-and-max). The HTML parameters are expected to be named -min and -max. 294 | /// The name of the adapter to be added. This matches the name used 295 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 296 | /// The name of the jQuery Validate rule to be used when you only 297 | /// have a minimum value. 298 | /// The name of the jQuery Validate rule to be used when you only 299 | /// have a maximum value. 300 | /// The name of the jQuery Validate rule to be used when you 301 | /// have both a minimum and maximum value. 302 | /// [Optional] The name of the HTML attribute that 303 | /// contains the minimum value. The default is "min". 304 | /// [Optional] The name of the HTML attribute that 305 | /// contains the maximum value. The default is "max". 306 | /// 307 | return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) { 308 | var min = options.params.min, 309 | max = options.params.max; 310 | 311 | if (min && max) { 312 | setValidationValues(options, minMaxRuleName, [min, max]); 313 | } 314 | else if (min) { 315 | setValidationValues(options, minRuleName, min); 316 | } 317 | else if (max) { 318 | setValidationValues(options, maxRuleName, max); 319 | } 320 | }); 321 | }; 322 | 323 | adapters.addSingleVal = function (adapterName, attribute, ruleName) { 324 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 325 | /// the jQuery Validate validation rule has a single value. 326 | /// The name of the adapter to be added. This matches the name used 327 | /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name). 328 | /// [Optional] The name of the HTML attribute that contains the value. 329 | /// The default is "val". 330 | /// [Optional] The name of the jQuery Validate rule. If not provided, the value 331 | /// of adapterName will be used instead. 332 | /// 333 | return this.add(adapterName, [attribute || "val"], function (options) { 334 | setValidationValues(options, ruleName || adapterName, options.params[attribute]); 335 | }); 336 | }; 337 | 338 | $jQval.addMethod("__dummy__", function (value, element, params) { 339 | return true; 340 | }); 341 | 342 | $jQval.addMethod("regex", function (value, element, params) { 343 | var match; 344 | if (this.optional(element)) { 345 | return true; 346 | } 347 | 348 | match = new RegExp(params).exec(value); 349 | return (match && (match.index === 0) && (match[0].length === value.length)); 350 | }); 351 | 352 | $jQval.addMethod("nonalphamin", function (value, element, nonalphamin) { 353 | var match; 354 | if (nonalphamin) { 355 | match = value.match(/\W/g); 356 | match = match && match.length >= nonalphamin; 357 | } 358 | return match; 359 | }); 360 | 361 | if ($jQval.methods.extension) { 362 | adapters.addSingleVal("accept", "mimtype"); 363 | adapters.addSingleVal("extension", "extension"); 364 | } else { 365 | // for backward compatibility, when the 'extension' validation method does not exist, such as with versions 366 | // of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for 367 | // validating the extension, and ignore mime-type validations as they are not supported. 368 | adapters.addSingleVal("extension", "extension", "accept"); 369 | } 370 | 371 | adapters.addSingleVal("regex", "pattern"); 372 | adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"); 373 | adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range"); 374 | adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength"); 375 | adapters.add("equalto", ["other"], function (options) { 376 | var prefix = getModelPrefix(options.element.name), 377 | other = options.params.other, 378 | fullOtherName = appendModelPrefix(other, prefix), 379 | element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0]; 380 | 381 | setValidationValues(options, "equalTo", element); 382 | }); 383 | adapters.add("required", function (options) { 384 | // jQuery Validate equates "required" with "mandatory" for checkbox elements 385 | if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") { 386 | setValidationValues(options, "required", true); 387 | } 388 | }); 389 | adapters.add("remote", ["url", "type", "additionalfields"], function (options) { 390 | var value = { 391 | url: options.params.url, 392 | type: options.params.type || "GET", 393 | data: {} 394 | }, 395 | prefix = getModelPrefix(options.element.name); 396 | 397 | $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) { 398 | var paramName = appendModelPrefix(fieldName, prefix); 399 | value.data[paramName] = function () { 400 | var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']"); 401 | // For checkboxes and radio buttons, only pick up values from checked fields. 402 | if (field.is(":checkbox")) { 403 | return field.filter(":checked").val() || field.filter(":hidden").val() || ''; 404 | } 405 | else if (field.is(":radio")) { 406 | return field.filter(":checked").val() || ''; 407 | } 408 | return field.val(); 409 | }; 410 | }); 411 | 412 | setValidationValues(options, "remote", value); 413 | }); 414 | adapters.add("password", ["min", "nonalphamin", "regex"], function (options) { 415 | if (options.params.min) { 416 | setValidationValues(options, "minlength", options.params.min); 417 | } 418 | if (options.params.nonalphamin) { 419 | setValidationValues(options, "nonalphamin", options.params.nonalphamin); 420 | } 421 | if (options.params.regex) { 422 | setValidationValues(options, "regex", options.params.regex); 423 | } 424 | }); 425 | 426 | $(function () { 427 | $jQval.unobtrusive.parse(document); 428 | }); 429 | }(jQuery)); -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /* 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | (function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,e){var b=a(this).find("[data-valmsg-for='"+f(e[0].name)+"']"),d=b.attr("data-valmsg-replace"),g=d?a.parseJSON(d)!==false:null;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(g){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
  • ").html(this.message).appendTo(b)})}}function k(d){var b=d.data("unobtrusiveContainer"),c=b.attr("data-valmsg-replace"),e=c?a.parseJSON(c):null;if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");d.removeData("unobtrusiveContainer");e&&b.empty()}}function n(){var b=a(this),c="__jquery_unobtrusive_validation_form_reset";if(b.data(c))return;b.data(c,true);try{b.data("validator").resetForm()}finally{b.removeData(c)}b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(b){var c=a(b),f=c.data(e),i=a.proxy(n,b),g=d.unobtrusive.options||{},h=function(e,d){var c=g[e];c&&a.isFunction(c)&&c.apply(b,d)};if(!f){f={options:{errorClass:g.errorClass||"input-validation-error",errorElement:g.errorElement||"span",errorPlacement:function(){m.apply(b,arguments);h("errorPlacement",arguments)},invalidHandler:function(){l.apply(b,arguments);h("invalidHandler",arguments)},messages:{},rules:{},success:function(){k.apply(b,arguments);h("success",arguments)}},attachValidation:function(){c.off("reset."+e,i).on("reset."+e,i).validate(this.options)},validate:function(){c.validate();return c.valid()}};c.data(e,f)}return f}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(c){var b=a(c),e=b.parents().addBack().filter("form").add(b.find("form")).has("[data-val=true]");b.find("[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});e.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});d.addMethod("nonalphamin",function(c,d,b){var a;if(b){a=c.match(/\W/g);a=a&&a.length>=b}return a});if(d.methods.extension){b.addSingleVal("accept","mimtype");b.addSingleVal("extension","extension")}else b.addSingleVal("extension","extension","accept");b.addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input").filter("[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){var d=a(b.form).find(":input").filter("[name='"+f(c)+"']");return d.is(":checkbox")?d.filter(":checked").val()||d.filter(":hidden").val()||"":d.is(":radio")?d.filter(":checked").val()||"":d.val()}});c(b,"remote",d)});b.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&c(a,"minlength",a.params.min);a.params.nonalphamin&&c(a,"nonalphamin",a.params.nonalphamin);a.params.regex&&c(a,"regex",a.params.regex)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Scripts/respond.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 16 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 17 | window.matchMedia = window.matchMedia || (function(doc, undefined){ 18 | 19 | var bool, 20 | docElem = doc.documentElement, 21 | refNode = docElem.firstElementChild || docElem.firstChild, 22 | // fakeBody required for 23 | fakeBody = doc.createElement('body'), 24 | div = doc.createElement('div'); 25 | 26 | div.id = 'mq-test-1'; 27 | div.style.cssText = "position:absolute;top:-100em"; 28 | fakeBody.style.background = "none"; 29 | fakeBody.appendChild(div); 30 | 31 | return function(q){ 32 | 33 | div.innerHTML = '­'; 34 | 35 | docElem.insertBefore(fakeBody, refNode); 36 | bool = div.offsetWidth == 42; 37 | docElem.removeChild(fakeBody); 38 | 39 | return { matches: bool, media: q }; 40 | }; 41 | 42 | })(document); 43 | 44 | 45 | 46 | 47 | /*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 48 | (function( win ){ 49 | //exposed namespace 50 | win.respond = {}; 51 | 52 | //define update even in native-mq-supporting browsers, to avoid errors 53 | respond.update = function(){}; 54 | 55 | //expose media query support flag for external use 56 | respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; 57 | 58 | //if media queries are supported, exit here 59 | if( respond.mediaQueriesSupported ){ return; } 60 | 61 | //define vars 62 | var doc = win.document, 63 | docElem = doc.documentElement, 64 | mediastyles = [], 65 | rules = [], 66 | appendedEls = [], 67 | parsedSheets = {}, 68 | resizeThrottle = 30, 69 | head = doc.getElementsByTagName( "head" )[0] || docElem, 70 | base = doc.getElementsByTagName( "base" )[0], 71 | links = head.getElementsByTagName( "link" ), 72 | requestQueue = [], 73 | 74 | //loop stylesheets, send text content to translate 75 | ripCSS = function(){ 76 | var sheets = links, 77 | sl = sheets.length, 78 | i = 0, 79 | //vars for loop: 80 | sheet, href, media, isCSS; 81 | 82 | for( ; i < sl; i++ ){ 83 | sheet = sheets[ i ], 84 | href = sheet.href, 85 | media = sheet.media, 86 | isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 87 | 88 | //only links plz and prevent re-parsing 89 | if( !!href && isCSS && !parsedSheets[ href ] ){ 90 | // selectivizr exposes css through the rawCssText expando 91 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 92 | translate( sheet.styleSheet.rawCssText, href, media ); 93 | parsedSheets[ href ] = true; 94 | } else { 95 | if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) 96 | || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ 97 | requestQueue.push( { 98 | href: href, 99 | media: media 100 | } ); 101 | } 102 | } 103 | } 104 | } 105 | makeRequests(); 106 | }, 107 | 108 | //recurse through request queue, get css text 109 | makeRequests = function(){ 110 | if( requestQueue.length ){ 111 | var thisRequest = requestQueue.shift(); 112 | 113 | ajax( thisRequest.href, function( styles ){ 114 | translate( styles, thisRequest.href, thisRequest.media ); 115 | parsedSheets[ thisRequest.href ] = true; 116 | makeRequests(); 117 | } ); 118 | } 119 | }, 120 | 121 | //find media blocks in css text, convert to style blocks 122 | translate = function( styles, href, media ){ 123 | var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ), 124 | ql = qs && qs.length || 0, 125 | //try to get CSS path 126 | href = href.substring( 0, href.lastIndexOf( "/" )), 127 | repUrls = function( css ){ 128 | return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" ); 129 | }, 130 | useMedia = !ql && media, 131 | //vars used in loop 132 | i = 0, 133 | j, fullq, thisq, eachq, eql; 134 | 135 | //if path exists, tack on trailing slash 136 | if( href.length ){ href += "/"; } 137 | 138 | //if no internal queries exist, but media attr does, use that 139 | //note: this currently lacks support for situations where a media attr is specified on a link AND 140 | //its associated stylesheet has internal CSS media queries. 141 | //In those cases, the media attribute will currently be ignored. 142 | if( useMedia ){ 143 | ql = 1; 144 | } 145 | 146 | 147 | for( ; i < ql; i++ ){ 148 | j = 0; 149 | 150 | //media attr 151 | if( useMedia ){ 152 | fullq = media; 153 | rules.push( repUrls( styles ) ); 154 | } 155 | //parse for styles 156 | else{ 157 | fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; 158 | rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); 159 | } 160 | 161 | eachq = fullq.split( "," ); 162 | eql = eachq.length; 163 | 164 | for( ; j < eql; j++ ){ 165 | thisq = eachq[ j ]; 166 | mediastyles.push( { 167 | media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all", 168 | rules : rules.length - 1, 169 | hasquery: thisq.indexOf("(") > -1, 170 | minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), 171 | maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) 172 | } ); 173 | } 174 | } 175 | 176 | applyMedia(); 177 | }, 178 | 179 | lastCall, 180 | 181 | resizeDefer, 182 | 183 | // returns the value of 1em in pixels 184 | getEmValue = function() { 185 | var ret, 186 | div = doc.createElement('div'), 187 | body = doc.body, 188 | fakeUsed = false; 189 | 190 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; 191 | 192 | if( !body ){ 193 | body = fakeUsed = doc.createElement( "body" ); 194 | body.style.background = "none"; 195 | } 196 | 197 | body.appendChild( div ); 198 | 199 | docElem.insertBefore( body, docElem.firstChild ); 200 | 201 | ret = div.offsetWidth; 202 | 203 | if( fakeUsed ){ 204 | docElem.removeChild( body ); 205 | } 206 | else { 207 | body.removeChild( div ); 208 | } 209 | 210 | //also update eminpx before returning 211 | ret = eminpx = parseFloat(ret); 212 | 213 | return ret; 214 | }, 215 | 216 | //cached container for 1em value, populated the first time it's needed 217 | eminpx, 218 | 219 | //enable/disable styles 220 | applyMedia = function( fromResize ){ 221 | var name = "clientWidth", 222 | docElemProp = docElem[ name ], 223 | currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, 224 | styleBlocks = {}, 225 | lastLink = links[ links.length-1 ], 226 | now = (new Date()).getTime(); 227 | 228 | //throttle resize calls 229 | if( fromResize && lastCall && now - lastCall < resizeThrottle ){ 230 | clearTimeout( resizeDefer ); 231 | resizeDefer = setTimeout( applyMedia, resizeThrottle ); 232 | return; 233 | } 234 | else { 235 | lastCall = now; 236 | } 237 | 238 | for( var i in mediastyles ){ 239 | var thisstyle = mediastyles[ i ], 240 | min = thisstyle.minw, 241 | max = thisstyle.maxw, 242 | minnull = min === null, 243 | maxnull = max === null, 244 | em = "em"; 245 | 246 | if( !!min ){ 247 | min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 248 | } 249 | if( !!max ){ 250 | max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 251 | } 252 | 253 | // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true 254 | if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ 255 | if( !styleBlocks[ thisstyle.media ] ){ 256 | styleBlocks[ thisstyle.media ] = []; 257 | } 258 | styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); 259 | } 260 | } 261 | 262 | //remove any existing respond style element(s) 263 | for( var i in appendedEls ){ 264 | if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){ 265 | head.removeChild( appendedEls[ i ] ); 266 | } 267 | } 268 | 269 | //inject active styles, grouped by media type 270 | for( var i in styleBlocks ){ 271 | var ss = doc.createElement( "style" ), 272 | css = styleBlocks[ i ].join( "\n" ); 273 | 274 | ss.type = "text/css"; 275 | ss.media = i; 276 | 277 | //originally, ss was appended to a documentFragment and sheets were appended in bulk. 278 | //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! 279 | head.insertBefore( ss, lastLink.nextSibling ); 280 | 281 | if ( ss.styleSheet ){ 282 | ss.styleSheet.cssText = css; 283 | } 284 | else { 285 | ss.appendChild( doc.createTextNode( css ) ); 286 | } 287 | 288 | //push to appendedEls to track for later removal 289 | appendedEls.push( ss ); 290 | } 291 | }, 292 | //tweaked Ajax functions from Quirksmode 293 | ajax = function( url, callback ) { 294 | var req = xmlHttp(); 295 | if (!req){ 296 | return; 297 | } 298 | req.open( "GET", url, true ); 299 | req.onreadystatechange = function () { 300 | if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){ 301 | return; 302 | } 303 | callback( req.responseText ); 304 | } 305 | if ( req.readyState == 4 ){ 306 | return; 307 | } 308 | req.send( null ); 309 | }, 310 | //define ajax obj 311 | xmlHttp = (function() { 312 | var xmlhttpmethod = false; 313 | try { 314 | xmlhttpmethod = new XMLHttpRequest(); 315 | } 316 | catch( e ){ 317 | xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" ); 318 | } 319 | return function(){ 320 | return xmlhttpmethod; 321 | }; 322 | })(); 323 | 324 | //translate CSS 325 | ripCSS(); 326 | 327 | //expose update for re-running respond later on 328 | respond.update = ripCSS; 329 | 330 | //adjust on resize 331 | function callMedia(){ 332 | applyMedia( true ); 333 | } 334 | if( win.addEventListener ){ 335 | win.addEventListener( "resize", callMedia, false ); 336 | } 337 | else if( win.attachEvent ){ 338 | win.attachEvent( "onresize", callMedia ); 339 | } 340 | })(this); 341 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Scripts/respond.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 16 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 17 | window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='­';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); 18 | 19 | /*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 20 | (function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this); -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Util/Functions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Net.Sockets; 7 | using System.Web; 8 | 9 | namespace ProjetoDDD.UI.Web.Util 10 | { 11 | public static class Functions 12 | { 13 | public static string GetRandomString() 14 | { 15 | var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; 16 | var random = new Random(); 17 | var result = new string( 18 | Enumerable.Repeat(chars, 8) 19 | .Select(s => s[random.Next(s.Length)]) 20 | .ToArray()); 21 | return result; 22 | } 23 | 24 | public static int CalculaIdade(DateTime DataNascimento) 25 | { 26 | 27 | int anos = DateTime.Now.Year - DataNascimento.Year; 28 | 29 | if (DateTime.Now.Month < DataNascimento.Month || (DateTime.Now.Month == DataNascimento.Month && DateTime.Now.Day < DataNascimento.Day)) 30 | 31 | anos--; 32 | 33 | return anos; 34 | 35 | } 36 | 37 | public static string GetDataAtualPorExtenso() 38 | { 39 | return DateTime.Now.ToString("dddd").ToUpper() + ", " + DateTime.Now.ToString("dd").ToUpper() + 40 | " DE " + DateTime.Now.ToString("MMMM").ToUpper() + " DE " + DateTime.Now.ToString("yyyy").ToUpper() + " " + 41 | DateTime.Now.ToString("HH:mm").ToUpper(); 42 | } 43 | 44 | public static string GetServerIP() 45 | { 46 | IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); 47 | 48 | foreach (IPAddress address in ipHostInfo.AddressList) 49 | { 50 | if (address.AddressFamily == AddressFamily.InterNetwork) 51 | return address.ToString() + "|" + ipHostInfo.HostName; 52 | } 53 | 54 | return string.Empty; 55 | } 56 | 57 | public enum TypeString 58 | { 59 | Text, 60 | Numeric, 61 | CNPJ, 62 | CPF, 63 | Date, 64 | Int, 65 | CEP, 66 | Telefone, 67 | Currency, 68 | Percent, 69 | Milhar, 70 | AnoMes 71 | } 72 | 73 | public static string FormatString(string value, TypeString type) 74 | { 75 | try 76 | { 77 | NumberFormatInfo numberFormatInfo = new CultureInfo("pt-BR", false).NumberFormat; 78 | 79 | switch (type) 80 | { 81 | case TypeString.Text: 82 | return value; 83 | case TypeString.Numeric: 84 | return Convert.ToDouble(value).ToString("#,##0.00"); 85 | case TypeString.CNPJ: 86 | value = value.PadLeft(14, '0'); 87 | return string.Format("{0}.{1}.{2}/{3}-{4}", value.Substring(0, 2), value.Substring(2, 3), value.Substring(5, 3), value.Substring(8, 4), value.Substring(12, 2)); 88 | case TypeString.CPF: 89 | value = value.PadLeft(11, '0'); 90 | return string.Format("{0}.{1}.{2}-{3}", value.Substring(0, 3), value.Substring(3, 3), value.Substring(6, 3), value.Substring(9, 2)); 91 | case TypeString.Date: 92 | if (Convert.ToDateTime(value) == Convert.ToDateTime("1/1/1900")) 93 | return string.Empty; 94 | else 95 | return Convert.ToDateTime(value).ToString("dd/MM/yyyy"); 96 | case TypeString.CEP: 97 | value = value.PadLeft(8, '0'); 98 | return string.Format("{0}.{1}-{2}", value.Substring(0, 2), value.Substring(2, 3), value.Substring(5, 3)); 99 | case TypeString.Telefone: 100 | return string.Format("({0}) {1}", value.Substring(0, 2), value.Substring(2, value.Length - 2)); 101 | case TypeString.Currency: 102 | return Convert.ToDouble(value).ToString("C"); 103 | case TypeString.Percent: 104 | numberFormatInfo.PercentDecimalDigits = 0; 105 | return Convert.ToDouble(value).ToString("P", numberFormatInfo); 106 | case TypeString.Milhar: 107 | return Convert.ToDouble(value).ToString("#,##0"); 108 | case TypeString.AnoMes: 109 | return string.Format("{0}/{1}", value.Substring(value.Length - 2), value.Substring(0, 4)); 110 | default: 111 | return value; 112 | } 113 | } 114 | catch 115 | { 116 | return value; 117 | } 118 | } 119 | } 120 | } -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Util/SessionManager.cs: -------------------------------------------------------------------------------- 1 | using ProjetoDDD.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace ProjetoDDD.UI.Web.Util 8 | { 9 | public class SessionManager 10 | { 11 | public static Usuario UsuarioLogado 12 | { 13 | set 14 | { 15 | 16 | HttpContext.Current.Session.Add("UsuarioLogado", value); 17 | } 18 | get 19 | { 20 | return (Usuario)HttpContext.Current.Session["UsuarioLogado"]; 21 | } 22 | 23 | } 24 | 25 | public static bool IsAuthenticated 26 | { 27 | get 28 | { 29 | return ((Usuario)HttpContext.Current.Session["UsuarioLogado"]) != null; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/ViewModels/LoginViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace ProjetoDDD.UI.Web.ViewModels 4 | { 5 | public class LoginViewModel 6 | { 7 | [Required] 8 | [Display(Name = "E-mail")] 9 | [MaxLength(30, ErrorMessage = "Máximo permitido para o Email são 30 caracteres.")] 10 | [EmailAddress] 11 | public string Email { get; set; } 12 | 13 | [Required] 14 | [DataType(DataType.Password)] 15 | [Display(Name = "Senha")] 16 | public string Password { get; set; } 17 | 18 | [Display(Name = "Esqueci minha senha.")] 19 | public bool RememberMe { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/ViewModels/RegisterViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.Web.Mvc; 4 | 5 | namespace ProjetoDDD.UI.Web.ViewModels 6 | { 7 | public class RegisterViewModel 8 | { 9 | [Required] 10 | [MaxLength(30, ErrorMessage = "Máximo permitido para o Nome são 20 caracteres.")] 11 | [MinLength(3, ErrorMessage = "Minimo permitido para o Nome são 3 caracteres.")] 12 | public string Nome { get; set; } 13 | 14 | [Required] 15 | [Display(Name = "E-mail")] 16 | [MaxLength(30, ErrorMessage = "Máximo permitido para o Email são 30 caracteres.")] 17 | [EmailAddress] 18 | public string Email { get; set; } 19 | 20 | [Required] 21 | [DataType(DataType.Password)] 22 | [Display(Name = "Senha")] 23 | public string Senha { get; set; } 24 | 25 | [Required] 26 | [Display(Name = "Perfil Usuário")] 27 | public int IdPerfilUsuario { get; set; } 28 | 29 | [Display(Name = "Perfil Usuário")] 30 | public IEnumerable ComboPerfilUsuario { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/Account/Login.cshtml: -------------------------------------------------------------------------------- 1 | @model ProjetoDDD.UI.Web.ViewModels.LoginViewModel 2 | 3 | @{ 4 | ViewBag.Title = "View"; 5 | Layout = "~/Views/Shared/_Layout.cshtml"; 6 | } 7 | 8 | @using (Html.BeginForm()) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |
    13 |

    Login

    14 |
    15 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 16 |
    17 | @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" }) 18 |
    19 | @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } }) 20 | @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" }) 21 |
    22 |
    23 | 24 |
    25 | @Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label col-md-2" }) 26 |
    27 | @Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "form-control" } }) 28 | @Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" }) 29 |
    30 |
    31 | 32 |
    33 | @Html.LabelFor(model => model.RememberMe, htmlAttributes: new { @class = "control-label col-md-2" }) 34 |
    35 |
    36 | @Html.EditorFor(model => model.RememberMe) 37 | @Html.ValidationMessageFor(model => model.RememberMe, "", new { @class = "text-danger" }) 38 |
    39 |
    40 |
    41 | 42 |
    43 |
    44 | 45 |
    46 |
    47 |
    48 | } 49 | 50 |
    51 | @Html.ActionLink("Voltar", "Index","Home") 52 |
    53 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/Account/Register.cshtml: -------------------------------------------------------------------------------- 1 | @model ProjetoDDD.UI.Web.ViewModels.RegisterViewModel 2 | 3 | @{ 4 | ViewBag.Title = "Register"; 5 | Layout = "~/Views/Shared/_Layout.cshtml"; 6 | } 7 | 8 |

    Register

    9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
    15 |

    RegisterViewModel

    16 |
    17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 |
    19 | @Html.LabelFor(model => model.Nome, htmlAttributes: new { @class = "control-label col-md-2" }) 20 |
    21 | @Html.EditorFor(model => model.Nome, new { htmlAttributes = new { @class = "form-control" } }) 22 | @Html.ValidationMessageFor(model => model.Nome, "", new { @class = "text-danger" }) 23 |
    24 |
    25 | 26 |
    27 | @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" }) 28 |
    29 | @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } }) 30 | @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" }) 31 |
    32 |
    33 | 34 |
    35 | @Html.LabelFor(model => model.Senha, htmlAttributes: new { @class = "control-label col-md-2" }) 36 |
    37 | @Html.EditorFor(model => model.Senha, new { htmlAttributes = new { @class = "form-control" } }) 38 | @Html.ValidationMessageFor(model => model.Senha, "", new { @class = "text-danger" }) 39 |
    40 |
    41 | 42 |
    43 | @Html.LabelFor(m => m.ComboPerfilUsuario, new { @class = "col-md-2 control-label" }) 44 |
    45 | @Html.DropDownListFor(m => m.IdPerfilUsuario, new SelectList(Model.ComboPerfilUsuario, "Value", "Text"), " -----Selecione um Perfil----- ", new { @class = "form-control" }) 46 |
    47 |
    48 | 49 |
    50 |
    51 | 52 |
    53 |
    54 |
    55 | } 56 | 57 |
    58 | @Html.ActionLink("Back to List", "Index") 59 |
    60 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

    @ViewBag.Title.

    5 |

    @ViewBag.Message

    6 | 7 |

    Use this area to provide additional information.

    8 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

    @ViewBag.Title.

    5 |

    @ViewBag.Message

    6 | 7 |
    8 | One Microsoft Way
    9 | Redmond, WA 98052-6399
    10 | P: 11 | 425.555.0100 12 |
    13 | 14 |
    15 | Support: Support@example.com
    16 | Marketing: Marketing@example.com 17 |
    -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |
    6 |

    Simplificando .NET

    7 |

    Video Aula sobre DDD e criação de uma aplicação do 0.

    8 |
    9 | 10 |
    11 |
    12 |

    DDD

    13 |

    14 | Padrão de separação de camadas dirigida a Dominio, ou seja, centralizador de regras de Negócio. 15 |

    16 |
    17 |
    18 |

    Repository Pattern

    19 |

    Padrão de projeto para Isolar a camada de acesso a dados (DAL) das demais camadas.

    20 |
    21 |
    22 |

    Injeção de Dependência

    23 |

    Injeção de dependência é um padrão de desenvolvimento de programas de computadores utilizado quando é necessário manter baixo o nível de acoplamento entre diferentes módulos de um sistema..

    24 |
    25 |
    -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Error 6 | 7 | 8 |
    9 |

    Error.

    10 |

    An error occurred while processing your request.

    11 |
    12 | 13 | 14 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @using ProjetoDDD.UI.Web.Util 2 | 3 | 4 | 5 | 6 | 7 | @ViewBag.Title - Projeto DDD 8 | @Styles.Render("~/Content/css") 9 | @Scripts.Render("~/bundles/modernizr") 10 | 11 | 12 | 81 |
    82 | @RenderBody() 83 |
    84 |
    85 |

    © @DateTime.Now.Year - Eduardo Gavioli - Simplificando .NET

    86 |
    87 |
    88 | 89 | @Scripts.Render("~/bundles/jquery") 90 | @Scripts.Render("~/bundles/bootstrap") 91 | @RenderSection("scripts", required: false) 92 | 93 | 94 | @*
  • Some other action
  • 95 |
  • 96 | *@ -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 |
    10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 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 | -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplificandoNET/ProjetoDDD/9ff331539bb3ca80bd83b4154eb4172770d1178a/ProjetoDDD.UI.Web/favicon.ico -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplificandoNET/ProjetoDDD/9ff331539bb3ca80bd83b4154eb4172770d1178a/ProjetoDDD.UI.Web/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplificandoNET/ProjetoDDD/9ff331539bb3ca80bd83b4154eb4172770d1178a/ProjetoDDD.UI.Web/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplificandoNET/ProjetoDDD/9ff331539bb3ca80bd83b4154eb4172770d1178a/ProjetoDDD.UI.Web/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /ProjetoDDD.UI.Web/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ProjetoDDD.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0 - ProjetoDDD.UI", "0 - ProjetoDDD.UI", "{87BE7CC3-691D-469C-945C-EDB3E22B9AFA}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1 - ProjetoDDD.Application", "1 - ProjetoDDD.Application", "{3A2BA2F1-70A0-43FC-9C14-A9F5FCD45C3C}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2 - ProjetoDDD.Domain", "2 - ProjetoDDD.Domain", "{DBCFF397-320D-4711-8FA5-7BAE62852E93}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3 - ProjetoDDD.Infrastructure", "3 - ProjetoDDD.Infrastructure", "{69561859-EB9C-4533-A6DE-A683CE68F82B}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3.1 - ProjetoDDD.Infrastructure.Data", "ProjetoDDD.Infrastructure.Data\3.1 - ProjetoDDD.Infrastructure.Data.csproj", "{7BFBE834-5008-4913-9DC5-718368ACFD87}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3.2 - ProjetoDDD.Infrastructure.IoC", "ProjetoDDD.Infrastructure.IoC\3.2 - ProjetoDDD.Infrastructure.IoC.csproj", "{2B4192C7-492C-4B26-9C1D-135FA787D90E}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2.1 - ProjetoDDD.Domain", "ProjetoDDD.Domain\2.1 - ProjetoDDD.Domain.csproj", "{9D5FA0CE-2FA8-4BC7-B372-15C362C2D6D4}" 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "0.1 - ProjetoDDD.UI.Web", "ProjetoDDD.UI.Web\0.1 - ProjetoDDD.UI.Web.csproj", "{B6ADAF2A-06AB-408D-B13F-A448B2B13955}" 21 | EndProject 22 | Global 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Any CPU = Debug|Any CPU 25 | Release|Any CPU = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 28 | {7BFBE834-5008-4913-9DC5-718368ACFD87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {7BFBE834-5008-4913-9DC5-718368ACFD87}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {7BFBE834-5008-4913-9DC5-718368ACFD87}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {7BFBE834-5008-4913-9DC5-718368ACFD87}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {2B4192C7-492C-4B26-9C1D-135FA787D90E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {2B4192C7-492C-4B26-9C1D-135FA787D90E}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {2B4192C7-492C-4B26-9C1D-135FA787D90E}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {2B4192C7-492C-4B26-9C1D-135FA787D90E}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {9D5FA0CE-2FA8-4BC7-B372-15C362C2D6D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {9D5FA0CE-2FA8-4BC7-B372-15C362C2D6D4}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {9D5FA0CE-2FA8-4BC7-B372-15C362C2D6D4}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {9D5FA0CE-2FA8-4BC7-B372-15C362C2D6D4}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {B6ADAF2A-06AB-408D-B13F-A448B2B13955}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {B6ADAF2A-06AB-408D-B13F-A448B2B13955}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {B6ADAF2A-06AB-408D-B13F-A448B2B13955}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {B6ADAF2A-06AB-408D-B13F-A448B2B13955}.Release|Any CPU.Build.0 = Release|Any CPU 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(NestedProjects) = preSolution 49 | {7BFBE834-5008-4913-9DC5-718368ACFD87} = {69561859-EB9C-4533-A6DE-A683CE68F82B} 50 | {2B4192C7-492C-4B26-9C1D-135FA787D90E} = {69561859-EB9C-4533-A6DE-A683CE68F82B} 51 | {9D5FA0CE-2FA8-4BC7-B372-15C362C2D6D4} = {DBCFF397-320D-4711-8FA5-7BAE62852E93} 52 | {B6ADAF2A-06AB-408D-B13F-A448B2B13955} = {87BE7CC3-691D-469C-945C-EDB3E22B9AFA} 53 | EndGlobalSection 54 | EndGlobal 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProjetoDDD 2 | 3 | 4 | Projeto de Estudo do canal 5 | https://www.youtube.com/c/simplificandonet 6 | 7 | By Eduardo Gavioli --------------------------------------------------------------------------------