deshacer cambios
Publicado por Fatima (1 intervención) el 14/10/2007 20:48:10
hola
tengo un codigo pero la mera vdd no se si este bien
es una clase que representa a un empleado y que implementa un mecanismo para realizar la accion de deshacer cambioshasta 5 estados anteriores
Public Class empleado
Dim cve_emp As Integer
Dim Nombre As String
Dim APaterno As String
Dim AMaterno As String
Dim RFC As String
Dim Direccion As String
Dim Modificado As Boolean
Dim table As New DataTable
Dim row As DataRow
Dim pila As New Stack(5)
Public Property cve() As Integer
Get
Return cve_emp
End Get
Set(ByVal value As Integer)
cve_emp = value
End Set
End Property
Public Property nom() As String
Get
Return Nombre
End Get
Set(ByVal value As String)
Nombre = value
End Set
End Property
Public Property apat() As String
Get
Return APaterno
End Get
Set(ByVal value As String)
APaterno = value
End Set
End Property
Public Property amat() As String
Get
Return AMaterno
End Get
Set(ByVal value As String)
AMaterno = value
End Set
End Property
Public Property rfc_emp() As String
Get
Return RFC
End Get
Set(ByVal value As String)
RFC = value
End Set
End Property
Public Property dir() As String
Get
Return Direccion
End Get
Set(ByVal value As String)
Direccion = value
End Set
End Property
Sub New()
table.Columns.Add("cve_emp")
table.Columns.Add("nombre")
table.Columns.Add("apaterno")
table.Columns.Add("amaterno")
table.Columns.Add("rfc")
table.Columns.Add("direccion")
End Sub
Sub modificar()
row = table.NewRow
row.BeginEdit()
row("cve_emp") = cve
row("nombre") = nom
row("apaterno") = apat
row("amaterno") = amat
row("rfc") = rfc_emp
row("direccion") = dir
row.EndEdit()
table.Rows.Add(row)
pila.Push(row)
End Sub
Sub Deshacer()
If pila.Count > 0 Then
row = table.NewRow
row = pila.Pop
cve = row(0)
nom = row(1)
apat = row(2)
amat = row(3)
rfc_emp = row(4)
dir = row(5)
End If
End Sub
End Class
tengo un codigo pero la mera vdd no se si este bien
es una clase que representa a un empleado y que implementa un mecanismo para realizar la accion de deshacer cambioshasta 5 estados anteriores
Public Class empleado
Dim cve_emp As Integer
Dim Nombre As String
Dim APaterno As String
Dim AMaterno As String
Dim RFC As String
Dim Direccion As String
Dim Modificado As Boolean
Dim table As New DataTable
Dim row As DataRow
Dim pila As New Stack(5)
Public Property cve() As Integer
Get
Return cve_emp
End Get
Set(ByVal value As Integer)
cve_emp = value
End Set
End Property
Public Property nom() As String
Get
Return Nombre
End Get
Set(ByVal value As String)
Nombre = value
End Set
End Property
Public Property apat() As String
Get
Return APaterno
End Get
Set(ByVal value As String)
APaterno = value
End Set
End Property
Public Property amat() As String
Get
Return AMaterno
End Get
Set(ByVal value As String)
AMaterno = value
End Set
End Property
Public Property rfc_emp() As String
Get
Return RFC
End Get
Set(ByVal value As String)
RFC = value
End Set
End Property
Public Property dir() As String
Get
Return Direccion
End Get
Set(ByVal value As String)
Direccion = value
End Set
End Property
Sub New()
table.Columns.Add("cve_emp")
table.Columns.Add("nombre")
table.Columns.Add("apaterno")
table.Columns.Add("amaterno")
table.Columns.Add("rfc")
table.Columns.Add("direccion")
End Sub
Sub modificar()
row = table.NewRow
row.BeginEdit()
row("cve_emp") = cve
row("nombre") = nom
row("apaterno") = apat
row("amaterno") = amat
row("rfc") = rfc_emp
row("direccion") = dir
row.EndEdit()
table.Rows.Add(row)
pila.Push(row)
End Sub
Sub Deshacer()
If pila.Count > 0 Then
row = table.NewRow
row = pila.Pop
cve = row(0)
nom = row(1)
apat = row(2)
amat = row(3)
rfc_emp = row(4)
dir = row(5)
End If
End Sub
End Class
Valora esta pregunta


0