Пример #1
0
        private static double GetSesisonTimeOutForUser(BunqModel user)
        {
            int?sessionTimeout;

            if (user.GetType() == typeof(UserPerson))
            {
                sessionTimeout = ((UserPerson)user).SessionTimeout;
            }
            else if (user.GetType() == typeof(UserCompany))
            {
                sessionTimeout = ((UserCompany)user).SessionTimeout;
            }
            else
            {
                throw new BunqException(ErrorCouldNotDetermineSessionTimeout);
            }

            return(GetDoubleFromSessionTimeout(sessionTimeout));
        }
Пример #2
0
 private void SetUser(BunqModel user)
 {
     if (user.GetType() == typeof(UserPerson))
     {
         UserPerson = (UserPerson)user;
     }
     else if (user.GetType() == typeof(UserCompany))
     {
         UserCompany = (UserCompany)user;
     }
     else if (user.GetType() == typeof(UserApiKey))
     {
         UserApiKey = (UserApiKey)user;
     }
     else if (user.GetType() == typeof(UserPaymentServiceProvider))
     {
         UserPaymentServiceProvider = (UserPaymentServiceProvider)user;
     }
     else
     {
         throw new BunqException(FIELD_ERROR_COULD_NOT_DETERMINE_SESSION_TIMEOUT);
     }
 }
Пример #3
0
        private static double GetSessionTimeOutForUser(BunqModel user)
        {
            int?sessionTimeout;

            if (user.GetType() == typeof(UserPerson))
            {
                sessionTimeout = ((UserPerson)user).SessionTimeout;
            }
            else if (user.GetType() == typeof(UserCompany))
            {
                sessionTimeout = ((UserCompany)user).SessionTimeout;
            }
            else if (user.GetType() == typeof(UserPaymentServiceProvider))
            {
                sessionTimeout = ((UserPaymentServiceProvider)user).SessionTimeout;
            }
            else
            {
                throw new BunqException(FIELD_ERROR_COULD_NOT_DETERMINE_SESSION_TIMEOUT);
            }

            return(GetDoubleFromSessionTimeout(sessionTimeout));
        }