Created
April 9, 2014 16:26
-
-
Save paulomcnally/10288958 to your computer and use it in GitHub Desktop.
This file contains 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
exports.guardar = function( req, res ){ | |
var ids = []; | |
var index = 0; | |
var data = JSON.parse( req.body.data ); | |
res.mssql.connect( 'isadb01', 'Intranet'); | |
data.forEach( function( apunte ){ | |
var request = new res.mssql.sql.Request(res.mssql.connection); | |
request.input('LAL_Nodriza', res.mssql.sql.NVarChar, apunte.nodriza); | |
request.input('LAL_Equipo', res.mssql.sql.NVarChar, apunte.equipo); | |
request.input('LAL_Odometro', res.mssql.sql.Decimal, apunte.odometro) | |
request.input('LAL_Odometro_UDM', res.mssql.sql.NVarChar, apunte.odometro_udm ); | |
request.input('LAL_Observaciones', res.mssql.sql.NVarChar, apunte.observaciones); | |
request.input('LAL_Creado_USR', res.mssql.sql.NVarChar, apunte.creado_usr); | |
request.input('LAL_MOD_USR', res.mssql.sql.NVarChar, apunte.mod_usr); | |
request.input('LAL_Fecha_Apunte', res.mssql.sql.DateTime, new Date( apunte.fecha_apunte ) ); | |
request.execute('[Agroindustria].[SP_LBR_Apuntes_Lubricante_Insertar]', function(err1, recordsets1, returnValue1) { | |
if( err1 ){ | |
res.jarError( 400, 'LubricantesGuardar', err1.message, 400 ); | |
} | |
else{ | |
res.jarResponse( recordsets1 ) | |
} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment