public ConsumerAuthEN GetAuthKey(string Token) { ConsumerAuthEN AuthKey = new ConsumerAuthEN(); try { connection.Cnn.Open(); AuthKey = connection.Cnn.Query <ConsumerAuthEN>(@"SELECT TOP 1 ConsumerAuthID, ConsumerID, ConsumerAuthKey, RegDate FROM Consumer.ConsumerAuth WHERE ConsumerAuthKey = @consumerAuthKey", new { consumerAuthKey = Token, }).FirstOrDefault(); EventViewerLoggerDAL.LogError("GetAuthKey... ConsumerID: " + AuthKey.ConsumerID.ToString()); } catch (Exception ex) { Console.WriteLine("Error GetAuthKey: " + ex.Message); EventViewerLoggerDAL.LogError(ex.Message); AuthKey = null; } finally { connection.Cnn.Close(); } return(AuthKey); }
public FacebookConsumerEN authenticateConsumer(string Token) { FacebookConsumerEN ConsumerDecoded = new FacebookConsumerEN(); try { ConsumerAuthEN AuthKey = sessionDAL.GetAuthKey(Token); string decodedProfileId = jwt.decodeFacebookID(AuthKey.ConsumerAuthKey); ConsumerDecoded = sessionDAL.GetFacebookConsumer(decodedProfileId); } catch (Exception ex) { Console.WriteLine(ex.InnerException); EventViewerLoggerBL.LogError(ex.Message); } return(ConsumerDecoded); }