martes, 16 de diciembre de 2008

Negocio.Envio.vb

' Fichero autogenerado con PolCodeGen
'        __          __               _     ___             _                   ___  
'       /__\  __ _  / _|  __ _   ___ | |   / __\ __ _  ___ | |_  _ __  ___     / _ \ ___   _ __ ___    ___  ____
'      / \// / _` || |_  / _` | / _ \| |  / /   / _` |/ __|| __|| '__|/ _ \   / /_\// _ \ | '_ ` _ \  / _ \|_  /
'     / _  \| (_| ||  _|| (_| ||  __/| | / /___| (_| |\__ \| |_ | |  | (_) | / /_\\| (_) || | | | | ||  __/ / / 
'     \/ \_/ \__,_||_|   \__,_| \___||_| \____/ \__,_||___/ \__||_|   \___/  \____/ \___/ |_| |_| |_| \___|/___|                                                                   

Namespace Negocio
  ''' <summary>
  ''' Clase de Envio
  ''' </summary>
  <Serializable()> _
  Public Class Envio : Inherits ObjetoBase
    Public Const ClassName As String = "Envio"
    
#Region " Recuperación desde la Base de Datos "
    ''' <summary>
    ''' Carga el objeto con los valores del registro de la base de datos con el id especificado.
    ''' </summary>
    ''' <param name="conexion"> Conexión que utilizará el objeto. </param>
    Public Function Carga(ByVal id As Integer) As Envio
      Using D__ As New Dal.Envios(ConnectionProvider, TransactionProvider)
        Dal.Loader.LoadObject(Me, D__.GetItem(id))
      End Using
      Return Me
    End Function
#End Region 

#Region " Grabar y Borrar "
    ''' <summary>
    ''' Constructor de instancias de proporcionando en <param ref="conexion" /> la conexión
    ''' </summary>
    ''' <param name="conexion"> Conexión que utilizará el objeto. </param>
    Public Function Save() As Envio
      Using D__ As New Dal.Envios(ConnectionProvider, TransactionProvider)        
        If _id = 0 Then
          _id = D__.Insert(IdEnvio, Observaciones, NumeroDeRegistro, FechaDeRegistro, Usuario)
        Else
          D__.Update(Id, IdEnvio, Observaciones, NumeroDeRegistro, FechaDeRegistro, Usuario)
        End If
        Return Me
      End Using
    End Function
    
    ''' <summary>
    ''' Constructor de instancias de proporcionando en <param ref="conexion" /> la conexión
    ''' </summary>
    Public Overrides Function DeleteString() As String
      Return "Confirma la eliminación del Envio: {0}"
    End Function
    
    ''' <summary>
    ''' Constructor de instancias de proporcionando en <param ref="conexion" /> la conexión
    ''' </summary>
    Public Sub Delete()
      Using D__ As New Dal.Envios(ConnectionProvider, TransactionProvider)
        D__.Delete(_id)        
      End Using  
    End Sub
#End Region   
  


#Region " Propiedades enlazadas a Datos "

    Private _id As Integer
    ''' <summary>
    ''' Obtiene o establece el Id del Envio
    ''' </summary>
    ''' <value>
    ''' La propiedad Id obtiene o establece el valor de la variable privada _id.
    ''' </value>
    Public Overrides Property Id() As Integer
      Get
        Return _id
      End Get
      Set(ByVal value As Integer)      
        _id = value
      End Set
    End Property

    Private _idEnvio As String
    ''' <summary>
    ''' Obtiene o establece el IdEnvio del Envio
    ''' </summary>
    ''' <value>
    ''' La propiedad IdEnvio obtiene o establece el valor de la variable privada _idEnvio.
    ''' </value>
    Public Property IdEnvio() As String
      Get
        Return _idEnvio
      End Get
      Set(ByVal value As String)      
        _idEnvio = value
      End Set
    End Property

    Private _observaciones As String
    ''' <summary>
    ''' Obtiene o establece el Observaciones del Envio
    ''' </summary>
    ''' <value>
    ''' La propiedad Observaciones obtiene o establece el valor de la variable privada _observaciones.
    ''' </value>
    Public Property Observaciones() As String
      Get
        Return _observaciones
      End Get
      Set(ByVal value As String)      
        _observaciones = value
      End Set
    End Property

    Private _numeroDeRegistro As String
    ''' <summary>
    ''' Obtiene o establece el NumeroDeRegistro del Envio
    ''' </summary>
    ''' <value>
    ''' La propiedad NumeroDeRegistro obtiene o establece el valor de la variable privada _numeroDeRegistro.
    ''' </value>
    Public Property NumeroDeRegistro() As String
      Get
        Return _numeroDeRegistro
      End Get
      Set(ByVal value As String)      
        _numeroDeRegistro = value
      End Set
    End Property

    Private _fechaDeRegistro As String
    ''' <summary>
    ''' Obtiene o establece el FechaDeRegistro del Envio
    ''' </summary>
    ''' <value>
    ''' La propiedad FechaDeRegistro obtiene o establece el valor de la variable privada _fechaDeRegistro.
    ''' </value>
    Public Property FechaDeRegistro() As String
      Get
        Return _fechaDeRegistro
      End Get
      Set(ByVal value As String)      
        Try
      _fechaDeRegistro = DateTime.Parse(value).ToString("dd/MM/yyyy")
    Catch e As Exception
      _fechaDeRegistro = ""
    End Try
      End Set
    End Property

    Private _fecha As String
    ''' <summary>
    ''' Obtiene o establece el Fecha del Envio
    ''' </summary>
    ''' <value>
    ''' La propiedad Fecha obtiene o establece el valor de la variable privada _fecha.
    ''' </value>
    Public Property Fecha() As String
      Get
        Return _fecha
      End Get
      Set(ByVal value As String)      
        Try
      _fecha = DateTime.Parse(value).ToString("dd/MM/yyyy")
    Catch e As Exception
      _fecha = ""
    End Try
      End Set
    End Property

    Private _usuario As String
    ''' <summary>
    ''' Obtiene o establece el Usuario del Envio
    ''' </summary>
    ''' <value>
    ''' La propiedad Usuario obtiene o establece el valor de la variable privada _usuario.
    ''' </value>
    Public Property Usuario() As String
      Get
        Return _usuario
      End Get
      Set(ByVal value As String)      
        _usuario = value
      End Set
    End Property

#End Region    

    ''' <summary>
    ''' Devuelve una cadena que representa al objeto
    ''' </summary>
    Public Overrides Function ToString() as String
      Return id.ToString() & " " & idEnvio.ToString() & " " & observaciones.ToString() & " " & numeroDeRegistro.ToString() & " " & fechaDeRegistro.ToString() & " " & fecha.ToString() & " " & usuario.ToString()
    End Function
    
    ''' <summary>
    ''' Devuelve una cadena que representa al objeto
    ''' </summary>
    ''' <param name="customFormat"> Indica se se realizará el formato personalizado </param>
    Public Overrides Function ToString(ByVal customFormat As Boolean) As String      
      Return Me.ToString()
    End Function
    
    ''' <summary>
    ''' Constructor de instancias de proporcionando en <param ref="conexion" /> la conexión
    ''' </summary>
    '''<example>
    ''' <c>
    ''' With New Envio()
    '''   DoSomething(.this())
    '''   .DoPrint()
    ''' End With
    ''' </c>
    ''' </example>
    Public Shadows Function this() As Envio
      Return Me
    End Function

#Region " Cargador del objeto "
    ''' <summary>
    ''' Constructor de instancias de proporcionando en <param ref="conexion" /> la conexión
    ''' </summary>
    Private Shared Sub InitDataBinder()
      If _DataBinder Is Nothing Then
        With New Dal.ObjectLoader()
          _DataBinder = .this
          .Add(New Dal.BindItem("id", "Id", 0,GetType(Integer)))
          .Add(New Dal.BindItem("idEnvio", "IdEnvio", 1,GetType(String)))
          .Add(New Dal.BindItem("observaciones", "Observaciones", 2,GetType(String)))
          .Add(New Dal.BindItem("numeroDeRegistro", "NumeroDeRegistro", 3,GetType(String)))
          .Add(New Dal.BindItem("fechaDeRegistro", "FechaDeRegistro", 4,GetType(Date)))
          .Add(New Dal.BindItem("fecha", "Fecha", 5,GetType(Date)))
          .Add(New Dal.BindItem("usuario", "Usuario", 6,GetType(String)))       
        End with
      End If
    End Sub

    Shared _DataBinder As Dal.ObjectLoader = Nothing
    
    ''' <summary>
    ''' Constructor de instancias de proporcionando en <param ref="conexion" /> la conexión
    ''' </summary>
    ''' <param name="conexion"> Conexión que utilizará el objeto. </param>
    Public Overrides Function GetBinder() As Dal.ObjectLoader
      InitDataBinder()
      Return _DataBinder
    End Function
#End Region
  
  End Class
End Namespace

No hay comentarios: