public GestionDesembolsoResponse NotificarEstadoDesembolso(GestionDesembolsoRequest NotificacionDesembolsoRequest)
        {
            ControladorGestionDesembolso manager   = new ControladorGestionDesembolso();
            GestionDesembolsoResponse    respuesta = manager.ProcesarSolicitud(NotificacionDesembolsoRequest);

            return(respuesta);
        }
        //Deprecado, este codigo no funciona pero puede servir de base para algo mas adelante, con una revisión del por qué no funcionó.
        private GestionDesembolsoResponse getRespuestaBO(XmlDocument respuesta, EnumSOALayerAction tipoAccion)
        {
            GestionDesembolsoResponse respServicio = new GestionDesembolsoResponse();
            XmlNode ErrorStruct = respuesta.SelectSingleNode("//processes/process/processError/errorCode");

            //no hubo errores?
            if (ErrorStruct.Value == null)
            {
                //crear respuesta de exito
                respServicio.Codigo  = Properties.Resources.CodigoExitoBizagi;
                respServicio.Mensaje = Properties.Resources.MsgExitoCrearCaso;
                switch (tipoAccion)
                {
                case EnumSOALayerAction.CreateCase:
                    string idcase = respuesta.SelectSingleNode("//processes/process/processId").Value;
                    respServicio.processId = Convert.ToInt32(idcase);
                    respServicio.radNumber = respuesta.SelectSingleNode("//process/processRadNumber").ToString();
                    break;
                }
            }//si hubo error en el arbol de respuesta.
            else
            {
                respServicio.ErrorSistema.Codigo = respuesta.SelectSingleNode("//process/processError/errorCode").ToString();
                XmlNode Mensaje = respuesta.SelectSingleNode("//process/processError/errorMessage");
                if (Mensaje.HasChildNodes)
                {
                    respServicio.ErrorSistema.Mensaje = Mensaje.SelectSingleNode("//process/processError/errorMessage/Entities/ErrorMessage").ToString();
                }
                else
                {
                    respServicio.ErrorSistema.Mensaje = Mensaje.SelectSingleNode("//process/processError/errorMessage").ToString();
                }
                respServicio.Codigo = Properties.Resources.ErrorTecnico;
                switch (tipoAccion)
                {
                case EnumSOALayerAction.CreateCase:

                    respServicio.Mensaje = Properties.Resources.MsgErrorCreandoCaso;

                    break;

                case EnumSOALayerAction.PerformActivity:

                    respServicio.Mensaje = Properties.Resources.MsgErrorPerformActivity;
                    break;
                }
            }
            return(respServicio);
        }
        private GestionDesembolsoResponse getRespuestaBO(processes crearCasoResp, EnumSOALayerAction tipoAccion)
        {
            GestionDesembolsoResponse respServicio = new GestionDesembolsoResponse();
            string errorCode = crearCasoResp.process[0].processError.errorCode;

            if (errorCode != null && errorCode.Length > 0)
            {
                respServicio.Codigo = Properties.Resources.ErrorTecnico;
                respServicio.ErrorSistema.Codigo = errorCode;
                if (crearCasoResp.process[0].processError.errorMessage.Entities == null)
                {
                    respServicio.ErrorSistema.Mensaje = crearCasoResp.process[0].processError.errorMessage.Text[0];
                }
                else
                {
                    respServicio.ErrorSistema.Mensaje = crearCasoResp.process[0].processError.errorMessage.Entities.ErrorMessage;
                }
                switch (tipoAccion)
                {
                case EnumSOALayerAction.CreateCase:
                    respServicio.Mensaje = Properties.Resources.MsgErrorCreandoCaso;
                    break;

                case EnumSOALayerAction.PerformActivity:
                    respServicio.Mensaje = Properties.Resources.MsgErrorPerformActivity;
                    break;
                }
            }
            else
            {
                respServicio.Codigo = Properties.Resources.CodigoExitoBizagi;
                switch (tipoAccion)
                {
                case EnumSOALayerAction.CreateCase:
                    respServicio.processId = int.Parse(crearCasoResp.process[0].processId);
                    respServicio.Mensaje   = Properties.Resources.MsgExitoCrearCaso;
                    respServicio.radNumber = crearCasoResp.process[0].processRadNumber;
                    break;

                case EnumSOALayerAction.PerformActivity:
                    respServicio.Mensaje = Properties.Resources.MsgExitoPerformaActivity;
                    break;
                }
            }
            return(respServicio);
        }
        public GestionDesembolsoResponse ProcesarSolicitud(GestionDesembolsoRequest notificacion)
        {
            try
            {
                string numeroTramite = notificacion.InformacionDesembolso.NumeroTramite;
                respuesta = new GestionDesembolsoResponse();
                InfoCasoDesembolso infoCasoDesembolso = consultarCasoDesembolsoPorTramite(numeroTramite);



                if (infoCasoDesembolso == null)
                {
                    // crear caso
                    respuesta = crearCasoDesembolso(notificacion);
                    return(respuesta);
                }
                else
                {
                    //valida que la estación que ejecuta la actividad sea la misma asociada en Bizagi. Si ha cambiado en Cobis, se consulta la estación en Bizagi para
                    //enviarla en el perform activity, y asi registrar la estación que realmente ejecuta la acción.
                    //PENDIENTE IMPLEMENTACIÓN
                    //if (!notificacion.InformacionEstacion.TipoIdentificacionEstacion.Codigo.Equals(infoCasoDesembolso.OidTrackingDesembolso.OidTipoDocumentoEstac.SCodigo) &&
                    //    !notificacion.InformacionEstacion.IdentificacionEstacion.Equals(infoCasoDesembolso.OidTrackingDesembolso.SIdentificacionEstacion))
                    //{
                    //    InformacionEstacionBO datosEstacion = consultarUsuariosPorID(notificacion.InformacionEstacion.TipoIdentificacionEstacion.Codigo, notificacion.InformacionEstacion.IdentificacionEstacion);
                    //}
                    // perform activity
                    return(performActivity2(notificacion, infoCasoDesembolso));
                }
            }
            catch (Exception e)
            {
                respuesta.Codigo  = Properties.Resources.ErrorTecnico;
                respuesta.Mensaje = e.Message;
            }
            return(respuesta);
        }