GetSendInfoDao() public method

public GetSendInfoDao ( ) : ISendInfoDao
return ISendInfoDao
Beispiel #1
0
        /// <summary>
        /// Subscribe user to get push message
        /// </summary>
        /// <param name="deviceToken"></param>
        /// <param name="deviceType"></param>
        /// <param name="accessToken"></param>
        public void Subscribe(string deviceToken, DeviceType deviceType, string accessToken, ApplicationType?appType)
        {
            try
            {
                string userName = new AuthWorker(Options.OAuthUrl, Options.OAuthRedirectUrl, Options.OAuthSecret,
                                                 Options.OAuthAppId).GetUserInfo(accessToken).username;

                if (userName != null)
                {
                    var sendInfo = mssqlDaoFactory.GetSendInfoDao().Find(userName);

                    if (sendInfo != null)
                    {
                        settingsService.SubscribePushNotification(deviceToken, deviceType, sendInfo, appType);
                    }
                }
                else
                {
                    throw new ApplicationException(string.Format("Invalid access token {0}", accessToken));
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Set user location
        /// </summary>
        /// <param name="city"></param>
        /// <param name="name"></param>
        public void SetUserLocation(string city, string name)
        {
            if (String.IsNullOrEmpty(city))
            {
                return;
            }

            factory.GetSendInfoDao().Update(new SendInfo
            {
                UserName          = name,
                City              = city,
                WeatherUpdateDt   = null,
                LastWeatherUpdate = null
            });
        }