Example #1
0
        private bool ApiTolenIsValid()
        {
            bool result = false;

            try
            {
                string         key        = GetSettingFromCosmos("Key");
                APISendingBlue sendinBlue = new APISendingBlue(key);
                dynamic        account    = sendinBlue.get_account();
                if (account.code == "success")
                {
                    result = true;
                }
            }
            catch (Exception e)
            {
                var messageException = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(messageException);
            }
            return(result);
        }
Example #2
0
        public bool ValidateApiKey(string Key)
        {
            bool result = false;

            try
            {
                if (Key != string.Empty)
                {
                    APISendingBlue sendinBlue     = new APISendingBlue(Key);
                    dynamic        authentication = sendinBlue.get_account();
                    if (authentication.code == "success")
                    {
                        result = true;
                    }
                }
            }
            catch (Exception e)
            {
                string exceptionMessage = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(exceptionMessage);
            }
            return(result);
        }
Example #3
0
        public string GetAccountEmail()
        {
            string email = string.Empty;

            try
            {
                if (ApiKey != string.Empty)
                {
                    APISendingBlue sendinBlue     = new APISendingBlue(ApiKey);
                    dynamic        authentication = sendinBlue.get_account();
                    if (authentication.code == "success")
                    {
                        email = authentication.data[2].email;
                    }
                }
            }
            catch (Exception e)
            {
                string exceptionMessage = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(exceptionMessage);
            }
            return(email);
        }