This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-06-07 02:06:11 -07:00
parent 2a7879bfac
commit c080abce6f
4 changed files with 1908 additions and 63 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,8 @@ Imports System.IO
Imports System.Data
Imports Microsoft.Reporting.WebForms
Imports System.Globalization
Imports System.Xml
Imports System.Web.Script.Services
Partial Class RH_Personal
Inherits ClsPaginas
@@ -615,6 +617,136 @@ Partial Class RH_Personal
#End Region
Private Shared Function sendURL(ByVal URL As String, Optional Methodo As String = "POST", Optional Cookie As String = "", Optional maxTimeMilliseconds As Integer = 120000) As String
Dim resultado As String = ""
Try
Dim request As Net.HttpWebRequest = CType(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest)
request.Timeout = maxTimeMilliseconds
request.Method = Methodo
request.ContentType = "text/html; charset=utf-8" '"text/xml; charset=utf-8"
If Not String.IsNullOrEmpty(Cookie) Then
request.Headers.Add("Cookie", Cookie)
End If
'Using stream As IO.Stream = request.GetRequestStream()
' Using stmw As IO.StreamWriter = New IO.StreamWriter(stream)
' stmw.Write("")
' End Using
'End Using
Dim response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse)
Dim sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream())
resultado = sr.ReadToEnd()
sr.Close()
Catch ex As Exception
ex.ToString().GuardaLog()
'Extenciones.ApplicationParameter.GuardaLogEx(ex, $"SOAPAction : {SOAPAction} XML : {xml}")
End Try
Return resultado
End Function
'<ScriptMethod(UseHttpGet:=True, ResponseFormat:=ResponseFormat.Json)>
<System.Web.Services.WebMethod()>
Public Shared Function gettingCURP(ByVal Curp As String, year As Integer) As String
Dim abc As String() = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
Dim numeric01 As String() = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
Dim rule1 As String() = If(year < 2000, numeric01, abc)
Dim curpresult As String = ""
Dim i As Integer = 0
While Curp.Length = 0 AndAlso i < rule1.Length
Dim z As Integer = 0
While Curp.Length = 0 AndAlso z < numeric01.Length
curpresult = String.Format("{0}{1}{2}", Curp, rule1(i), numeric01(z))
Dim respuesta As String = sendURL(String.Format("http://www.renapo.sep.gob.mx/wsrenapo/MainControllerParam?curp={0}", curpresult), "GET")
Dim trlines As New List(Of String)
Dim keydict As New System.Collections.Concurrent.ConcurrentDictionary(Of String, String)
Dim indexttr As Integer = 0
Dim indexttrB As Integer = 0
Dim indexttd As Integer = 0
Dim indextdiv As Integer = 0
Dim indexinittext As Integer = 0
While Not IsNothing(respuesta) AndAlso respuesta.Length > 0
indexttr = respuesta.IndexOf("<tr")
If indexttr >= 0 Then
indexttrB = respuesta.Substring(indexttr + 3).IndexOf("<tr")
If indexttrB >= 0 Then
trlines.Add(respuesta.Substring(indexttr, indexttrB))
Else
trlines.Add(respuesta.Substring(indexttr))
End If
respuesta = respuesta.Substring(indexttr + 3)
Else
respuesta = ""
End If
End While
Dim key As String = ""
Dim keyvalue As String = ""
For Each item As String In trlines
key = ""
keyvalue = ""
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
key = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttrB + 3)
Else
item = ""
End If
If item.Length > 0 Then
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
keyvalue = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttr + 3)
Else
item = ""
End If
End If
If key.Length > 0 Then
keydict.TryAdd(key.Replace(":", "").Trim(), keyvalue.Trim().ToLower())
End If
Next
Dim Apellido1 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Apellido2 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Nombres As String = "" : keydict.TryGetValue("Nombres", Nombres)
If Nombres Is Nothing OrElse Nombres.Length = 0 Then
curpresult = ""
End If
z = z + 1
End While
i = i + 1
End While
Return curpresult
End Function
Const wdPageBreak As Integer = 7
Const wdCharacter As Integer = 1
@@ -624,6 +756,8 @@ Partial Class RH_Personal
If UsuarioActual.CveEmpresa = 72 OrElse UsuarioActual.CveEmpresa = 80 Then
pnlSalarioIMSS.Visible = False
End If
'
ViewState("Orden") = ""
ViewState("Orden1") = ""