context: using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Data.SqlClient;
  using System.Configuration;
  using System.Linq;
  using Siegfried.Base;
  using Siegfried.Entities;
   
  namespace Siegfried.Entities
  {
  
  	public partial class DetalleVentaDap : BaseDap
  	{
  		public DetalleVentaDap()
  		{
  		}
  		public DetalleVentaDap(BaseDap dapProvider)
  		{
  			if (dapProvider != null &&
  				dapProvider.ConnectionContainer != null &&
  				dapProvider.ConnectionContainer.Connection != null)
  			{
  				LeaveOpen = dapProvider.LeaveOpen;
  				ConnectionContainer = dapProvider.ConnectionContainer;
  			}
  		}
  		public DetalleVentaDap(ConnectionContainer connectionContainer, bool leaveOpen)
  		{
  			if (connectionContainer != null &&
  				connectionContainer.Connection != null)
  			{
  				LeaveOpen = leaveOpen;
  				ConnectionContainer = connectionContainer;
  			}
  		}
  
  		/// <summary>
  		/// Returns all records from the table.
  		/// Please be aware that any predicate cannot be applied to the returned IEnumurable and it will allways read all records.
  		/// </summary>
  		/// <returns>Delayed read all records from the database table.</returns>
  		public IEnumerable<DetalleVenta> All()
  		{
  			return Query<DetalleVenta>(SqlSelectCommand, buffered: false);
  		}
  
  		public List<DetalleVenta> GetTop(int count)
  		{
  			var queryResult = Query<DetalleVenta>(string.Format("SELECT TOP {0} * FROM {1}", count, SqlTableName));
  			return queryResult as List<DetalleVenta> ?? queryResult.ToList();
  		}
  
  		public DetalleVenta GetByID(Int32 ID)
  		{
  			return Query<DetalleVenta>(SqlSelectCommand + " WHERE ID=@ID", new { ID = ID }).FirstOrDefault();
  		}
  
  		public void Insert(DetalleVenta model)
  		{
  			Execute(SqlInsertCommand, model);
  		}
  
  		public void Insert(IEnumerable<DetalleVenta> models)
  		{
  			Execute(SqlInsertCommand, models);
  		}
  
  		public void Delete(Int32 ID)
  		{
  			Execute(SqlDeleteCommand, new { ID = ID });
  		}
  
  		public void Update(DetalleVenta model)
  		{
  			Execute(SqlUpdateCommand, model);
  		}
  
  		public void Update(IEnumerable<DetalleVenta> models)
  		{
  			Execute(SqlUpdateCommand, models);
  		}
  
  
  
  
  		public const string SqlTableName = "DetalleVenta";
  		public const string SqlSelectCommand = "SELECT * FROM " + SqlTableName;
  		public const string SqlInsertCommand = "INSERT INTO " + SqlTableName + " (VentaID , ProductoID , Cantidad , PrecioUnitario , TasaIVA , IVA , Importe , ImporteConIVA) VALUES (@VentaID , @ProductoID , @Cantidad , @PrecioUnitario , @TasaIVA , @IVA , @Importe , @ImporteConIVA) ";
  		public const string SqlUpdateCommand = "UPDATE " + SqlTableName + " SET VentaID=@VentaID , ProductoID=@ProductoID , Cantidad=@Cantidad , PrecioUnitario=@PrecioUnitario , TasaIVA=@TasaIVA , IVA=@IVA , Importe=@Importe , ImporteConIVA=@ImporteConIVA WHERE ID=@ID";
  		public const string SqlDeleteCommand = "DELETE FROM " + SqlTableName + " WHERE ID=@ID";
  		
  	}
  
  	public partial class VentaDap : BaseDap
  	{
  		public VentaDap()
  		{
  		}
  		public VentaDap(BaseDap dapProvider)
  		{
  			if (dapProvider != null &&
  				dapProvider.ConnectionContainer != null &&
  				dapProvider.ConnectionContainer.Connection != null)
  			{
  				LeaveOpen = dapProvider.LeaveOpen;
  				ConnectionContainer = dapProvider.ConnectionContainer;
  			}
  		}
  		public VentaDap(ConnectionContainer connectionContainer, bool leaveOpen)
  		{
  			if (connectionContainer != null &&
  				connectionContainer.Connection != null)
  			{
  				LeaveOpen = leaveOpen;
  				ConnectionContainer = connectionContainer;
  			}
  		}
  
  		/// <summary>
  		/// Returns all records from the table.
  		/// Please be aware that any predicate cannot be applied to the returned IEnumurable and it will allways read all records.
  		/// </summary>
  		/// <returns>Delayed read all records from the database table.</returns>
  		public IEnumerable<Venta> All()
  		{
  			return Query<Venta>(SqlSelectCommand, buffered: false);
  		}
  
  		public List<Venta> GetTop(int count)
  		{
  			var queryResult = Query<Venta>(string.Format("SELECT TOP {0} * FROM {1}", count, SqlTableName));
  			return queryResult as List<Venta> ?? queryResult.ToList();
  		}
  
  		public Venta GetByID(Int32 ID)
  		{
  			return Query<Venta>(SqlSelectCommand + " WHERE ID=@ID", new { ID = ID }).FirstOrDefault();
  		}
  
  		public void Insert(Venta model)
  		{
  			Execute(SqlInsertCommand, model);
  		}
  
  		public void Insert(IEnumerable<Venta> models)
  		{
  			Execute(SqlInsertCommand, models);
  		}
  
  		public void Delete(Int32 ID)
  		{
  			Execute(SqlDeleteCommand, new { ID = ID });
  		}
  
  		public void Update(Venta model)
  		{
  			Execute(SqlUpdateCommand, model);
  		}
  
  		public void Update(IEnumerable<Venta> models)
  		{
  			Execute(SqlUpdateCommand, models);
  		}
  
  
  
  
  		public const string SqlTableName = "Venta";
  		public const string SqlSelectCommand = "SELECT * FROM " + SqlTableName;
  		public const string SqlInsertCommand = "INSERT INTO " + SqlTableName + " (Fecha , UsuarioID , PlantaID , SalidaID , ClienteID , ChoferID , TotalVenta , SubTotal , IVA , TasaIVA , EsCredito , PagadaTotalmente , NumeroRemision) VALUES (@Fecha , @UsuarioID , @PlantaID , @SalidaID , @ClienteID , @ChoferID , @TotalVenta , @SubTotal , @IVA , @TasaIVA , @EsCredito , @PagadaTotalmente , @NumeroRemision) ";
  		public const string SqlUpdateCommand = "UPDATE " + SqlTableName + " SET Fecha=@Fecha , UsuarioID=@UsuarioID , PlantaID=@PlantaID , SalidaID=@SalidaID , ClienteID=@ClienteID , ChoferID=@ChoferID , TotalVenta=@TotalVenta , SubTotal=@SubTotal , IVA=@IVA , TasaIVA=@TasaIVA , EsCredito=@EsCredito , PagadaTotalmente=@PagadaTotalmente , NumeroRemision=@NumeroRemision WHERE ID=@ID";
  		public const string SqlDeleteCommand = "DELETE FROM " + SqlTableName + " WHERE ID=@ID";
  		
  	}
  
  	public partial class PagoDap : BaseDap
  	{
  		public PagoDap()
  		{
  		}
  		public PagoDap(BaseDap dapProvider)
  		{
  			if (dapProvider != null &&
  				dapProvider.ConnectionContainer != null &&
  				dapProvider.ConnectionContainer.Connection != null)
  			{
  				LeaveOpen = dapProvider.LeaveOpen;
  				ConnectionContainer = dapProvider.ConnectionContainer;
  			}
  		}
  		public PagoDap(ConnectionContainer connectionContainer, bool leaveOpen)
  		{
  			if (connectionContainer != null &&
  				connectionContainer.Connection != null)
  			{
  				LeaveOpen = leaveOpen;
  				ConnectionContainer = connectionContainer;
  			}
  		}
  
  		/// <summary>
  		/// Returns all records from the table.
  		/// Please be aware that any predicate cannot be applied to the returned IEnumurable and it will allways read all records.
  		/// </summary>
  		/// <returns>Delayed read all records from the database table.</returns>
  		public IEnumerable<Pago> All()
  		{
  			return Query<Pago>(SqlSelectCommand, buffered: false);
  		}
  
  		public List<Pago> GetTop(int count)
  		{
  			var queryResult = Query<Pago>(string.Format("SELECT TOP {0} * FROM {1}", count, SqlTableName));
  			return queryResult as List<Pago> ?? queryResult.ToList();
  		}
  
  		public Pago GetByID(Int32 ID)
  		{
  			return Query<Pago>(SqlSelectCommand + " WHERE ID=@ID", new { ID = ID }).FirstOrDefault();
  		}
  
  		public void Insert(Pago model)
  		{
  			Execute(SqlInsertCommand, model);
  		}
  
  		public void Insert(IEnumerable<Pago> models)
  		{
  			Execute(SqlInsertCommand, models);
  		}
  
  		public void Delete(Int32 ID)
  		{
  			Execute(SqlDeleteCommand, new { ID = ID });
  		}
  
  		public void Update(Pago model)
  		{
  			Execute(SqlUpdateCommand, model);
  		}
  
  		public void Update(IEnumerable<Pago> models)
  		{
  			Execute(SqlUpdateCommand, models);
  		}
  
  
  
  
  		public const string SqlTableName = "Pago";
  		public const string SqlSelectCommand = "SELECT * FROM " + SqlTableName;
  		public const string SqlInsertCommand = "INSERT INTO " + SqlTableName + " (FechaPago , UsuarioID , VentaID , Monto , SaldoInicial , SaldoFinal) VALUES (@FechaPago , @UsuarioID , @VentaID , @Monto , @SaldoInicial , @SaldoFinal) ";
  		public const string SqlUpdateCommand = "UPDATE " + SqlTableName + " SET FechaPago=@FechaPago , UsuarioID=@UsuarioID , VentaID=@VentaID , Monto=@Monto , SaldoInicial=@SaldoInicial , SaldoFinal=@SaldoFinal WHERE ID=@ID";
  		public const string SqlDeleteCommand = "DELETE FROM " + SqlTableName + " WHERE ID=@ID";
  		
  	}
  
  	public partial class EmpresaDap : BaseDap
  	{
  		public EmpresaDap()
  		{
  		}
  		public EmpresaDap(BaseDap dapProvider)
  		{
  			if (dapProvider != null &&
  				dapProvider.ConnectionContainer != null &&
  				dapProvider.ConnectionContainer.Connection != null)
  			{
  				LeaveOpen = dapProvider.LeaveOpen;
  				ConnectionContainer = dapProvider.ConnectionContainer;
  			}
  		}
  		public EmpresaDap(ConnectionContainer connectionContainer, bool leaveOpen)
  		{
  
gt: 			if (connectionContainer != null &&