Created
December 31, 2018 10:12
-
-
Save kiquenet/6ec806985b89d14810fddb20bee13ae9 to your computer and use it in GitHub Desktop.
Proceso Transaccional CSV - 1
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*|101369|4 | |
100810|COMPANIA1 |913895001 |2018102749 |XXXXXXX YYYYYYYY |ZZZZ |Daños por agua u otros liquidos |20181220|1|20181228|1|7435951 |01|Fontanero |3 |999999999|01|666666666|02|666666666|02|1|0|0 | |
101810|COMPANIA2 |170224588 |2018335769 |XXXX XXXXX |YYYYYY ZZZZZZ |Daños por agua u otros líquidos |20181226|1|20181228|2|7446384 |01|Fontanero |7447984 |26|Pocero Camión Cuba |1 |666666666|02|1|1|0 | |
101810|COMPANIA2 |170227086 |2018329107 |XXXXX |YYYYYYYY ZZZZZ |Altres contingències |20181213|2|20181228|2|7419636 |02|Albañil |7426826 |10|Carpintero madera |2 |666666666|02|999999999|01|1|0|0 | |
101810|COMPANIA2 |170256176 |2018319004 |XXXXXXXX |YYYYYY ZZZZ |Danys per aigua o altres líquids |20181127|2|20181228|5|7383310 |01|Fontanero |7383663 |10|Carpintero madera |7396864 |01|Fontanero |7399038 |26|Pocero Camión Cuba |7417036 |08|Parquetista |2 |666666666|02|666666666|02|1|0|0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Shared Sub DoProcesoLeerCSV(ByVal encoding As System.Text.Encoding, ByVal fechaCargaYYYYMMDD As String, ByVal nombreFichero As String, ByVal nombreFicheroCarga As String) | |
'''''''Log("Leer CSV " & nombreFichero & " *** OJO ENCODING *** ") | |
Dim objReader As New StreamReader(nombreFichero, encoding, True) | |
Dim sLine As String = "" | |
Dim arrText As New ArrayList() | |
Do | |
sLine = objReader.ReadLine() | |
If Not sLine Is Nothing Then | |
arrText.Add(sLine) | |
End If | |
Loop Until sLine Is Nothing | |
objReader.Close() | |
Trace.WriteLine("Número de Líneas del Fichero: " & arrText.Count) | |
ProcesoTratarLineas(arrText, fechaCargaYYYYMMDD, nombreFicheroCarga) | |
End Sub | |
Public Shared Sub ProcesoTratarLineas(ByVal arrText As ArrayList, ByVal fechaCargaYYYYMMDD As String, ByVal nombreFicheroCarga As String) | |
'TransactionException | |
'new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(60)) | |
'myContext.CommandTimeout = 30; //This is seconds | |
'<system.transactions> | |
' <machineSettings maxTimeout="00:03:20" /> | |
' </system.transactions> | |
' TransactionException- Timeout a los 10 minutos ---- para 2863 registros | |
If arrText.Count > 2200 Then | |
Trace.WriteLine("*********** TRANSACTION TIMEOUT *********** ") | |
Trace.WriteLine("*********** Número de Líneas del Fichero: " & arrText.Count) | |
Trace.WriteLine("1) maximumTimeout = " & TransactionManager.MaximumTimeout.ToString()) | |
Dim tsMaximum As TimeSpan = New TimeSpan(0, 30, 0) | |
Frk.Common.TransactionsUtils.OverrideTransactionScopeMaximumTimeout(tsMaximum) | |
Trace.WriteLine("2) maximumTimeout = " & TransactionManager.MaximumTimeout.ToString()) | |
End If | |
Dim ts As TimeSpan = New TimeSpan(0, 30, 0) | |
Dim transOp As New System.Transactions.TransactionOptions | |
'transOp.Timeout = ts ' No Aplica elTimeout --- tiene prioridad parece MaximumTimeout | |
transOp.Timeout = TransactionManager.MaximumTimeout | |
transOp.IsolationLevel = IsolationLevel.Serializable ' Valor por defecto | |
If arrText.Count > 1000 Then | |
Trace.WriteLine("*********** Número de Líneas del Fichero: " & arrText.Count) | |
transOp.IsolationLevel = IsolationLevel.ReadCommitted | |
Trace.WriteLine("*********** IsolationLevel: " & IsolationLevel.ReadCommitted) | |
End If | |
If DateTime.Now.Hour >= 9 Then | |
Trace.WriteLine("*********** HORA DE EJECUCION: " & DateTime.Now.Hour) | |
transOp.IsolationLevel = IsolationLevel.ReadCommitted | |
Trace.WriteLine("*********** IsolationLevel: " & IsolationLevel.ReadCommitted) | |
End If | |
Trace.WriteLine("ProcesoTratarLineas. TRANSACCION ") | |
Using tran As New System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transOp) | |
'Register for the transaction completed event for the current transaction | |
AddHandler Transactions.Transaction.Current.TransactionCompleted, AddressOf Current_TransactionCompleted | |
'Transactions.Transaction.Current.TransactionCompleted += New Transactions.TransactionCompletedEventHandler(Current_TransactionCompleted) | |
Dim swTimer As New Stopwatch() | |
swTimer.Start() | |
Try | |
DoProcesoTratarLineas(arrText, fechaCargaYYYYMMDD, nombreFicheroCarga) | |
Trace.WriteLine("ProcesoTratarLineas. TRANSACCION. Complete ") | |
tran.Complete() | |
Catch ex As Exception | |
Dim ts2 As System.Transactions.Transaction = System.Transactions.Transaction.Current | |
Trace.WriteLine("") | |
Trace.WriteLine("*********** ERROR TRANSACTION *********** ") | |
Trace.WriteLine("ERROR. TRANSACCION. ROLLBACK ") | |
If ts2 IsNot Nothing Then | |
Trace.WriteLine("TRANSACCION STATUS: " & ts2.TransactionInformation.Status) | |
End If | |
Trace.WriteLine("*********** ERROR TRANSACTION *********** ") | |
'current.TransactionInformation.internalTransaction | |
'//either 1 of following lines will use | |
'''''''System.Transactions.Transaction.Current.Rollback() | |
'scope.Dispose(); | |
Throw ex | |
End Try | |
swTimer.Stop() | |
Trace.WriteLine("TOTAL TIEMPO ProcesoTratarLineas : " & swTimer.Elapsed.ToString()) | |
End Using | |
Trace.WriteLine("ProcesoTratarLineas. TRANSACCION. Complete OK ") | |
Trace.WriteLine(Environment.NewLine & Environment.NewLine) | |
End Sub | |
'Transaction completed event handler | |
Private Shared Sub Current_TransactionCompleted(ByVal sender As Object, ByVal e As TransactionEventArgs) | |
' // Here the transaction Is beginning rollback. Look at Component Services snap-in | |
Trace.WriteLine("") | |
Trace.WriteLine("*********** TRANSACTION *********** ") | |
Trace.WriteLine("A transaction has completed:") | |
Trace.WriteLine("ID: {0}", e.Transaction.TransactionInformation.LocalIdentifier) | |
Trace.WriteLine(String.Format("Distributed ID: {0}", e.Transaction.TransactionInformation.DistributedIdentifier)) | |
Trace.WriteLine(String.Format("Status: {0}", e.Transaction.TransactionInformation.Status)) | |
Trace.WriteLine(String.Format("IsolationLevel: {0}", e.Transaction.IsolationLevel)) | |
Trace.WriteLine("*********** TRANSACTION *********** ") | |
End Sub | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Shared Sub DoProcesoTratarLineas(ByVal arrText As ArrayList, ByVal fechaCargaYYYYMMDD As String, ByVal nombreFicheroCarga As String) | |
Dim Vsql As New SQLTools() | |
Dim varTel As Integer = 0 | |
Dim temp As Integer = 0 | |
Dim indiceNuevo As Integer = 0 | |
Dim tamFichero As Integer = 0 | |
Dim campos() As String | |
Dim valores() As String | |
Dim camposAR() As String | |
Dim valoresAR() As String | |
ReDim camposAR(0) | |
ReDim valoresAR(0) | |
'ReDim valoresAC(10) | |
Dim sLine As String = "" | |
Dim delimiter As Char = "|"c | |
Dim contadorRegistros As Integer = 0 | |
Dim contadorRegistrosTratados As Integer = 0 | |
For Each sLine In arrText | |
Dim substrings() As String = sLine.Split(delimiter) | |
If (substrings(0) = "*") Then | |
tamFichero = substrings(2) | |
Trace.WriteLine("Linea " & contadorRegistros & ". Número de Siniestros del Fichero: " & tamFichero & vbCrLf) | |
Else | |
contadorRegistros = contadorRegistros + 1 | |
Trace.WriteLine(vbCrLf) | |
Trace.WriteLine("Registro " & contadorRegistros) | |
Dim txtReg As String = "Registro " & contadorRegistros | |
Dim TipoEncuesta As Byte = 0 | |
Dim TipoComunicacion As Byte = 0 | |
Dim TipoPolizaProducto As Byte = 0 | |
Dim CodCia As String = "" | |
TipoEncuesta = DataValidationHelper.ConvertToByte(substrings(substrings.Length - 3), "Tipo Encuesta - " & txtReg) | |
TipoComunicacion = DataValidationHelper.ConvertToByte(substrings(substrings.Length - 2), "Tipo Comunicación - " & txtReg) | |
TipoPolizaProducto = DataValidationHelper.ConvertToByte(substrings(substrings.Length - 1), "TipoPolizaProducto - " & txtReg) | |
CodCia = substrings(0) | |
Select Case CodCia | |
Case Constantes.CODIGOCIA_COMPANIA1 | |
If TipoEncuesta <> ArchivoCliente.TIPO_ENCUESTA_COMPANIA1_REPARABLES AndAlso TipoEncuesta <> ArchivoCliente.TIPO_ENCUESTA_COMPANIA1_MIXTOS AndAlso TipoEncuesta <> ArchivoCliente.TIPO_ENCUESTA_COMPANIA1_INDEMNIZABLES Then | |
Throw New ArgumentOutOfRangeException("Valor de Tipo Encuesta " & TipoEncuesta & " No Válido. Registro " & contadorRegistros) | |
End If | |
Case Else | |
If TipoEncuesta <> ArchivoCliente.TIPO_ENCUESTA_ENCUESTA_CORTA AndAlso TipoEncuesta <> ArchivoCliente.TIPO_ENCUESTA_ENCUESTA_LARGA Then | |
Throw New ArgumentOutOfRangeException("Valor de Tipo Encuesta " & TipoEncuesta & " No Válido. Registro " & contadorRegistros) | |
End If | |
End Select | |
If TipoComunicacion <> ArchivoCliente.TIPO_COMUNICACION_TELEFONICA AndAlso TipoComunicacion <> ArchivoCliente.TIPO_COMUNICACION_SMS Then | |
Throw New ArgumentOutOfRangeException("Valor de Tipo Comunicación " & TipoComunicacion & " No Válido. Registro " & contadorRegistros) | |
End If | |
If TipoPolizaProducto <> ArchivoCliente.TIPO_POLIZA_PRODUCTO_HOGAR AndAlso TipoPolizaProducto <> ArchivoCliente.TIPO_POLIZA_PRODUCTO_COMERCIO Then | |
Throw New ArgumentOutOfRangeException("Valor de Tipo Poliza Producto " & TipoPolizaProducto & " No Válido. Registro " & contadorRegistros) | |
End If | |
Dim idioma As String = "" | |
idioma = substrings(8) | |
If idioma <> ArchivoCliente.IDIOMA_CASTELLANO AndAlso idioma <> ArchivoCliente.IDIOMA_CATALAN Then | |
Throw New ArgumentOutOfRangeException("Valor de Idioma " & idioma & " No Válido. Registro " & contadorRegistros) | |
End If | |
' NomCliente - Apellidos - Descripcion | |
Dim datosSiniestro As String = substrings(4).Trim() & " " & substrings(5).Trim() & " - " & substrings(6).Trim() | |
Dim numeroTelefonos As Integer = 0 | |
Dim indiceCamposCSV As Integer = 10 | |
Dim contadorDeGremios1 As Integer = Convert.ToInt32(substrings(10)) | |
Dim okSql As Boolean = False | |
Dim poliza As String = "" | |
Trace.WriteLine(vbTab & "COMPROBACION NUMERO DE TELEFONOS. Contador de Gremios: " & contadorDeGremios1) | |
For i As Integer = 1 To contadorDeGremios1 | |
Dim numServicio As String = substrings(indiceCamposCSV + 1) | |
Dim codigo As String = substrings(indiceCamposCSV + 2) | |
Dim descripcionGremio As String = substrings(indiceCamposCSV + 3) | |
Dim dgTam As Integer = descripcionGremio.Length | |
indiceCamposCSV = indiceCamposCSV + 3 | |
Next | |
indiceCamposCSV = indiceCamposCSV + 1 | |
'En el tipo de Encuesta 4 de COMPANIA1 (Indemnizables) el contador de Gremios siempre es 0 | |
If Not (TipoEncuesta = ArchivoCliente.TIPO_ENCUESTA_COMPANIA1_INDEMNIZABLES And contadorDeGremios1 = 0) Then | |
numeroTelefonos = Convert.ToInt32(substrings(indiceCamposCSV)) | |
' ********************************************** | |
' No tiene Telefonos --- SE IGNORA EL REGISTRO | |
If numeroTelefonos <= 0 Then | |
Trace.WriteLine(vbCrLf & vbCrLf) | |
Trace.WriteLine(vbTab & "OJO: SE IGNORA. NO SE ENCUENTRAN TELEFONOS. Detalles: " & txtReg & " Datos Siniestro : " & datosSiniestro) | |
Trace.WriteLine(vbTab & "LINEA: " & sLine) | |
Trace.WriteLine(vbCrLf & vbCrLf) | |
Continue For | |
''''Throw New Exception("Error NO SE ENCUENTRAN TELEFONOS. Detalles: " & txtReg & " Datos Siniestro : " & datosSiniestro) | |
End If | |
' ********************************************** | |
End If | |
Trace.WriteLine(vbTab & "COMPROBACION NUMERO DE TELEFONOS. Num.Telefonos: " & numeroTelefonos & vbCrLf) | |
contadorRegistrosTratados = contadorRegistrosTratados + 1 | |
okSql = Vsql.inserta(Config.TABLA_ARCHIVO_CLIENTE, | |
"CodCia,NomCia,Poliza,Siniestro,nomCliente,Apellidos,descripcion,FechaDeclaracion,Idioma,fechaEnvio,ContGremios,TipoEncuesta,TipoComunicacion,TipoPolizaProducto", | |
Vsql.ponComas(substrings(0)) & "," & Vsql.ponComas(substrings(1)) & "," & Vsql.ponComas(substrings(2)) & "," & Vsql.ponComas(substrings(3)) & "," & Vsql.ponComas(substrings(4)) & | |
"," & Vsql.ponComas(substrings(5)) & "," & Vsql.ponComas(substrings(6)) & "," & Vsql.ponComas(substrings(7)) & "," & Vsql.ponComas(substrings(8)) & "," & Vsql.ponComas(substrings(9)) & "," & Vsql.ponComas(substrings(10)) & | |
"," & TipoEncuesta & "," & TipoComunicacion & "," & TipoPolizaProducto _ | |
, Config.CONEXION_SQL) | |
If Not okSql Then | |
' TODO: trazar, o aviso MsgBox NO porque interrumpe proceso, o Excepcion | |
Throw New Exception("Error en inserción de TABLA_ARCHIVO_CLIENTE " & Vsql.ErrorSQL) | |
End If | |
indiceNuevo = Vsql.dameValor("SELECT IDENT_CURRENT('" & Config.TABLA_ARCHIVO_CLIENTE & "')", Config.CONEXION_SQL) | |
Console.WriteLine("Insertado TABLA_ARCHIVO_CLIENTE. Indice " & indiceNuevo) | |
Trace.WriteLine("Insertado TABLA_ARCHIVO_CLIENTE. Indice " & indiceNuevo) | |
poliza = substrings(2) | |
temp = 10 | |
Dim contadorDeGremios As Integer = Convert.ToInt32(substrings(10)) | |
Trace.WriteLine(vbTab & " Contador de Gremmios: " & contadorDeGremios) | |
For i As Integer = 1 To contadorDeGremios | |
Dim numServicio As String = substrings(temp + 1) | |
Dim codigo As String = substrings(temp + 2) | |
Dim descripcionGremio As String = substrings(temp + 3) | |
Dim dgTam As Integer = descripcionGremio.Length | |
' Vsql.ponComas(indiceNuevo.ToString) | |
Dim ok As Boolean = Vsql.inserta(Config.TABLA_GREMIOS, "indiceCliente,numServicio,codigo,descripcion", | |
indiceNuevo.ToString & "," & Vsql.ponComas(substrings(temp + 1)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 3)) _ | |
, Config.CONEXION_SQL) | |
If Not ok Then | |
' TODO: trazar, o aviso MsgBox NO porque interrumpe proceso, o Excepcion | |
Throw New Exception("Error en inserción de Gremios " & Vsql.ErrorSQL & " Detalles: " & indiceNuevo.ToString & | |
"numServicio : " & numServicio & " codigo: " & codigo & " descripcionGremio: " & descripcionGremio) | |
End If | |
temp = temp + 3 | |
Next | |
If (TipoEncuesta = ArchivoCliente.TIPO_ENCUESTA_COMPANIA1_INDEMNIZABLES And contadorDeGremios1 = 0) Then 'en el tipo de Encuesta 4 de COMPANIA1 (Indemnizables) el contador de Gremios siempre es 0 | |
'no tiene gremios pero tengo que desplazarme los 3 campos porque vienen informados aunque vacíos | |
temp = temp + 3 | |
End If | |
temp = temp + 1 | |
varTel = Convert.ToInt32(substrings(temp)) | |
' ********************************************** | |
' No tiene Telefonos | |
If varTel = 0 Then | |
Throw New Exception("Error NO SE ENCUENTRAN TELEFONOS. Detalles: " & contadorRegistros.ToString & | |
" Datos Siniestro : " & datosSiniestro) | |
End If | |
' ********************************************** | |
' Máximo de teléfonos = 10 ************** | |
If varTel > 10 Then | |
' Log o Correo: Indicar que llegan más de 10 teléfonos | |
Trace.WriteLine(vbTab & " MÁXIMO DE TELÉFONOS SUPERADO " & varTel) | |
varTel = 10 | |
End If | |
temp = temp + 1 | |
ReDim campos((varTel * 2) - 1) | |
ReDim valores((varTel * 2) - 1) | |
' Error: |2 |615515763|02|004798469430|01 | |
Select Case varTel | |
Case 1 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) | |
Case 2 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) | |
Case 3 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
campos(4) = "telefono2" | |
campos(5) = "tipoTelefono2" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
valores(4) = DataValidationHelper.SQLParserTelefono(substrings(temp + 4)) | |
valores(5) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 5)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2,TEL3" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 4)) | |
Case 4 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
campos(4) = "telefono2" | |
campos(5) = "tipoTelefono2" | |
campos(6) = "telefono3" | |
campos(7) = "tipoTelefono3" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
valores(4) = DataValidationHelper.SQLParserTelefono(substrings(temp + 4)) | |
valores(5) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 5)) | |
valores(6) = DataValidationHelper.SQLParserTelefono(substrings(temp + 6)) | |
valores(7) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 7)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2,TEL3,TEL4" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 4)) & "," & Vsql.ponComas(substrings(temp + 6)) | |
Case 5 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
campos(4) = "telefono2" | |
campos(5) = "tipoTelefono2" | |
campos(6) = "telefono3" | |
campos(7) = "tipoTelefono3" | |
campos(8) = "telefono4" | |
campos(9) = "tipoTelefono4" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
valores(4) = DataValidationHelper.SQLParserTelefono(substrings(temp + 4)) | |
valores(5) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 5)) | |
valores(6) = DataValidationHelper.SQLParserTelefono(substrings(temp + 6)) | |
valores(7) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 7)) | |
valores(8) = DataValidationHelper.SQLParserTelefono(substrings(temp + 8)) | |
valores(9) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 9)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2,TEL3,TEL4,TEL5" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 4)) & "," & Vsql.ponComas(substrings(temp + 6)) & "," & Vsql.ponComas(substrings(temp + 8)) | |
Case 6 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
campos(4) = "telefono2" | |
campos(5) = "tipoTelefono2" | |
campos(6) = "telefono3" | |
campos(7) = "tipoTelefono3" | |
campos(8) = "telefono4" | |
campos(9) = "tipoTelefono4" | |
campos(10) = "telefono5" | |
campos(11) = "tipoTelefono5" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
valores(4) = DataValidationHelper.SQLParserTelefono(substrings(temp + 4)) | |
valores(5) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 5)) | |
valores(6) = DataValidationHelper.SQLParserTelefono(substrings(temp + 6)) | |
valores(7) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 7)) | |
valores(8) = DataValidationHelper.SQLParserTelefono(substrings(temp + 8)) | |
valores(9) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 9)) | |
valores(10) = DataValidationHelper.SQLParserTelefono(substrings(temp + 10)) | |
valores(11) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 11)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2,TEL3,TEL4,TEL5,TEL6" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 4)) & "," & Vsql.ponComas(substrings(temp + 6)) & "," & Vsql.ponComas(substrings(temp + 8)) & "," & Vsql.ponComas(substrings(temp + 10)) | |
Case 7 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
campos(4) = "telefono2" | |
campos(5) = "tipoTelefono2" | |
campos(6) = "telefono3" | |
campos(7) = "tipoTelefono3" | |
campos(8) = "telefono4" | |
campos(9) = "tipoTelefono4" | |
campos(10) = "telefono5" | |
campos(11) = "tipoTelefono5" | |
campos(12) = "telefono6" | |
campos(13) = "tipoTelefono6" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
valores(4) = DataValidationHelper.SQLParserTelefono(substrings(temp + 4)) | |
valores(5) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 5)) | |
valores(6) = DataValidationHelper.SQLParserTelefono(substrings(temp + 6)) | |
valores(7) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 7)) | |
valores(8) = DataValidationHelper.SQLParserTelefono(substrings(temp + 8)) | |
valores(9) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 9)) | |
valores(10) = DataValidationHelper.SQLParserTelefono(substrings(temp + 10)) | |
valores(11) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 11)) | |
valores(12) = DataValidationHelper.SQLParserTelefono(substrings(temp + 12)) | |
valores(13) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 13)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2,TEL3,TEL4,TEL5,TEL6,TEL7" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 4)) & "," & Vsql.ponComas(substrings(temp + 6)) & "," & Vsql.ponComas(substrings(temp + 8)) & "," & Vsql.ponComas(substrings(temp + 10)) & "," & Vsql.ponComas(substrings(temp + 12)) | |
Case 8 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
campos(4) = "telefono2" | |
campos(5) = "tipoTelefono2" | |
campos(6) = "telefono3" | |
campos(7) = "tipoTelefono3" | |
campos(8) = "telefono4" | |
campos(9) = "tipoTelefono4" | |
campos(10) = "telefono5" | |
campos(11) = "tipoTelefono5" | |
campos(12) = "telefono6" | |
campos(13) = "tipoTelefono6" | |
campos(14) = "telefono7" | |
campos(15) = "tipoTelefono7" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
valores(4) = DataValidationHelper.SQLParserTelefono(substrings(temp + 4)) | |
valores(5) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 5)) | |
valores(6) = DataValidationHelper.SQLParserTelefono(substrings(temp + 6)) | |
valores(7) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 7)) | |
valores(8) = DataValidationHelper.SQLParserTelefono(substrings(temp + 8)) | |
valores(9) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 9)) | |
valores(10) = DataValidationHelper.SQLParserTelefono(substrings(temp + 10)) | |
valores(11) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 11)) | |
valores(12) = DataValidationHelper.SQLParserTelefono(substrings(temp + 12)) | |
valores(13) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 13)) | |
valores(14) = DataValidationHelper.SQLParserTelefono(substrings(temp + 14)) | |
valores(15) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 15)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2,TEL3,TEL4,TEL5,TEL6,TEL7,TEL8" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 4)) & "," & Vsql.ponComas(substrings(temp + 6)) & "," & Vsql.ponComas(substrings(temp + 8)) & "," & Vsql.ponComas(substrings(temp + 10)) & "," & Vsql.ponComas(substrings(temp + 12)) & "," & Vsql.ponComas(substrings(temp + 14)) | |
Case 9 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
campos(4) = "telefono2" | |
campos(5) = "tipoTelefono2" | |
campos(6) = "telefono3" | |
campos(7) = "tipoTelefono3" | |
campos(8) = "telefono4" | |
campos(9) = "tipoTelefono4" | |
campos(10) = "telefono5" | |
campos(11) = "tipoTelefono5" | |
campos(12) = "telefono6" | |
campos(13) = "tipoTelefono6" | |
campos(14) = "telefono7" | |
campos(15) = "tipoTelefono7" | |
campos(16) = "telefono8" | |
campos(17) = "tipoTelefono8" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
valores(4) = DataValidationHelper.SQLParserTelefono(substrings(temp + 4)) | |
valores(5) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 5)) | |
valores(6) = DataValidationHelper.SQLParserTelefono(substrings(temp + 6)) | |
valores(7) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 7)) | |
valores(8) = DataValidationHelper.SQLParserTelefono(substrings(temp + 8)) | |
valores(9) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 9)) | |
valores(10) = DataValidationHelper.SQLParserTelefono(substrings(temp + 10)) | |
valores(11) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 11)) | |
valores(12) = DataValidationHelper.SQLParserTelefono(substrings(temp + 12)) | |
valores(13) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 13)) | |
valores(14) = DataValidationHelper.SQLParserTelefono(substrings(temp + 14)) | |
valores(15) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 15)) | |
valores(16) = DataValidationHelper.SQLParserTelefono(substrings(temp + 16)) | |
valores(17) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 17)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2,TEL3,TEL4,TEL5,TEL6,TEL7,TEL8,TEL9" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 4)) & "," & Vsql.ponComas(substrings(temp + 6)) & "," & Vsql.ponComas(substrings(temp + 8)) & "," & Vsql.ponComas(substrings(temp + 10)) & "," & Vsql.ponComas(substrings(temp + 12)) & "," & Vsql.ponComas(substrings(temp + 14)) & "," & Vsql.ponComas(substrings(temp + 16)) | |
Case Else 'Case 10 | |
campos(0) = "telefono" | |
campos(1) = "tipoTelefono" | |
campos(2) = "telefono1" | |
campos(3) = "tipoTelefono1" | |
campos(4) = "telefono2" | |
campos(5) = "tipoTelefono2" | |
campos(6) = "telefono3" | |
campos(7) = "tipoTelefono3" | |
campos(8) = "telefono4" | |
campos(9) = "tipoTelefono4" | |
campos(10) = "telefono5" | |
campos(11) = "tipoTelefono5" | |
campos(12) = "telefono6" | |
campos(13) = "tipoTelefono6" | |
campos(14) = "telefono7" | |
campos(15) = "tipoTelefono7" | |
campos(16) = "telefono8" | |
campos(17) = "tipoTelefono8" | |
campos(18) = "telefono9" | |
campos(19) = "tipoTelefono9" | |
valores(0) = DataValidationHelper.SQLParserTelefono(substrings(temp + 0)) | |
valores(1) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 1)) | |
valores(2) = DataValidationHelper.SQLParserTelefono(substrings(temp + 2)) | |
valores(3) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 3)) | |
valores(4) = DataValidationHelper.SQLParserTelefono(substrings(temp + 4)) | |
valores(5) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 5)) | |
valores(6) = DataValidationHelper.SQLParserTelefono(substrings(temp + 6)) | |
valores(7) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 7)) | |
valores(8) = DataValidationHelper.SQLParserTelefono(substrings(temp + 8)) | |
valores(9) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 9)) | |
valores(10) = DataValidationHelper.SQLParserTelefono(substrings(temp + 10)) | |
valores(11) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 11)) | |
valores(12) = DataValidationHelper.SQLParserTelefono(substrings(temp + 12)) | |
valores(13) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 13)) | |
valores(14) = DataValidationHelper.SQLParserTelefono(substrings(temp + 14)) | |
valores(15) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 15)) | |
valores(16) = DataValidationHelper.SQLParserTelefono(substrings(temp + 16)) | |
valores(17) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 17)) | |
valores(18) = DataValidationHelper.SQLParserTelefono(substrings(temp + 18)) | |
valores(19) = DataValidationHelper.SQLParserTipoTelefono(substrings(temp + 19)) | |
camposAR(0) = "INDICE,PRIORITE,STATUSGROUP,STATUS,LIB_STATUS,DETAIL,LIB_DETAIL,RAPPEL,TEL1,TEL2,TEL3,TEL4,TEL5,TEL6,TEL7,TEL8,TEL9,TEL10" | |
valoresAR(0) = Vsql.ponComas(indiceNuevo.ToString) & "," & "'1',NULL,NULL,NULL,NULL,NULL,'Z999999999999'," & Vsql.ponComas(substrings(temp + 0)) & "," & Vsql.ponComas(substrings(temp + 2)) & "," & Vsql.ponComas(substrings(temp + 4)) & "," & Vsql.ponComas(substrings(temp + 6)) & "," & Vsql.ponComas(substrings(temp + 8)) & "," & Vsql.ponComas(substrings(temp + 10)) & "," & Vsql.ponComas(substrings(temp + 12)) & "," & Vsql.ponComas(substrings(temp + 14)) & "," & Vsql.ponComas(substrings(temp + 16)) & "," & Vsql.ponComas(substrings(temp + 18)) | |
End Select | |
'' TODO: ******************************************************* | |
'' Recursos Humanos - Habilidades de Agente - Reglas Distribución | |
'' Comportamiento errático, no sabemos aplicación Regla Distribución Idioma cambia los códigos en PROFIL_RECORD | |
'Dim habilidadIdioma As Byte = Hermes.HabilidadesAgente_Idioma.IDIOMA_ES | |
Dim habilidadIdioma As Byte = Hermes.HabilidadesAgente_Idioma.IDIOMA_CAT | |
If idioma = ArchivoCliente.IDIOMA_CATALAN Then | |
'habilidadIdioma = Hermes.HabilidadesAgente_Idioma.IDIOMA_CAT | |
habilidadIdioma = Hermes.HabilidadesAgente_Idioma.IDIOMA_ES | |
End If | |
camposAR(0) = camposAR(0) & ",PROFIL_RECORD" | |
valoresAR(0) = valoresAR(0) & "," & habilidadIdioma | |
'' Mejorar -- Sql Server hace conversiones .... OJO !!!! ++++++++++ | |
'' update Archivo_Cliente_Informe set telefono=625069186,tipoTelefono=02,telefono1=625069185,tipoTelefono1=02 where indice = '1737' | |
okSql = Vsql.actualiza(Config.TABLA_ARCHIVO_CLIENTE, "where indice = " & indiceNuevo.ToString, campos, valores, Config.CONEXION_SQL) | |
If Not okSql Then | |
' TODO: trazar, o aviso MsgBox NO porque interrumpe proceso, o Excepcion | |
Throw New Exception("Error en update de TABLA_ARCHIVO_CLIENTE " & Vsql.ErrorSQL) | |
End If | |
ReDim campos(2) | |
ReDim valores(2) | |
campos(0) = "FechaCarga" | |
campos(1) = "FicheroCarga" | |
campos(2) = "contTelefonos" | |
valores(0) = Vsql.ponComas(fechaCargaYYYYMMDD) | |
valores(1) = Vsql.ponComas(nombreFicheroCarga) | |
valores(2) = Vsql.ponComas(varTel.ToString) | |
okSql = Vsql.actualiza(Config.TABLA_ARCHIVO_CLIENTE, "where indice = '" & indiceNuevo.ToString & "'", campos, valores, Config.CONEXION_SQL) | |
If Not okSql Then | |
' TODO: trazar, o aviso MsgBox NO porque interrumpe proceso, o Excepcion | |
Throw New Exception("Error en update de TABLA_ARCHIVO_CLIENTE " & Vsql.ErrorSQL) | |
End If | |
Trace.WriteLine(vbTab & " Inserta en " & Config.TABLA_C2_AR_LLAM_CALIDAD_HS) | |
Trace.WriteLine(vbTab & vbTab & camposAR(0)) | |
Trace.WriteLine(vbTab & vbTab & valoresAR(0) & vbCrLf) | |
okSql = Vsql.inserta(Config.TABLA_C2_AR_LLAM_CALIDAD_HS, camposAR(0), valoresAR(0), Config.CONEXION_SQL) | |
If Not okSql Then | |
' TODO: trazar, o aviso MsgBox NO porque interrumpe proceso, o Excepcion | |
Throw New Exception("Error en inserción de TABLA_C2_AR_LLAM_CALIDAD_HS " & Vsql.ErrorSQL) | |
End If | |
' Anular Llamada (en Hermes) para el Tipo Comunicación = SMS | |
Trace.WriteLine(vbTab & " AnularLlamadaParaComunicacionSms. TipoComunicacion: " & TipoComunicacion) | |
EncuestaSms.AnularLlamadaParaComunicacionSms(indiceNuevo, TipoComunicacion) | |
' Anular Llamada (en Hermes) si hubiera algún CLIENTE ROBINSON por POLIZA | |
' Nota: que en todo ArchivoCliente de esa poliza hubiera alguno quese hubiera "Cualificado" como ROBINSON (STATUS = 3) en ArchivoLlamadas | |
Trace.WriteLine(vbTab & " AnularLlamadaParaClienteRobinson. Poliza: " & poliza) | |
EncuestaSms.AnularLlamadaParaClienteRobinson(indiceNuevo, poliza) | |
End If | |
Next | |
Trace.WriteLine(vbCrLf) | |
Trace.WriteLine("Número de Registros del Fichero: " & contadorRegistros) | |
Trace.WriteLine("Número de Registros TRATADOS del Fichero: " & contadorRegistrosTratados & vbCrLf) | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment