├── UI
├── I18n
│ ├── idioma.en-GB
│ └── idioma.es-AR
├── App.config
├── Properties
│ └── AssemblyInfo.cs
└── UI.csproj
├── WinApp
├── I18n
│ ├── idioma.en-GB
│ └── idioma.es-AR
├── img
│ ├── excel.png
│ ├── ICO
│ │ ├── icons8-más-16.png
│ │ ├── icons8-apagar-16.png
│ │ ├── icons8-búsqueda-16.png
│ │ ├── icons8-editar-16.png
│ │ ├── icons8-eliminar-16.png
│ │ ├── icons8-volver-16.png
│ │ ├── icons8-comprobado-16.png
│ │ ├── icons8-reiniciar-16.png
│ │ ├── icons8-guardar-cerrar-16.png
│ │ ├── icons8-por-nueva-copia-16.png
│ │ └── icons8-casilla-de-verificación-2-16.png
│ └── leonardo-da-vinci.png
├── Resources
│ ├── GUARDAR.GIF
│ ├── icoEdit.png
│ ├── icoExit.png
│ └── icoUndo.png
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ └── AssemblyInfo.cs
├── Program.cs
├── App.config
├── frmProductosALl.cs
├── frmAltaProducto.cs
├── frmUsoFactory.cs
├── frmUsuarioTest.Designer.cs
├── frmMenuPrincipal.cs
├── frmPatentesDB.cs
├── frmProductosALl.Designer.cs
├── frmPatentesDB.Designer.cs
└── frmUsuarioTest.cs
├── DAL
├── DataBase
│ ├── demoDB.bak
│ └── Script_DemoDB_MarceloDiDeo_UOW.sql
├── Contracts
│ ├── UnitOfWork
│ │ ├── IUnitOfWork.cs
│ │ ├── IUnitOfWorkAdapter.cs
│ │ └── IUnitOfWorkRepository.cs
│ ├── IAdapter.cs
│ └── IGenericRepository.cs
├── Implementations
│ ├── SqlServer
│ │ ├── UnitOfWork
│ │ │ ├── UnitOfWorkSqlServer.cs
│ │ │ ├── UnitOfWorkSqlServerRepository.cs
│ │ │ └── UnitOfWorkSqlServerAdapter.cs
│ │ ├── AlmacenRepository.cs
│ │ ├── MovimientoRepository.cs
│ │ ├── Adapter
│ │ │ ├── ProductoAdapter.cs
│ │ │ └── CustomerAdapter.cs
│ │ ├── Repository.cs
│ │ └── CustomerRepository.cs
│ ├── Memory
│ │ ├── ProductoRepository.cs
│ │ ├── MovimientoRepository.cs
│ │ └── Almacen.cs
│ └── PlainText
│ │ └── CustomerRepository.cs
├── DemoSingleton.cs
├── Factories
│ └── ApplicationFactory.cs
├── Tools
│ ├── Snippets
│ │ ├── singleton.snippet
│ │ └── staments.snippet
│ └── SqlHelper.cs
├── Properties
│ └── AssemblyInfo.cs
├── DemoParametrizacion.cs
└── DAL.csproj
├── Services
├── DAL
│ ├── DataBase
│ │ └── SecurityDB.bak
│ ├── Contracts
│ │ ├── IJoinRepository.cs
│ │ ├── IAdapter.cs
│ │ └── IGenericRepository.cs
│ ├── Factory
│ │ └── ServiceFactory.cs
│ ├── Implementations
│ │ ├── Adapter
│ │ │ ├── PatenteAdapter.cs
│ │ │ ├── FamiliaAdapter.cs
│ │ │ └── UsuarioAdapter.cs
│ │ ├── UsuarioRepository.cs
│ │ ├── LoggerRepository.cs
│ │ ├── LanguageRepository.cs
│ │ ├── FamiliaPatenteRepository.cs
│ │ ├── FamiliaFamiliaRepository.cs
│ │ ├── FamiliaRepository.cs
│ │ └── PatenteRepository.cs
│ └── Tools
│ │ └── SqlHelper.cs
├── DomainModel
│ ├── Security
│ │ ├── Patente.cs
│ │ ├── Familia.cs
│ │ ├── Usuario.cs
│ │ └── Composite
│ │ │ ├── Patente.cs
│ │ │ ├── Component.cs
│ │ │ ├── Familia.cs
│ │ │ └── Usuario.cs
│ └── Exceptions
│ │ └── WordNotFoundException.cs
├── Services
│ ├── LanguageManager.cs
│ ├── Extensions
│ │ ├── StringExtension.cs
│ │ └── ExceptionExtension.cs
│ ├── ExceptionService.cs
│ ├── LoggerService.cs
│ ├── CryptographyService.cs
│ ├── LoginService.cs
│ └── ExportarAExcel.cs
├── BLL
│ ├── LanguageBLL.cs
│ ├── LoggerBLL.cs
│ └── ExceptionBLL.cs
└── Properties
│ └── AssemblyInfo.cs
├── UI-Parcial
├── Script Base Parcial
│ └── script.sql
├── App.config
├── Properties
│ └── AssemblyInfo.cs
├── UI-Parcial.csproj
└── Program.cs
├── Controller
├── packages.config
├── Contracts
│ ├── ICreateController.cs
│ ├── IUpdateController.cs
│ ├── IRemoveController.cs
│ ├── IGetController.cs
│ └── ICRUDController.cs
├── Controllers
│ ├── ProductoUpdateController.cs
│ ├── AltaProductoController.cs
│ ├── ProductoGetController.cs
│ └── Validators
│ │ └── ViewValidatorAttribute.cs
├── ViewModels
│ ├── ProductoView.cs
│ └── Mapper
│ │ └── MapperHelper.cs
├── Properties
│ └── AssemblyInfo.cs
└── Controller.csproj
├── DomainModel
├── DomainParcial
│ ├── Deposito.cs
│ ├── Tienda.cs
│ ├── Usuario.cs
│ ├── Stock.cs
│ ├── DetalleMovimiento.cs
│ ├── Producto.cs
│ ├── Almacen.cs
│ ├── Movimiento.cs
│ └── Diagrama.cd
├── Customer.cs
├── Properties
│ └── AssemblyInfo.cs
└── DomainModel.csproj
├── Controllers
├── Contracts
│ ├── ICreateController.cs
│ ├── IRemoveController.cs
│ ├── IUpdateController.cs
│ ├── IGetController.cs
│ └── ICRUDController.cs
├── AltaProductoController.cs
├── ViewModels
│ └── ProductoView.cs
├── Properties
│ └── AssemblyInfo.cs
└── Controllers.csproj
├── BLL
├── Contracts
│ └── IGenericBusinessService.cs
├── BusinessExceptions
│ ├── ClienteMayorEdadException.cs
│ └── AlmacenSinStockException.cs
├── Properties
│ └── AssemblyInfo.cs
├── Services
│ ├── AlmacenService.cs
│ ├── CustomerService.cs
│ ├── ProductoService.cs
│ ├── MovimientoService.cs.back
│ └── MovimientoService.cs
└── BLL.csproj
├── .gitattributes
└── DemoBase.sln
/UI/I18n/idioma.en-GB:
--------------------------------------------------------------------------------
1 | hola=hello
2 | chau=bye
--------------------------------------------------------------------------------
/UI/I18n/idioma.es-AR:
--------------------------------------------------------------------------------
1 | hola=hola
2 | chau=chau
--------------------------------------------------------------------------------
/WinApp/I18n/idioma.en-GB:
--------------------------------------------------------------------------------
1 | hola=hello
2 | chau=bye
--------------------------------------------------------------------------------
/WinApp/I18n/idioma.es-AR:
--------------------------------------------------------------------------------
1 | hola=hola
2 | chau=chau
--------------------------------------------------------------------------------
/WinApp/img/excel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/excel.png
--------------------------------------------------------------------------------
/DAL/DataBase/demoDB.bak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/DAL/DataBase/demoDB.bak
--------------------------------------------------------------------------------
/WinApp/Resources/GUARDAR.GIF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/Resources/GUARDAR.GIF
--------------------------------------------------------------------------------
/WinApp/Resources/icoEdit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/Resources/icoEdit.png
--------------------------------------------------------------------------------
/WinApp/Resources/icoExit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/Resources/icoExit.png
--------------------------------------------------------------------------------
/WinApp/Resources/icoUndo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/Resources/icoUndo.png
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-más-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-más-16.png
--------------------------------------------------------------------------------
/WinApp/img/leonardo-da-vinci.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/leonardo-da-vinci.png
--------------------------------------------------------------------------------
/Services/DAL/DataBase/SecurityDB.bak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/Services/DAL/DataBase/SecurityDB.bak
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-apagar-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-apagar-16.png
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-búsqueda-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-búsqueda-16.png
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-editar-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-editar-16.png
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-eliminar-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-eliminar-16.png
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-volver-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-volver-16.png
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-comprobado-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-comprobado-16.png
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-reiniciar-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-reiniciar-16.png
--------------------------------------------------------------------------------
/UI-Parcial/Script Base Parcial/script.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/UI-Parcial/Script Base Parcial/script.sql
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-guardar-cerrar-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-guardar-cerrar-16.png
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-por-nueva-copia-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-por-nueva-copia-16.png
--------------------------------------------------------------------------------
/DAL/DataBase/Script_DemoDB_MarceloDiDeo_UOW.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/DAL/DataBase/Script_DemoDB_MarceloDiDeo_UOW.sql
--------------------------------------------------------------------------------
/WinApp/img/ICO/icons8-casilla-de-verificación-2-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gastonweingand/DemoBase/HEAD/WinApp/img/ICO/icons8-casilla-de-verificación-2-16.png
--------------------------------------------------------------------------------
/DAL/Contracts/UnitOfWork/IUnitOfWork.cs:
--------------------------------------------------------------------------------
1 | namespace DAL.Contracts.UnitOfWork
2 | {
3 | public interface IUnitOfWork
4 | {
5 | IUnitOfWorkAdapter Create();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Controller/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/DAL/Contracts/UnitOfWork/IUnitOfWorkAdapter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DAL.Contracts.UnitOfWork
4 | {
5 | public interface IUnitOfWorkAdapter : IDisposable
6 | {
7 | IUnitOfWorkRepository Repositories { get; }
8 | void SaveChanges();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/DomainModel/DomainParcial/Deposito.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 DomainModel.DomainParcial
8 | {
9 | public class Deposito : Almacen
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/DomainModel/DomainParcial/Tienda.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 DomainModel.DomainParcial
8 | {
9 | public class Tienda : Almacen
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/WinApp/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Controllers/Contracts/ICreateController.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 Controllers.Contracts
8 | {
9 | interface ICreateController
10 | {
11 | void Add(T obj);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Controllers/Contracts/IRemoveController.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 Controllers.Contracts
8 | {
9 | interface IRemoveController
10 | {
11 | void Remove(Guid id);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Controllers/Contracts/IUpdateController.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 Controllers.Contracts
8 | {
9 | interface IUpdateController
10 | {
11 | void Update(T obj);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Controller/Contracts/ICreateController.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 Controller.Contracts
8 | {
9 | internal interface ICreateController
10 | {
11 | void Add(T obj);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Controller/Contracts/IUpdateController.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 Controller.Contracts
8 | {
9 | internal interface IUpdateController
10 | {
11 | void Update(T obj);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Controller/Contracts/IRemoveController.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 Controller.Contracts
8 | {
9 | internal interface IRemoveController
10 | {
11 | void Remove(Guid id);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Controllers/Contracts/IGetController.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 Controllers.Contracts
8 | {
9 | interface IGetController
10 | {
11 | T Get(Guid id);
12 |
13 | IEnumerable GetAll();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Controller/Contracts/IGetController.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 Controller.Contracts
8 | {
9 | internal interface IGetController
10 | {
11 | IEnumerable GetAll();
12 |
13 | T GetById(Guid id);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DomainModel/DomainParcial/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 DomainModel.DomainParcial
8 | {
9 | public class Usuario
10 | {
11 | public Guid Id { get; set; }
12 | public string Nombre { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Controller/Contracts/ICRUDController.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 Controller.Contracts
8 | {
9 | internal interface ICRUDController : ICreateController, IUpdateController, IRemoveController, IGetController
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/DomainModel/DomainParcial/Stock.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 DomainModel.DomainParcial
8 | {
9 | public class Stock
10 | {
11 | public Producto Producto { get; set; }
12 |
13 | public decimal Cantidad { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Services/DomainModel/Security/Patente.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 Services.DomainModel.Security
8 | {
9 | internal class Patente
10 | {
11 | public string FormName { get; set; }
12 |
13 | public string MenuItemName { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DomainModel/DomainParcial/DetalleMovimiento.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 DomainModel.DomainParcial
8 | {
9 | public class DetalleMovimiento
10 | {
11 | public Producto Producto { get; set; }
12 |
13 | public decimal Cantidad { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Controllers/Contracts/ICRUDController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 |
8 | namespace Controllers.Contracts
9 | {
10 | internal interface ICRUDController : IUpdateController, ICreateController, IGetController, IRemoveController
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Services/DAL/Contracts/IJoinRepository.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 Services.DAL.Contracts
8 | {
9 | internal interface IJoinRepository
10 | {
11 | void Delete(T obj);
12 |
13 | void GetChildren(T obj);
14 |
15 | void Add(T obj);
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Services/Services/LanguageManager.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 Services.Services
8 | {
9 | internal static class LanguageManager
10 | {
11 | public static string Translate(string word)
12 | {
13 | return BLL.LanguageBLL.Translate(word);
14 | }
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DAL/Contracts/IAdapter.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 DAL.Contracts
8 | {
9 | internal interface IAdapter
10 | {
11 | T Adapt(object[] values);
12 | }
13 |
14 |
15 | //interface Mapper
16 | //{
17 | // T ConvertToA(P obj);
18 | // P ConvertToB(T obj);
19 | //}
20 | }
21 |
--------------------------------------------------------------------------------
/Services/Services/Extensions/StringExtension.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 Services.Services.Extensions
8 | {
9 | public static class StringExtension
10 | {
11 | public static string Translate(this string word)
12 | {
13 | return BLL.LanguageBLL.Translate(word);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Services/DAL/Contracts/IAdapter.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 Services.DAL.Contracts
8 | {
9 | internal interface IAdapter
10 | {
11 | T Adapt(object[] values);
12 | }
13 |
14 |
15 | //interface Mapper
16 | //{
17 | // T ConvertToA(P obj);
18 | // P ConvertToB(T obj);
19 | //}
20 | }
21 |
--------------------------------------------------------------------------------
/Services/Services/ExceptionService.cs:
--------------------------------------------------------------------------------
1 | using Services.BLL;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Services.Services
9 | {
10 | internal static class ExceptionService
11 | {
12 | public static void Handle(Exception ex, object sender)
13 | {
14 | BLL.ExceptionBLL.Handle(ex, sender);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Services/Services/Extensions/ExceptionExtension.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 Services.Services.Extensions
8 | {
9 | public static class ExceptionExtension
10 | {
11 | public static void Handle(this Exception ex, object sender)
12 | {
13 | BLL.ExceptionBLL.Handle(ex, sender);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Services/DomainModel/Security/Familia.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 Services.DomainModel.Security
8 | {
9 | internal class Familia
10 | {
11 | public string Nombre { get; set; }
12 |
13 | public List Patentes { get; set; }
14 |
15 | public List Familias { get; set; }
16 |
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/DAL/Contracts/IGenericRepository.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 DAL.Contracts
8 | {
9 | public interface IGenericRepository
10 | {
11 | void Add(T obj);
12 |
13 | void Update(T obj);
14 |
15 | void Delete(Guid id);
16 |
17 | IEnumerable SelectAll();
18 |
19 | T SelectOne(Guid id);
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/BLL/Contracts/IGenericBusinessService.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 BLL.Contracts
8 | {
9 | internal interface IGenericBusinessService
10 | {
11 | void Add(T obj);
12 |
13 | void Update(T obj);
14 |
15 | void Delete(Guid id);
16 |
17 | IEnumerable SelectAll();
18 |
19 | T SelectOne(Guid id);
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DomainModel/DomainParcial/Producto.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 DomainModel.DomainParcial
8 | {
9 | public class Producto
10 | {
11 | public Guid Id { get; set; }
12 |
13 | public string Codigo { get; set; }
14 |
15 | public string Descripcion { get; set; }
16 |
17 | public decimal Precio { get; set; }
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/UI-Parcial/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Services/Services/LoggerService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics.Tracing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Services.Services
9 | {
10 | public static class LoggerService
11 | {
12 | public static void WriteLog(string message, EventLevel level, string user)
13 | {
14 | BLL.LoggerBLL.WriteLog(message, level, user);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Services/DAL/Contracts/IGenericRepository.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 Services.DAL.Contracts
8 | {
9 | internal interface IGenericRepository
10 | {
11 | void Add(T obj);
12 |
13 | void Update(T obj);
14 |
15 | void Delete(Guid id);
16 |
17 | IEnumerable SelectAll();
18 |
19 | T SelectOne(Guid id);
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Services/DAL/Factory/ServiceFactory.cs:
--------------------------------------------------------------------------------
1 | using Services.DAL.Implementations;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Services.DAL.Factory
9 | {
10 | internal static class ServiceFactory
11 | {
12 | public static LanguageRepository LanguageRepository { get; private set; }
13 |
14 | public static LoggerRepository LoggerRepository { get; private set; }
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Controllers/AltaProductoController.cs:
--------------------------------------------------------------------------------
1 | using Controllers.Contracts;
2 | using Controllers.ViewModels;
3 | using DomainModel.DomainParcial;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Controllers
11 | {
12 | public class AltaProductoController : ICreateController
13 | {
14 | public void Add(ProductoView obj)
15 | {
16 |
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/DAL/Contracts/UnitOfWork/IUnitOfWorkRepository.cs:
--------------------------------------------------------------------------------
1 | using DomainModel;
2 | using DomainModel.DomainParcial;
3 |
4 | namespace DAL.Contracts.UnitOfWork
5 | {
6 | public interface IUnitOfWorkRepository
7 | {
8 | IGenericRepository CustomerRepository { get; }
9 |
10 | IGenericRepository AlmacenRepository { get; }
11 |
12 | IGenericRepository MovimientoRepository { get; }
13 |
14 | IGenericRepository ProductoRepository { get; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Controllers/ViewModels/ProductoView.cs:
--------------------------------------------------------------------------------
1 | using DomainModel.DomainParcial;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Controllers.ViewModels
9 | {
10 | public class ProductoView
11 | {
12 | public Guid Id { get; set; }
13 |
14 | public string Codigo { get; set; }
15 |
16 | public string Descripcion { get; set; }
17 |
18 | public decimal Precio { get; set; }
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/BLL/BusinessExceptions/ClienteMayorEdadException.cs:
--------------------------------------------------------------------------------
1 | using Services.Services.Extensions;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace BLL.BusinessExceptions
9 | {
10 | public class ClienteMayorEdadException : Exception
11 | {
12 | public ClienteMayorEdadException():base("El cliente es menor de edad!".Translate())
13 | {
14 | base.HelpLink = "https://wiki.com";
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DAL/Implementations/SqlServer/UnitOfWork/UnitOfWorkSqlServer.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts.UnitOfWork;
2 | using DAL.Tools;
3 |
4 | namespace DAL.Implementations.SqlServer.UnitOfWork
5 | {
6 | public class UnitOfWorkSqlServer : IUnitOfWork
7 | {
8 | string connectionString = SqlHelper.conString;
9 |
10 | public UnitOfWorkSqlServer()
11 | {
12 | }
13 |
14 | public IUnitOfWorkAdapter Create()
15 | {
16 | return new UnitOfWorkSqlServerAdapter(connectionString);
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/BLL/BusinessExceptions/AlmacenSinStockException.cs:
--------------------------------------------------------------------------------
1 | using DomainModel.DomainParcial;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace BLL.BusinessExceptions
9 | {
10 | public class AlmacenSinStockException : Exception
11 | {
12 | public Producto Producto { get; set; }
13 | public AlmacenSinStockException(Producto producto) : base("El depósito no tiene stock suficiente...")
14 | {
15 | Producto = producto;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Services/DomainModel/Exceptions/WordNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using Services.Services.Extensions;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Services.DomainModel.Exceptions
9 | {
10 | internal class WordNotFoundException : Exception
11 | {
12 | public WordNotFoundException(string message): base (message)
13 | {
14 |
15 | }
16 | public WordNotFoundException(): base("La palabra no fue encontrada")
17 | {
18 |
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/DomainModel/Customer.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 DomainModel
8 | {
9 | public class Customer
10 | {
11 | public Customer()
12 | {
13 | this.IdCustomer = Guid.NewGuid();
14 | }
15 | public String FirstName { get; set; }
16 |
17 | public String LastName { get; set; }
18 |
19 | public DateTime DateBirth { get; set; }
20 |
21 | public String Doc { get; set; }
22 |
23 | public Guid IdCustomer { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/DomainModel/DomainParcial/Almacen.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 DomainModel.DomainParcial
8 | {
9 | public class Almacen
10 | {
11 | public Guid Id { get; set; }
12 |
13 | public string Nombre { get; set; }
14 |
15 | public string Localidad { get; set; }
16 |
17 | public string Provincia { get; set; }
18 |
19 | public List Stock { get; set; }
20 |
21 | public Almacen()
22 | {
23 | Stock = new List();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/WinApp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace WinApp
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | frmMenuPrincipal oFrmMenuPrincipal = new frmMenuPrincipal();
20 | oFrmMenuPrincipal.Show();
21 | Application.Run();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Controller/Controllers/ProductoUpdateController.cs:
--------------------------------------------------------------------------------
1 | using Controller.Contracts;
2 | using Controller.ViewModels;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using BLL.Services;
9 | using DomainModel.DomainParcial;
10 | using Controller.ViewModels.Helpers;
11 | using Controllers.Validators;
12 |
13 | namespace Controller.Controllers
14 | {
15 | public class ProductoUpdateController : IUpdateController
16 | {
17 | [ViewValidator]
18 | public void Update(ProductoView obj)
19 | {
20 | var productoDTO = MapperHelper.GetMapper().Map(obj);
21 | ProductoService.Current.Update(productoDTO);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Controller/Controllers/AltaProductoController.cs:
--------------------------------------------------------------------------------
1 | using Controller.Contracts;
2 | using Controller.ViewModels;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using BLL.Services;
9 | using DomainModel.DomainParcial;
10 | using Controller.ViewModels.Helpers;
11 | using Controllers.Validators;
12 |
13 | namespace Controller.Controllers
14 | {
15 | public class AltaProductoController : ICreateController
16 | {
17 | [ViewValidator]
18 | public void Add(ProductoView obj)
19 | {
20 | var productoDTO = MapperHelper.GetMapper().Map(obj);
21 | ProductoService.Current.Add(productoDTO);
22 | }
23 |
24 |
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/DomainModel/DomainParcial/Movimiento.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 DomainModel.DomainParcial
8 | {
9 | public class Movimiento
10 | {
11 | public Guid Id { get; set; }
12 |
13 | public int Numero { get; set; }
14 | public DateTime Fecha { get; set; }
15 |
16 | public Deposito Origen { get; set; }
17 |
18 | public Almacen Destino { get; set; }
19 |
20 | public Usuario Usuario { get => default; set { } }
21 |
22 | public List DetalleMovimientos { get; set; }
23 |
24 |
25 | public Movimiento()
26 | {
27 | DetalleMovimientos = new List();
28 | }
29 | }
30 | }
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Services/DomainModel/Security/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 Services.DomainModel.Security
8 | {
9 | internal class Usuario
10 | {
11 | public string Nombre { get; set; }
12 |
13 | public string Password { get; set; }
14 |
15 | public List Familias { get; set; }
16 |
17 | public List Patentes { get; set; }
18 |
19 |
20 | ///
21 | /// Retornar las patentes únicas de acuerdo a mi modelo
22 | /// (Para el armado del menú)
23 | ///
24 | ///
25 | public List GetPatentesAll()
26 | {
27 | return null;
28 | }
29 |
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Services/Services/CryptographyService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Security.Cryptography;
7 |
8 | namespace Services.Services
9 | {
10 | public static class CryptographyService
11 | {
12 | public static string HashPassword(string textPlainPass)
13 | {
14 | StringBuilder sb = new StringBuilder();
15 |
16 | using (MD5 md5 = MD5.Create())
17 | {
18 | byte[] retVal = md5.ComputeHash(Encoding.Unicode.GetBytes(textPlainPass));
19 | for (int i = 0; i < retVal.Length; i++)
20 | {
21 | sb.Append(retVal[i].ToString("x2"));
22 | }
23 | }
24 | return sb.ToString();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Services/BLL/LanguageBLL.cs:
--------------------------------------------------------------------------------
1 | using Services.DAL.Factory;
2 | using Services.DAL.Implementations;
3 | using Services.DomainModel.Exceptions;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Services.BLL
11 | {
12 | internal static class LanguageBLL
13 | {
14 | //Aplicar reglas de negocio:
15 | //Exception, null, bool
16 | public static string Translate(string word)
17 | {
18 | try
19 | {
20 | return ServiceFactory.LanguageRepository.Find(word);
21 | }
22 | catch (WordNotFoundException)
23 | {
24 | ServiceFactory.LanguageRepository.WriteNewWord(word, String.Empty);
25 | return word;
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/DAL/DemoSingleton.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 DAL
8 | {
9 |
10 | internal sealed class DemoSingleton
11 | {
12 | #region Singleton
13 | private readonly static DemoSingleton _instance = new DemoSingleton();
14 |
15 | public static DemoSingleton Current
16 | {
17 | get
18 | {
19 | return _instance;
20 | }
21 | }
22 |
23 | private DemoSingleton()
24 | {
25 | //Implent here the initialization of your singleton
26 | }
27 | #endregion
28 |
29 | public String Path { get; set; }
30 |
31 | public int Sumar(int a, int b)
32 | {
33 | return a + b;
34 | }
35 | }
36 |
37 | internal static class DemoStatic
38 | {
39 | public static int Nro { get; set; }
40 |
41 | public static String Path { get; set; }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Services/BLL/LoggerBLL.cs:
--------------------------------------------------------------------------------
1 | using Services.DAL.Factory;
2 | using Services.DAL.Implementations;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Diagnostics.Tracing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace Services.BLL
11 | {
12 | internal static class LoggerBLL
13 | {
14 |
15 | public static void WriteLog(string message, EventLevel level, string user)
16 | {
17 | ServiceFactory.LoggerRepository.WriteLog(message, level, user);
18 |
19 | //Definir acá las políticas de escritura..
20 | //switch(level)
21 | //{
22 | // case EventLevel.Critical:
23 | // //Política de manejo de errores...
24 |
25 | // break;
26 |
27 | // case EventLevel.Warning:
28 | // break;
29 | //}
30 |
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/UI/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/DAL/Implementations/Memory/ProductoRepository.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts;
2 | using DomainModel.DomainParcial;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace DAL.Implementations.Memory
10 | {
11 | public class ProductoRepository : IGenericRepository
12 | {
13 | public void Add(Producto obj)
14 | {
15 | throw new NotImplementedException();
16 | }
17 |
18 | public void Delete(Guid id)
19 | {
20 | throw new NotImplementedException();
21 | }
22 |
23 | public IEnumerable SelectAll()
24 | {
25 | throw new NotImplementedException();
26 | }
27 |
28 | public Producto SelectOne(Guid id)
29 | {
30 | throw new NotImplementedException();
31 | }
32 |
33 | public void Update(Producto obj)
34 | {
35 | throw new NotImplementedException();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/DAL/Implementations/PlainText/CustomerRepository.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts;
2 | using DomainModel;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace DAL.Implementations.PlainText
10 | {
11 | internal class CustomerRepository : IGenericRepository
12 | {
13 | public void Add(Customer obj)
14 | {
15 | throw new NotImplementedException();
16 | }
17 |
18 | public void Delete(Guid id)
19 | {
20 | throw new NotImplementedException();
21 | }
22 |
23 | public IEnumerable SelectAll()
24 | {
25 | throw new NotImplementedException();
26 | }
27 |
28 | public Customer SelectOne(Guid id)
29 | {
30 | Console.WriteLine("Llamando al selectOne de PlainText");
31 | return null;
32 | }
33 |
34 | public void Update(Customer obj)
35 | {
36 | throw new NotImplementedException();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/DAL/Implementations/Memory/MovimientoRepository.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using DAL.Contracts;
7 | using DomainModel.DomainParcial;
8 |
9 | namespace DAL.Implementations.Memory
10 | {
11 | public class MovimientoRepository : IGenericRepository
12 | {
13 | List listadoMovimientos = new List();
14 |
15 | public void Add(Movimiento obj)
16 | {
17 | listadoMovimientos.Add(obj);
18 | }
19 |
20 | public void Delete(Guid id)
21 | {
22 | throw new NotImplementedException();
23 | }
24 |
25 | public IEnumerable SelectAll()
26 | {
27 | return listadoMovimientos;
28 | }
29 |
30 | public Movimiento SelectOne(Guid id)
31 | {
32 | throw new NotImplementedException();
33 | }
34 |
35 | public void Update(Movimiento obj)
36 | {
37 | throw new NotImplementedException();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/WinApp/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Services/Services/LoginService.cs:
--------------------------------------------------------------------------------
1 | using Services.DomainModel.Security.Composite;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Services.Services
9 | {
10 | public static class LoginService
11 | {
12 | public static bool Login(Usuario usuario)
13 | {
14 | return false;
15 | }
16 | public static Patente SelectOnePatente(Guid id)
17 | {
18 | return DAL.Implementations.PatenteRepository.Current.SelectOne(id);
19 | }
20 |
21 | public static Usuario SelectOneUsuario(Guid id)
22 | {
23 | return DAL.Implementations.UsuarioRepository.Current.SelectOne(id);
24 | }
25 |
26 | public static IEnumerable SelectAllPatentes()
27 | {
28 | return DAL.Implementations.PatenteRepository.Current.SelectAll();
29 | }
30 |
31 | public static Familia SelectOneFamilia(Guid id)
32 | {
33 | return DAL.Implementations.FamiliaRepository.Current.SelectOne(id);
34 | }
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/DAL/Implementations/SqlServer/UnitOfWork/UnitOfWorkSqlServerRepository.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts;
2 | using DAL.Contracts.UnitOfWork;
3 | using DomainModel;
4 | using DomainModel.DomainParcial;
5 | using System.Data.SqlClient;
6 |
7 | namespace DAL.Implementations.SqlServer.UnitOfWork
8 | {
9 | public class UnitOfWorkSqlServerRepository : IUnitOfWorkRepository
10 | {
11 | public IGenericRepository CustomerRepository { get; }
12 |
13 | public IGenericRepository AlmacenRepository { get; }
14 |
15 | public IGenericRepository MovimientoRepository { get; }
16 |
17 | public IGenericRepository ProductoRepository { get; }
18 |
19 | public UnitOfWorkSqlServerRepository(SqlConnection context, SqlTransaction transaction)
20 | {
21 | CustomerRepository = new CustomerRepository();
22 |
23 | AlmacenRepository = new AlmacenRepository(context, transaction);
24 |
25 | MovimientoRepository = new MovimientoRepository(context, transaction);
26 |
27 | ProductoRepository = new ProductoRepository(context, transaction);
28 | }
29 | }
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/WinApp/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 |
12 | namespace WinApp.Properties
13 | {
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
17 | {
18 |
19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
20 |
21 | public static Settings Default
22 | {
23 | get
24 | {
25 | return defaultInstance;
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/DAL/Implementations/SqlServer/AlmacenRepository.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Data.SqlClient;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using DAL.Contracts;
8 | using DomainModel.DomainParcial;
9 |
10 | namespace DAL.Implementations.SqlServer
11 | {
12 | internal class AlmacenRepository : Repository, IGenericRepository
13 | {
14 | public AlmacenRepository(SqlConnection context, SqlTransaction _transaction)
15 | : base(context, _transaction)
16 | {
17 |
18 | }
19 | public void Add(Almacen obj)
20 | {
21 | throw new NotImplementedException();
22 | }
23 |
24 | public void Delete(Guid id)
25 | {
26 | throw new NotImplementedException();
27 | }
28 |
29 | public IEnumerable SelectAll()
30 | {
31 | throw new NotImplementedException();
32 | }
33 |
34 | public Almacen SelectOne(Guid id)
35 | {
36 | throw new NotImplementedException();
37 | }
38 |
39 | public void Update(Almacen obj)
40 | {
41 | throw new NotImplementedException();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/DAL/Implementations/SqlServer/MovimientoRepository.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts;
2 | using DomainModel.DomainParcial;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Data.SqlClient;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace DAL.Implementations.SqlServer
11 | {
12 | internal class MovimientoRepository : Repository, IGenericRepository
13 | {
14 | public MovimientoRepository(SqlConnection context, SqlTransaction _transaction)
15 | : base(context, _transaction)
16 | {
17 |
18 | }
19 | public void Add(Movimiento obj)
20 | {
21 | throw new NotImplementedException();
22 | }
23 |
24 | public void Delete(Guid id)
25 | {
26 | throw new NotImplementedException();
27 | }
28 |
29 | public IEnumerable SelectAll()
30 | {
31 | throw new NotImplementedException();
32 | }
33 |
34 | public Movimiento SelectOne(Guid id)
35 | {
36 | throw new NotImplementedException();
37 | }
38 |
39 | public void Update(Movimiento obj)
40 | {
41 | throw new NotImplementedException();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Services/DAL/Implementations/Adapter/PatenteAdapter.cs:
--------------------------------------------------------------------------------
1 | using Services.DAL.Contracts;
2 | using Services.DomainModel.Security.Composite;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Services.DAL.Implementations.Adapter
10 | {
11 |
12 | public sealed class PatenteAdapter : IAdapter
13 | {
14 | #region Singleton
15 | private readonly static PatenteAdapter _instance = new PatenteAdapter();
16 |
17 | public static PatenteAdapter Current
18 | {
19 | get
20 | {
21 | return _instance;
22 | }
23 | }
24 |
25 | private PatenteAdapter()
26 | {
27 | //Implement here the initialization code
28 | }
29 | #endregion
30 |
31 | public Patente Adapt(object[] values)
32 | {
33 | //Hidratar el objeto patente
34 | Patente patente = new Patente()
35 | {
36 | IdComponent = Guid.Parse(values[0].ToString()),
37 | MenuItemName = values[1].ToString(),
38 | FormName = values[2].ToString()
39 | };
40 | return patente;
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/DAL/Implementations/SqlServer/Adapter/ProductoAdapter.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts;
2 | using DomainModel.DomainParcial;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace DAL.Implementations.SqlServer.Adapter
10 | {
11 |
12 | public sealed class ProductoAdapter : IAdapter
13 | {
14 | #region Singleton
15 | private readonly static ProductoAdapter _instance = new ProductoAdapter();
16 |
17 | public static ProductoAdapter Current
18 | {
19 | get
20 | {
21 | return _instance;
22 | }
23 | }
24 |
25 | private ProductoAdapter()
26 | {
27 | //Implement here the initialization code
28 | }
29 | #endregion
30 |
31 | public Producto Adapt(object[] values)
32 | {
33 | Producto customer = new Producto()
34 | {
35 |
36 | Id = Guid.Parse(values[0].ToString()),
37 | Codigo = values[1].ToString(),
38 | Descripcion = values[2].ToString(),
39 | Precio = decimal.Parse(values[3].ToString()),
40 | };
41 | return customer;
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/Controller/ViewModels/ProductoView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.ComponentModel.DataAnnotations;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Controller.ViewModels
10 | {
11 | public class ProductoView
12 | {
13 | //[Browsable(false)]
14 | public Guid Id { get; set; }
15 |
16 | [Required(ErrorMessage = "Código es requerido")]
17 | public string Codigo { get; set; }
18 |
19 | [Required(ErrorMessage = "Descripcion es requerido")]
20 | [StringLength(maximumLength: 20, MinimumLength =5 , ErrorMessage = "La descripción tiene entre 5 y 20 caracteres")]
21 | public string Descripcion { get; set; }
22 |
23 | public decimal Precio { get; set; }
24 |
25 | public string DescripcionLarga
26 | {
27 | get
28 | {
29 | return $"{Codigo}: {Descripcion}";
30 | }
31 | }
32 |
33 |
34 | //[Browsable(false)] //Atributo que no se muestra como propiedad en objetos de ventanas...
35 | //[Required(ErrorMessage = "Nombre es requerido")]
36 | //[StringLength(maximumLength: 8, MinimumLength = 6, ErrorMessage = "El dni no contiene el formato necesario: 6-8")]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/DAL/Implementations/SqlServer/UnitOfWork/UnitOfWorkSqlServerAdapter.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts.UnitOfWork;
2 | using System.Data.SqlClient;
3 |
4 | namespace DAL.Implementations.SqlServer.UnitOfWork
5 | {
6 | public class UnitOfWorkSqlServerAdapter : IUnitOfWorkAdapter
7 | {
8 | private SqlConnection _context { get; set; }
9 | private SqlTransaction _transaction { get; set; }
10 | public IUnitOfWorkRepository Repositories { get; set; }
11 |
12 | public UnitOfWorkSqlServerAdapter(string connectionString)
13 | {
14 | _context = new SqlConnection(connectionString);
15 | _context.Open();
16 |
17 | _transaction = _context.BeginTransaction();
18 |
19 | Repositories = new UnitOfWorkSqlServerRepository(_context, _transaction);
20 | }
21 |
22 | public void Dispose()
23 | {
24 | if (_transaction != null)
25 | {
26 | _transaction.Dispose();
27 |
28 | }
29 |
30 | if (_context != null)
31 | {
32 | _context.Close();
33 | _context.Dispose();
34 | }
35 |
36 | Repositories = null;
37 | }
38 |
39 | public void SaveChanges()
40 | {
41 | _transaction.Commit();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Services/DomainModel/Security/Composite/Patente.cs:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////
2 | // Patente.cs
3 | // Implementation of the Class Patente
4 | // Generated by Enterprise Architect
5 | // Created on: 05-may.-2022 21:16:55
6 | // Original author: gasto
7 | ///////////////////////////////////////////////////////////
8 |
9 | using System;
10 | using System.Collections.Generic;
11 | using System.Text;
12 | using System.IO;
13 |
14 | namespace Services.DomainModel.Security.Composite {
15 | ///
16 | /// This class (a) represents leaf objects in the composition, and (b) defines
17 | /// behaviour for primitive objects in the composition.
18 | ///
19 | public class Patente : Component {
20 |
21 | public string FormName { get; set; }
22 |
23 | public string MenuItemName { get; set; }
24 |
25 | public override void Add(Component component)
26 | {
27 | throw new Exception("No se pueden agregar elementos sobre primitivos");
28 | }
29 |
30 | public override int ChildrenCount()
31 | {
32 | return 0;
33 | }
34 |
35 | public override void Remove(Component component)
36 | {
37 | throw new Exception("No se pueden quitar elementos sobre primitivos");
38 | }
39 | }//end Patente
40 |
41 | }//end namespace Composite
--------------------------------------------------------------------------------
/DAL/Implementations/SqlServer/Adapter/CustomerAdapter.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts;
2 | using DomainModel;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace DAL.Implementations.SqlServer.Adapter
10 | {
11 |
12 | internal sealed class CustomerAdapter : IAdapter
13 | {
14 | #region Singleton
15 | private readonly static CustomerAdapter _instance = new CustomerAdapter();
16 |
17 | public static CustomerAdapter Current
18 | {
19 | get
20 | {
21 | return _instance;
22 | }
23 | }
24 |
25 | private CustomerAdapter()
26 | {
27 | }
28 |
29 | #endregion
30 |
31 | public Customer Adapt(object[] values)
32 | {
33 | //Hidratar el objeto customer
34 | Customer customer = new Customer()
35 | {
36 | IdCustomer = Guid.Parse(values[0].ToString()),
37 | FirstName = values[1].ToString(),
38 | LastName = values[2].ToString(),
39 | DateBirth = DateTime.Parse(values[3].ToString()),
40 | Doc = values[4].ToString()
41 | };
42 | return customer;
43 | }
44 | //Implement here the initialization code
45 | }
46 | }
--------------------------------------------------------------------------------
/WinApp/frmProductosALl.cs:
--------------------------------------------------------------------------------
1 | using Controller.Controllers;
2 | using Controller.ViewModels;
3 | using Services.Services;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.ComponentModel;
7 | using System.Data;
8 | using System.Drawing;
9 | using System.Linq;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 | using System.Windows.Forms;
13 |
14 |
15 | namespace WinApp
16 | {
17 | public partial class frmProductosALl : Form
18 | {
19 | private ProductoGetController controller = new ProductoGetController();
20 | public frmProductosALl()
21 | {
22 | InitializeComponent();
23 | }
24 |
25 | private void frmProductosALl_Load(object sender, EventArgs e)
26 | {
27 | try
28 | {
29 | ProductoView producto = new ProductoView();
30 | dataGridView1.DataSource= controller.GetAll();
31 | }
32 | catch (Exception ex)
33 | {
34 | MessageBox.Show(ex.Message);
35 | }
36 | }
37 |
38 | private void button1_Click(object sender, EventArgs e)
39 | {
40 | ExportarAExcel oExportarAExcel = new ExportarAExcel();
41 | oExportarAExcel.NombredeArchivoDefault = "Productos";
42 | oExportarAExcel.grdParam = dataGridView1;
43 | oExportarAExcel.guardar();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Services/DAL/Implementations/Adapter/FamiliaAdapter.cs:
--------------------------------------------------------------------------------
1 | using Services.DAL.Contracts;
2 | using Services.DomainModel.Security.Composite;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Services.DAL.Implementations.Adapter
10 | {
11 |
12 | public sealed class FamiliaAdapter : IAdapter
13 | {
14 | #region Singleton
15 | private readonly static FamiliaAdapter _instance = new FamiliaAdapter();
16 |
17 | public static FamiliaAdapter Current
18 | {
19 | get
20 | {
21 | return _instance;
22 | }
23 | }
24 |
25 | private FamiliaAdapter()
26 | {
27 | //Implement here the initialization code
28 | }
29 | #endregion
30 | public Familia Adapt(object[] values)
31 | {
32 | //Hidratar el objeto familia -> Nivel 1
33 | Familia familia = new Familia()
34 | {
35 | IdComponent = Guid.Parse(values[0].ToString()),
36 | Nombre = values[1].ToString()
37 | };
38 |
39 |
40 | //Nivel 2 de hidratación...
41 | FamiliaFamiliaRepository.Current.GetChildren(familia);
42 | FamiliaPatenteRepository.Current.GetChildren(familia);
43 |
44 | return familia;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Services/DAL/Implementations/Adapter/UsuarioAdapter.cs:
--------------------------------------------------------------------------------
1 | using Services.DAL.Contracts;
2 | using Services.DomainModel.Security.Composite;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Services.DAL.Implementations.Adapter
10 | {
11 |
12 |
13 | public sealed class UsuarioAdapter : IAdapter
14 | {
15 | #region Singleton
16 | private readonly static UsuarioAdapter _instance = new UsuarioAdapter ();
17 |
18 | public static UsuarioAdapter Current
19 | {
20 | get
21 | {
22 | return _instance;
23 | }
24 | }
25 |
26 | private UsuarioAdapter ()
27 | {
28 | //Implement here the initialization code
29 | }
30 | #endregion
31 | public Usuario Adapt(object[] values)
32 | {
33 | //Hidratar el objeto familia -> Nivel 1
34 | /*Usuario usuario = new Usuario()
35 | {
36 | idUsuario = Guid.Parse(values[0].ToString()),
37 | Nombre = values[1].ToString()
38 | };
39 |
40 |
41 | //Nivel 2 de hidratación...
42 | UsuarioFamiliaRepository.Current.GetChildren(usuario);
43 | UsuarioPatenteRepository.Current.GetChildren(usuario);
44 |
45 | return usuario;*/
46 | return null;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/WinApp/frmAltaProducto.cs:
--------------------------------------------------------------------------------
1 | using Controller.Controllers;
2 | using Controller.ViewModels;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.ComponentModel;
6 | using System.Data;
7 | using System.Drawing;
8 | using System.Linq;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 | using System.Windows.Forms;
12 |
13 | namespace WinApp
14 | {
15 | public partial class frmAltaProducto : Form
16 | {
17 | private AltaProductoController controller = new AltaProductoController();
18 | public frmAltaProducto()
19 | {
20 | InitializeComponent();
21 | }
22 |
23 | private void btnCrearProducto_Click(object sender, EventArgs e)
24 | {
25 | try
26 | {
27 | ProductoView producto = new ProductoView();
28 | producto.Codigo = txtCodigo.Text;
29 | producto.Descripcion = txtDescripcion.Text;
30 | producto.Precio = Convert.ToDecimal(txtPrecio.Text);
31 |
32 | controller.Add(producto);
33 | }
34 | catch (Exception ex)
35 | {
36 | MessageBox.Show(ex.Message);
37 | }
38 | }
39 |
40 | private void frmAltaProducto_Load(object sender, EventArgs e)
41 | {
42 | label1.Text = "Codigo";
43 | label2.Text = "Descripción";
44 | label3.Text = "Precio";
45 |
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/DAL/Factories/ApplicationFactory.cs:
--------------------------------------------------------------------------------
1 | using DAL.Contracts;
2 | using DAL.Contracts.UnitOfWork;
3 | using DomainModel;
4 | using DomainModel.DomainParcial;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Configuration;
8 | using System.Linq;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 |
12 | namespace DAL.Factories
13 | {
14 | public static class ApplicationFactory
15 | {
16 | private static string backendDS = ConfigurationManager.AppSettings["BackendDS"];
17 |
18 | ///
19 | /// Actualizo todos los repositorios a patrón UnitOfWork ya que todos los repositorios estarán contenidos
20 | /// dentro de un contexto transaccional
21 | ///
22 | public static IUnitOfWork UnitOfWork { get; private set; }
23 |
24 | static ApplicationFactory()
25 | {
26 | if (backendDS == "sqlserver")
27 | {
28 | UnitOfWork = new Implementations.SqlServer.UnitOfWork.UnitOfWorkSqlServer();
29 | }
30 | else if (backendDS == "plaintext")
31 | {
32 | //CustomerRepository = new DAL.Implementations.PlainText.CustomerRepository();
33 | }
34 | else if (backendDS == "memory")
35 | {
36 | //AlmacenRepository = new DAL.Implementations.Memory.AlmacenRepository();
37 | //MovimientoRepository = new DAL.Implementations.Memory.MovimientoRepository();
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/DAL/Tools/Snippets/singleton.snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Expansion
7 |
8 | Singleton
9 | singleton
10 |
11 | Creates a Singleton Class following the discussion on that post of mine:
12 | http://blogs.ugidotnet.org/piyo/archive/2005/09/14/Singleton_C_NET.aspx
13 |
14 | Simone Chiaretta
15 |
16 |
17 |
18 |
19 | className
20 | Here the name of your singleton class
21 | Singleton
22 |
23 |
24 |
25 |
26 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Services/DAL/Implementations/UsuarioRepository.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Services.DAL.Contracts;
7 | using Services.DomainModel.Security.Composite;
8 |
9 | namespace Services.DAL.Implementations
10 | {
11 | internal sealed class UsuarioRepository : IGenericRepository
12 | {
13 | #region Singleton
14 | private readonly static UsuarioRepository _instance = new UsuarioRepository();
15 |
16 | public static UsuarioRepository Current
17 | {
18 | get
19 | {
20 | return _instance;
21 | }
22 | }
23 |
24 | private UsuarioRepository()
25 | {
26 | //Implement here the initialization code
27 | }
28 | #endregion
29 | public void Add(Usuario obj)
30 | {
31 | throw new NotImplementedException();
32 | }
33 |
34 | public void Delete(Guid id)
35 | {
36 | throw new NotImplementedException();
37 | }
38 |
39 | public IEnumerable SelectAll()
40 | {
41 | throw new NotImplementedException();
42 | }
43 |
44 | public Usuario SelectOne(Guid id)
45 | {
46 | throw new NotImplementedException();
47 | }
48 |
49 | public void Update(Usuario obj)
50 | {
51 | throw new NotImplementedException();
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/BLL/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("BLL")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HP Inc.")]
12 | [assembly: AssemblyProduct("BLL")]
13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2022")]
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("2b83ad36-6866-467d-8d40-6d2c032cdb93")]
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 |
--------------------------------------------------------------------------------
/BLL/Services/AlmacenService.cs:
--------------------------------------------------------------------------------
1 | using BLL.Contracts;
2 | using DAL.Factories;
3 | using DomainModel.DomainParcial;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace BLL.Services
11 | {
12 |
13 | public sealed class AlmacenService : IGenericBusinessService
14 | {
15 | #region Singleton
16 | private readonly static AlmacenService _instance = new AlmacenService();
17 |
18 | public static AlmacenService Current
19 | {
20 | get
21 | {
22 | return _instance;
23 | }
24 | }
25 |
26 | private AlmacenService()
27 | {
28 | //Implement here the initialization code
29 | }
30 | #endregion
31 |
32 | public void Add(Almacen obj)
33 | {
34 | throw new NotImplementedException();
35 | }
36 |
37 | public void Update(Almacen obj)
38 | {
39 | throw new NotImplementedException();
40 | }
41 |
42 | public void Delete(Guid id)
43 | {
44 | throw new NotImplementedException();
45 | }
46 |
47 | public IEnumerable SelectAll()
48 | {
49 | return ApplicationFactory.UnitOfWork.Create().Repositories.AlmacenRepository.SelectAll();
50 | }
51 |
52 | public Almacen SelectOne(Guid id)
53 | {
54 | throw new NotImplementedException();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/WinApp/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("WinApp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HP Inc.")]
12 | [assembly: AssemblyProduct("WinApp")]
13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2022")]
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("df904379-00ba-49df-8f11-01e41653f718")]
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 |
--------------------------------------------------------------------------------
/Services/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("Services")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HP Inc.")]
12 | [assembly: AssemblyProduct("Services")]
13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2022")]
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("39225349-001e-4c38-a97d-09d534deb73a")]
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 |
--------------------------------------------------------------------------------
/Controller/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("Controller")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HP Inc.")]
12 | [assembly: AssemblyProduct("Controller")]
13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2022")]
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("b3823627-d7a0-405c-842b-880f49d328d6")]
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 |
--------------------------------------------------------------------------------
/Controllers/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("Controllers")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HP Inc.")]
12 | [assembly: AssemblyProduct("Controllers")]
13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2022")]
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("56ad2a53-c4e8-4e94-b6f5-0b66a2b96f14")]
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 |
--------------------------------------------------------------------------------
/UI-Parcial/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("UI-Parcial")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("HP Inc.")]
12 | [assembly: AssemblyProduct("UI-Parcial")]
13 | [assembly: AssemblyCopyright("Copyright © HP Inc. 2022")]
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("9dc1119e-e5ce-4517-8fe6-598086ef8f14")]
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 |
--------------------------------------------------------------------------------
/Services/DomainModel/Security/Composite/Component.cs:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////
2 | // Component.cs
3 | // Implementation of the Class Component
4 | // Generated by Enterprise Architect
5 | // Created on: 05-may.-2022 21:16:54
6 | // Original author: gasto
7 | ///////////////////////////////////////////////////////////
8 |
9 | using System;
10 | using System.Collections.Generic;
11 | using System.Text;
12 | using System.IO;
13 |
14 | namespace Services.DomainModel.Security.Composite
15 | {
16 | ///
17 | /// This class (a) declares the interface for objects in the composition, (b)
18 | /// implements default behaviour for the interface common to all classes, as
19 | /// appropriate, (c) declares an interface for accessing and managing its child
20 | /// components, and (d) optionally defines an interface for accessing a component's
21 | /// parent in the recursive structure and implements it if that's appropriate.
22 | ///
23 | public abstract class Component {
24 | public Guid IdComponent { get; set; }
25 |
26 | ///
27 | ///
28 | public abstract void Add(Component component);
29 |
30 | ///
31 | ///
32 | public abstract void Remove(Component component);
33 |
34 | ///
35 | /// Retorna la cantidad de hijos del elemento:
36 | /// Patente: 0
37 | /// Familia: >0
38 | ///
39 | ///
40 | public abstract int ChildrenCount();
41 |
42 | }//end Component
43 |
44 | }//end namespace Composite
--------------------------------------------------------------------------------
/WinApp/frmUsoFactory.cs:
--------------------------------------------------------------------------------
1 | using BLL.BusinessExceptions;
2 | using DomainModel;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.ComponentModel;
6 | using System.Data;
7 | using System.Drawing;
8 | using System.Linq;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 | using System.Windows.Forms;
12 |
13 | namespace WinApp
14 | {
15 | public partial class frmUsoFactory : Form
16 | {
17 | public frmUsoFactory()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | private void frmUsoFactory_Load(object sender, EventArgs e)
23 | {
24 |
25 |
26 | }
27 |
28 | private void button1_Click(object sender, EventArgs e)
29 | {
30 |
31 | try
32 | {
33 | Customer customer = new Customer()
34 | {
35 | Doc = txtDNI.Text,
36 | DateBirth = Convert.ToDateTime(txtFechaNacimiento.Text),
37 | FirstName = txtNombre.Text,
38 | LastName = txtApellido.Text,
39 | };
40 |
41 | BLL.Services.CustomerService.Current.Add(customer);
42 | }
43 | catch (ClienteMayorEdadException ex)
44 | {
45 | MessageBox.Show($"Exception del negocio: {ex.Message}, Helplink: {ex.HelpLink}");
46 | }
47 | catch (Exception ex)
48 | {
49 | MessageBox.Show($"Mensaje: {ex.Message}, StackTrace: {ex.StackTrace}");
50 |
51 | }
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Controller/Controllers/ProductoGetController.cs:
--------------------------------------------------------------------------------
1 | using Controller.Contracts;
2 | using Controller.ViewModels;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using BLL.Services;
9 | using DomainModel.DomainParcial;
10 | using Controller.ViewModels.Helpers;
11 | using Controllers.Validators;
12 |
13 | namespace Controller.Controllers
14 | {
15 | public class ProductoGetController : IGetController
16 | {
17 | [ViewValidator]
18 |
19 | /*
20 | public List GetAll(string filterExpression)
21 | {
22 | var ProductosDTO = ProductoService.Current.SelectAll(filterExpression).ToList();
23 | var ProductosView = MapperHelper.GetMapper().Map, List>(ProductosDTO);
24 |
25 | return ProductosView;
26 | }
27 | */
28 |
29 |
30 | public IEnumerable GetAll()
31 | {
32 | var ProductosDTO = ProductoService.Current.SelectAll().ToList();
33 | var ProductosView = MapperHelper.GetMapper().Map, List>(ProductosDTO);
34 |
35 | return ProductosView;
36 | }
37 |
38 | public ProductoView GetById(Guid id)
39 | {
40 | throw new NotImplementedException();
41 | }
42 |
43 | //private Producto MapperProducto(ProductoView obj)
44 | //{
45 | // return new Producto() { Codigo = obj.Codigo, Descripcion = obj.Descripcion };
46 | //}
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/UI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // La información general de un ensamblado se controla mediante el siguiente
6 | // conjunto de atributos. Cambie estos valores de atributo para modificar la información
7 | // asociada a un ensamblado.
8 | [assembly: AssemblyTitle("UI")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("UI")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles
18 | // para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde
19 | // COM, establezca el atributo ComVisible en true en este tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
23 | [assembly: Guid("0a6664a0-08c4-40b8-a9e5-e30469bc1117")]
24 |
25 | // La información de versión de un ensamblado consta de los cuatro valores siguientes:
26 | //
27 | // Versión principal
28 | // Versión secundaria
29 | // Número de compilación
30 | // Revisión
31 | //
32 | // Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
33 | // utilizando el carácter "*", como se muestra a continuación:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DAL/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // La información general de un ensamblado se controla mediante el siguiente
6 | // conjunto de atributos. Cambie estos valores de atributo para modificar la información
7 | // asociada con un ensamblado.
8 | [assembly: AssemblyTitle("DAL")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DAL")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles
18 | // para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde
19 | // COM, establezca el atributo ComVisible en true en este tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
23 | [assembly: Guid("52e11e2f-eac4-4c6e-91b5-40171ca9dbb1")]
24 |
25 | // La información de versión de un ensamblado consta de los cuatro valores siguientes:
26 | //
27 | // Versión principal
28 | // Versión secundaria
29 | // Número de compilación
30 | // Revisión
31 | //
32 | // Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
33 | // utilizando el carácter "*", como se muestra a continuación:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DomainModel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // La información general de un ensamblado se controla mediante el siguiente
6 | // conjunto de atributos. Cambie estos valores de atributo para modificar la información
7 | // asociada con un ensamblado.
8 | [assembly: AssemblyTitle("DomainModel")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DomainModel")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles
18 | // para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde
19 | // COM, establezca el atributo ComVisible en true en este tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
23 | [assembly: Guid("ed69f2cc-f8e8-4c1f-b7e9-eb8edc28907e")]
24 |
25 | // La información de versión de un ensamblado consta de los cuatro valores siguientes:
26 | //
27 | // Versión principal
28 | // Versión secundaria
29 | // Número de compilación
30 | // Revisión
31 | //
32 | // Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
33 | // utilizando el carácter "*", como se muestra a continuación:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/WinApp/frmUsuarioTest.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace WinApp
2 | {
3 | partial class frmUsuarioTest
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // frmUsuarioTest
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.ClientSize = new System.Drawing.Size(484, 550);
38 | this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
39 | this.Name = "frmUsuarioTest";
40 | this.Text = "frmUsuarioTest";
41 | this.Load += new System.EventHandler(this.frmUsuarioTest_Load);
42 | this.ResumeLayout(false);
43 |
44 | }
45 |
46 | #endregion
47 | }
48 | }
--------------------------------------------------------------------------------
/Controller/ViewModels/Mapper/MapperHelper.cs:
--------------------------------------------------------------------------------
1 | using AutoMapper;
2 | using DomainModel.DomainParcial;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace Controller.ViewModels.Helpers
7 | {
8 | public static class MapperHelper
9 | {
10 | readonly private static IMapper iMapper;
11 | static MapperHelper()
12 | {
13 | var config = new MapperConfiguration(cfg =>
14 | {
15 | cfg.CreateMap();
16 | cfg.CreateMap();
17 |
18 | cfg.CreateMap, List