156 lines
5.2 KiB
VB.net
156 lines
5.2 KiB
VB.net
Imports DevExpress.Xpf.Editors
|
|
Imports DevExpress.Xpf.LayoutControl
|
|
Imports System.ComponentModel
|
|
Imports System.Data
|
|
Imports DevExpress.Xpf.Editors.Validation
|
|
Imports DevExpress.Xpf.Editors.Helpers
|
|
Imports DevExpress.Xpf.Core
|
|
Imports System.Data.Common
|
|
Imports System.Data.Entity
|
|
Imports tsUtilidades.Datos
|
|
Imports DevExpress.Xpf.Bars
|
|
Imports DevExpress.Xpf.Grid
|
|
Imports System.Collections
|
|
Imports tsUtilidades.Extensiones
|
|
Imports System.Data.Objects.DataClasses
|
|
Imports tsWPFCore.Comun
|
|
Imports tsWPFCore
|
|
Imports tsUtilidades
|
|
Imports bdGrupoSanchoToro
|
|
Imports bdGrupoSanchoToro.db
|
|
Imports bdGrupoSanchoToro.db.Utilidades
|
|
|
|
|
|
Public Class ucConceptoApuntes
|
|
Private bd As tscGrupoSanchoToro
|
|
Friend _idConcepto As Nullable(Of Integer)
|
|
Private lConceptos As List(Of conceptosapuntes)
|
|
|
|
|
|
|
|
Public Overrides Sub Cargado()
|
|
Me.Tipo_ucControlBusqueda = GetType(ucConceptosApuntes)
|
|
End Sub
|
|
|
|
Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False)
|
|
|
|
End Sub
|
|
|
|
Dim ra As conceptosapuntes
|
|
Public Overrides Function EstablecedcPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As EstadosAplicacion
|
|
Dim NuevoEstado As EstadosAplicacion
|
|
|
|
If FuerzaNuevo OrElse _idConcepto Is Nothing Then
|
|
ra = New conceptosapuntes
|
|
NuevoEstado = EstadosAplicacion.Nuevo
|
|
'lgDatosProveedor.DataContext = bd.proveedores.First(Function(x) x.idProveedor = ra.idProveedor) 'ra.entidades
|
|
Else
|
|
ra = bd.conceptosapuntes.First(Function(x) x.idConcepto = _idConcepto)
|
|
NuevoEstado = EstadosAplicacion.ModificandoRegistro
|
|
'lgDatosProveedor.DataContext = bd.proveedores.First(Function(x) x.idProveedor = ra.idProveedor) 'ra.entidades
|
|
End If
|
|
Me.DataContext = ra
|
|
Return NuevoEstado
|
|
End Function
|
|
|
|
Public Overrides Function ObtieneBD() As tsUtilidades.ItsContexto
|
|
bd = tscGrupoSanchoToro.NuevoContexto()
|
|
Return bd
|
|
End Function
|
|
|
|
Public Overrides ReadOnly Property NombreTablaBase As String
|
|
Get
|
|
Return "conceptosapuntes"
|
|
End Get
|
|
End Property
|
|
|
|
|
|
Public Overrides ReadOnly Property idRegistroAplicacionActual As String
|
|
Get
|
|
If Me.Estado = EstadosAplicacion.Nuevo Then
|
|
Return "Concepto Apuntes.Nuevo"
|
|
Else
|
|
Return "Concepto Apuntes." & DirectCast(Me.DataContext, conceptosapuntes).idConcepto.ToString
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides ReadOnly Property DescripcionRegistro As String
|
|
Get
|
|
Return "Concepto Apuntes"
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub New(Optional idConcepto As Integer? = Nothing)
|
|
' Llamada necesaria para el diseñador.
|
|
InitializeComponent()
|
|
_idConcepto = idConcepto
|
|
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Public Overrides Sub EstableceTitulo()
|
|
If Me.Estado = EstadosAplicacion.ModificandoRegistro Then
|
|
Dim ca As conceptosapuntes = Me.DataContext
|
|
Me.docpanel.Caption = "Concepto Apuntes " & ca.Codigo
|
|
Me.docpanel.Tag = "Concepto Apuntes." & ca.Codigo
|
|
Else
|
|
Me.docpanel.Caption = "Concepto Apuntes Nueva"
|
|
Me.docpanel.Tag = "Concepto Apuntes.Nuevo"
|
|
End If
|
|
' End If
|
|
'End If
|
|
End Sub
|
|
|
|
Public Overrides Function ObtienePermisos() As tsUtilidades.Permisos
|
|
Return Comun.ObtienePermisos(Me.bd, "AP.CONTABILIDAD", idUsuario)
|
|
End Function
|
|
|
|
|
|
Private Sub ap_ValidarControl(sender As Object, e As ValidationEventArgs, ByRef ev As ErrorValidacion, ByRef ValorOriginalCambiado As Object) Handles Me.ValidarControl
|
|
Dim pts As PropiedadesTS = sender.parent.propiedadests
|
|
Try
|
|
If Not pts Is Nothing Then
|
|
Me.ErroresValidacion.EliminaError("validando-" & pts.NombreCampo)
|
|
|
|
'Select Case pts.NombreCampo.ToLower
|
|
' Case "idproveedor_nulable"
|
|
' Dim id As Integer = e.Value
|
|
' Dim ent = bd.Entidades.First(Function(x) x.idEntidad = id)
|
|
' lgDatosProveedor.DataContext = ent
|
|
'End Select
|
|
End If
|
|
Catch ex As Exception
|
|
Dim sCodigoError As String = "validando-"
|
|
If pts IsNot Nothing Then
|
|
sCodigoError &= pts.NombreCampo
|
|
End If
|
|
ev = New ErrorValidacion(sCodigoError, sender, ex.Message, ex, DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical)
|
|
e.IsValid = False
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
Private Sub ap_DespuesGuardar(sender As Object, e As ItemClickEventArgs, OpcionGuardado As Integer) Handles Me.DespuesGuardar
|
|
_idConcepto = ra.idConcepto
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub ap_EstadoCambiado(EstadoAnterior As EstadosAplicacion, EstadoNuevo As EstadosAplicacion) Handles Me.EstadoCambiado
|
|
Select Case EstadoNuevo
|
|
Case EstadosAplicacion.ModificandoRegistro
|
|
Dim ra As conceptosapuntes = Me.DataContext
|
|
End Select
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
End Class
|
|
|