public ResultadoVO crearDocumento(DocumentoVO documento) { Sesion sesion = SessionPool.getSession(); this.company = sesion.company; this.documentoVO = documento; // TODO: intentar habilitar transacciones nuevamente // company.StartTransaction(); try { CrearDocumentoSAP(); if (company.InTransaction) { if (this.resultadoVO.Success) company.EndTransaction(BoWfTransOpt.wf_Commit); else company.EndTransaction(BoWfTransOpt.wf_RollBack); } } catch (Exception e) { if (company.InTransaction) company.EndTransaction(BoWfTransOpt.wf_RollBack); log.Error(e); this.resultadoVO.Success = false; this.resultadoVO.Mensaje = e.Message; } finally { sesion.Close(); } return this.resultadoVO; }
} // Conectar public static Sesion getSession() { Sesion sesion = null; if (sesionesDisponibles.Count == 0) SessionPool.Refresh(); if (sesionesDisponibles.TryDequeue(out sesion)) { sesionesUso.Add(sesion.uui, sesion); } return sesion; }
public void Close() { SessionPool.DevolverSesion(uui); }