예제 #1
0
        /// <summary>
        /// Calls Get within try to suppress any Exception from outside of SDK application.
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        private UserStorageMap TryGetUserMap(string userId, string campaignKey)
        {
            try
            {
                LogInfoMessage.LookingUpUserStorageService(file, userId, campaignKey);
                return(this._userStorageService.Get(userId, campaignKey));
            }
            catch (Exception ex)
            {
                LogErrorMessage.GetUserStorageServiceFailed(file, userId, campaignKey);
            }

            return(null);
        }
예제 #2
0
        /// <summary>
        /// Calls Get within try to suppress any Exception from outside of SDK application.
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="campaignKey"></param>
        /// <param name="userStorageData"></param>
        /// <returns></returns>
        private UserStorageMap TryGetUserMap(string userId, string campaignKey, Dictionary <string, dynamic> userStorageData = null)
        {
            try
            {
                LogInfoMessage.LookingUpUserStorageService(file, userId, campaignKey);
                if (userStorageData != null)
                {
                    if (userStorageData.ContainsKey("userId") && userStorageData.ContainsKey("campaignKey") && userStorageData.ContainsKey("variationName"))
                    {
                        if (string.IsNullOrEmpty(userStorageData["userId"]) == false && string.IsNullOrEmpty(userStorageData["campaignKey"]) == false &&
                            string.IsNullOrEmpty(userStorageData["variationName"]) == false)
                        {
                            string jsonString = JsonConvert.SerializeObject(userStorageData);
                            var    allValue   = JsonConvert.DeserializeObject <UserStorageMap>(jsonString);
                            LogInfoMessage.ReturnUserStorageData(file, userStorageData["userId"], userStorageData["campaignKey"]);
                            return(allValue);
                        }
                        else
                        {
                            return(this._userStorageService.Get(userId, campaignKey));
                        }
                    }
                    else
                    {
                        return(this._userStorageService.Get(userId, campaignKey));
                    }
                }
                else
                {
                    return(this._userStorageService.Get(userId, campaignKey));
                }
            }
            catch (Exception ex)
            {
                LogErrorMessage.GetUserStorageServiceFailed(file, userId, campaignKey);
            }

            return(null);
        }