예제 #1
0
        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;
        }
예제 #2
0
        } // 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;
        }
예제 #3
0
 public void Close()
 {
     SessionPool.DevolverSesion(uui);
 }