Exemple #1
0
 public CredencialApiModel(CredencialApiModel objCopy)
 {
     if (objCopy != null)
     {
         url      = objCopy.url;
         database = objCopy.database;
         userName = objCopy.userName;
         password = objCopy.password;
     }
 }
Exemple #2
0
 public UsuarioModel(UsuarioModel objCopy)
 {
     if (objCopy != null)
     {
         id                     = objCopy.id;
         userName               = objCopy.userName;
         password               = objCopy.password;
         relationPersona        = new PersonalModel(objCopy.relationPersona);
         relationRol            = new RolModel(objCopy.relationRol);
         relationCredentialsApi = new CredencialApiModel(objCopy.relationCredentialsApi);
     }
 }
Exemple #3
0
        // CONSIDERAR RETORNAR UN OBJETO QUE CONTENGA UNA RESPUESTA ABSURDA
        // PARA EL LOGIN O PARA CUALQUIER OTRO TIPO DE PETICION


        /// <summary>
        /// Retorna el ID del usuario con permisos para acceder a la API
        /// </summary>
        /// <returns></returns>
        public long accessApi()
        {
            CredencialApiModel          credencialAccess = read(relationTipoCredencial.id);
            Dictionary <string, object> mapAccess        = new Dictionary <string, object>();
            long idUserOdoo = default;

            if (!isNull(credencialAccess))
            {
                conexionXmlRpc.setUpConnectionData(credencialAccess.assignCredential());
                conexionXmlRpc.execute();
                if (conexionXmlRpc.success())
                {
                    idUserOdoo = long.Parse(conexionXmlRpc.responseData());
                }
            }
            return(idUserOdoo);
        }
Exemple #4
0
        /// <summary>
        /// Obtiene las credenciales en caso de existir
        /// </summary>
        /// <returns></returns>
        public CredencialApiModel read(long idTipoCredencial)
        {
            CredencialApiModel credencialOut = null;

            using (TMS_DBEntities db = new TMS_DBEntities())
            {
                var result = db.sp_accesoApiOdoo(userName, password, (int)idTipoCredencial).FirstOrDefault();
                if (result != null)
                {
                    credencialOut = new CredencialApiModel
                    {
                        userName = result.username.Trim(),
                        password = result.pass.Trim(),
                        url      = result.urlAcceso.Trim(),
                        database = result.dbNombre.Trim()
                    };
                }
                return(credencialOut);
            }
        }
Exemple #5
0
 public UsuarioModel(long id = default, string userName = "******", string password = "******", PersonalModel relationPersona = null, RolModel relationRol = null, CredencialApiModel relationCredentialsApi = null)
 {
     this.id                     = id;
     this.userName               = userName;
     this.password               = password;
     this.relationPersona        = new PersonalModel(relationPersona);
     this.relationRol            = new RolModel(relationRol);
     this.relationCredentialsApi = new CredencialApiModel(relationCredentialsApi);
 }