public LedorVadorResponse SendPackages(LedorVadorRequest request) { LedorVadorResponse response = new LedorVadorResponse(); int aceptados = 0, omitidos = 0; string warningMsg = "", exceptionMsg = ""; // DbHandler db = new DbHandler(ConfigurationManager.ConnectionStrings["db"].ConnectionString); request.login = ConfigurationManager.AppSettings.Get("LOGIN"); request.password = ConfigurationManager.AppSettings.Get("PASS"); db.Using(request.login, request.password, (SqlConnection conn) => { // foreach (LedorVadorFlowPackage package in request.packages) { try { logger.write("Leyendo documento " + package.documento_externId + " cliente " + package.histClinica + " " + package.razonSocial); string localWarningMsg = ""; localWarningMsg = CheckPackage(package); if (localWarningMsg == "") //Si se genero un mensaje de warning se omite directamente el paquete. { localWarningMsg = savePackage(db, conn, package); } warningMsg += localWarningMsg; aceptados++; } catch (Exception e) { logger.write(e.ToString()); exceptionMsg += Environment.NewLine + e.ToString().Substring(0, 300); omitidos++; } } // }, (string exMessage) => { exceptionMsg += Environment.NewLine + exMessage.Substring(0, 300); }); // response.responseMessage = " Aceptados [" + aceptados + "]"; response.responseMessage += " Omitidos [" + omitidos + "]"; if (warningMsg != "") { response.responseMessage += " Warning [" + warningMsg + "]"; } if (exceptionMsg != "") { response.responseMessage += Environment.NewLine + " ServerExceptions [" + exceptionMsg + "]"; } return(response); }
public LedorVadorResponse SendPackages(LedorVadorRequest request) { LedorVadorResponse response = new LedorVadorResponse(); int aceptados = 0, omitidos = 0; string warningMsg = "", exceptionMsg = ""; // DbHandler db = new DbHandler(ConfigurationManager.ConnectionStrings["db"].ConnectionString); request.login = ConfigurationManager.AppSettings.Get("LOGIN"); request.password = ConfigurationManager.AppSettings.Get("PASS"); db.Using(request.login, request.password, (SqlConnection conn) => { // foreach (LedorVadorFlowPackage package in request.packages) { try { logger.write("Leyendo documento " + package.documento_externId + " cliente " + package.histClinica + " " + package.razonSocial); string localWarningMsg = ""; localWarningMsg = CheckPackage(package); if (localWarningMsg == "") { //Si se genero un mensaje de warning se omite directamente el paquete. localWarningMsg = savePackage(db, conn, package); } warningMsg +=localWarningMsg; aceptados++; } catch (Exception e) { logger.write(e.ToString()); exceptionMsg += Environment.NewLine + e.ToString().Substring(0,300); omitidos++; } } // }, (string exMessage) => { exceptionMsg += Environment.NewLine + exMessage.Substring(0,300); }); // response.responseMessage = " Aceptados [" + aceptados + "]"; response.responseMessage += " Omitidos [" + omitidos + "]"; if (warningMsg != "") { response.responseMessage += " Warning [" + warningMsg + "]"; } if (exceptionMsg != "") { response.responseMessage += Environment.NewLine + " ServerExceptions [" + exceptionMsg + "]"; } return response; }