예제 #1
0
        public static bool IsAccessTokenExired(string access_token)
        {
            var token     = new AccessTokenLog();
            var isExpired = true;

            try
            {
                using (var context = new InterswitchNameEnquiryEntities())
                {
                    token = context.AccessTokenLogs.FirstOrDefault(g => g.AccessToken.Trim() == access_token.Trim());
                }
                if (token != null)
                {
                    if (token.ExpiryDate >= DateTime.Now)
                    {
                        isExpired = true;
                    }
                }
            }
            catch (Exception ext)
            {
                Utils.LogError(ext, "Failed to check IsAccessTokenExired ");
            }
            return(isExpired);
        }
예제 #2
0
 public static void SaveAccessToken(AccessTokenLog token)
 {
     try
     {
         using (var context = new InterswitchNameEnquiryEntities())
         {
             context.AccessTokenLogs.Add(token);
             context.SaveChanges();
         }
     }
     catch (Exception ext)
     {
         Utils.LogError(ext, "Failed to create AccessTokenLog ");
     }
 }