public function grabarusuarionormaldataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $usuario_id = $SesionUsuarioPlugin->getUsuarioId();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $UsuarioData = new UsuarioData();
         $UsuarioBO = new UsuarioBO();
         //$PerfilBO 				= new PerfilBO();
         $GrupoDispoCabBO = new GrupoDispoCabBO();
         $GrupoPrecioCabBO = new GrupoPrecioCabBO();
         $InventarioBO = new InventarioBO();
         $CalidadBO = new CalidadBO();
         $UsuarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $GrupoDispoCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $accion = $json['accion'];
         //I, M
         $UsuarioData->setId($json['id']);
         $UsuarioData->setClienteId($json['cliente_id']);
         $UsuarioData->setNombre($json['nombre']);
         $UsuarioData->setUsername($json['username']);
         $UsuarioData->setPassword($json['password']);
         $UsuarioData->setEmail($json['email']);
         $UsuarioData->setPerfilId(\Application\Constants\Perfil::ID_CLIENTE);
         $UsuarioData->setEstado($json['estado']);
         $UsuarioData->setGrupoDispoCabId($json['grupo_dispo_cab_id']);
         $UsuarioData->setGrupoPrecioCabId($json['grupo_precio_cab_id']);
         $UsuarioData->setInventarioId($json['inventario_id']);
         $UsuarioData->setCalidadId($json['calidad_id']);
         $response = new \stdClass();
         switch ($accion) {
             case 'I':
                 $UsuarioData->setUsuarioIngId($usuario_id);
                 $result = $UsuarioBO->ingresar($UsuarioData);
                 break;
             case 'M':
                 $UsuarioData->setUsuarioModId($usuario_id);
                 $result = $UsuarioBO->modificar($UsuarioData);
                 break;
             default:
                 $result['validacion_code'] = 'ERROR';
                 $result['respuesta_mensaje'] = 'ACCESO NO VALIDO';
                 break;
         }
         //end switch
         //Se consulta el registro siempre y cuando el validacion_code sea OK
         if ($result['validacion_code'] == 'OK') {
             $row = $UsuarioBO->consultar($json['id'], \Application\Constants\ResultType::MATRIZ);
         } else {
             $row = null;
         }
         //end if
         //Retorna la informacion resultante por JSON
         $response = new \stdClass();
         $response->respuesta_code = 'OK';
         $response->validacion_code = $result['validacion_code'];
         $response->respuesta_mensaje = $result['respuesta_mensaje'];
         if ($row) {
             $response->row = $row;
             //$response->cbo_perfil_id		= $PerfilBO->getComboPerfilRestringido($row['perfil_id'], " ");
             $response->cbo_cbo_grupo_dispo = $GrupoDispoCabBO->getComboGrupoDispo($row['grupo_dispo_cab_id'], " ");
             $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
         } else {
             $response->row = null;
             $response->cbo_tipo = '';
             $response->cbo_estado = '';
         }
         //end if
         $json = new JsonModel(get_object_vars($response));
         return $json;
         //false
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }
 function getcomboAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $GrupoDispoCabBO = new GrupoDispoCabBO();
         $GrupoDispoCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLogin();
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         //var_dump($json); exit;
         $texto_primer_elemento = $json['texto_primer_elemento'];
         $grupo_dispo_cab_id = $json['grupo_dispo_cab_id'];
         $cliente_id = $SesionUsuarioPlugin->getUserClienteId();
         $opciones = $GrupoDispoCabBO->getComboGrupoDispo($grupo_dispo_cab_id, $texto_primer_elemento);
         $response = new \stdClass();
         $response->opciones = $opciones;
         $response->respuesta_code = 'OK';
         $json = new JsonModel(get_object_vars($response));
         return $json;
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }