51 lines
2.1 KiB
VB.net
51 lines
2.1 KiB
VB.net
Partial Public Class gestionesvarias
|
|
Public Shared Function CreaNuevoCambioContraseñaAgente(idAgente As Integer) As gestionesvarias
|
|
Try
|
|
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
|
|
Dim idTg = bd.enumeraciones.First(Function(x) x.Codigo = "TGV.CCAG").idEnumeracion
|
|
Dim Ag = bd.agentes.First(Function(x) x.idAgente = idAgente).Codigo
|
|
Static r As System.Random = New System.Random()
|
|
Randomize()
|
|
Dim iAleatorio = r.Next(100000000, 999999999).ToString
|
|
Dim ng As New gestionesvarias
|
|
With ng
|
|
.idTipo = idTg
|
|
.idAplicacion = idAgente
|
|
.FechaCreacion = Now
|
|
.Descripción = Ag
|
|
.Parametros = tsl5.crypt.SHA1("M3Soft." & iAleatorio.ToString)
|
|
End With
|
|
bd.gestionesvarias.AddObject(ng)
|
|
bd.SaveChanges()
|
|
Return ng
|
|
Catch ex As Exception
|
|
Throw New Exception(ex.Message, ex)
|
|
End Try
|
|
End Function
|
|
Public Shared Function CreaNuevoCambioContraseñaSubAgente(idSubAgente As Integer) As gestionesvarias
|
|
Try
|
|
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
|
|
Dim idTg = bd.enumeraciones.First(Function(x) x.Codigo = "TGV.CCSAG").idEnumeracion
|
|
Dim Sag = bd.subagentes.First(Function(x) x.idSubagente = idSubAgente)
|
|
Static r As System.Random = New System.Random()
|
|
Randomize()
|
|
Dim iAleatorio = r.Next(100000000, 999999999).ToString
|
|
|
|
Dim ng As New gestionesvarias
|
|
With ng
|
|
.idTipo = idTg
|
|
.idAplicacion = idSubAgente
|
|
.FechaCreacion = Now
|
|
.Descripción = Sag.agentes.Codigo & "-" & Sag.Codigo
|
|
.Parametros = tsl5.crypt.SHA1("M3Soft." & iAleatorio.ToString)
|
|
End With
|
|
bd.gestionesvarias.AddObject(ng)
|
|
bd.SaveChanges()
|
|
Return ng
|
|
Catch ex As Exception
|
|
Throw New Exception(ex.Message, ex)
|
|
End Try
|
|
End Function
|
|
|
|
End Class
|