Beispiel #1
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public ClientResult GetStatus()
        {
            var result = new ClientResult();

            if (UtcOffset != null)
            {
                int t = OrnamentContext.CorrectClientUtcTime(UtcOffset.Value);
                OrnamentModule.SetClientOffsetHour(t);
            }
            else if (OrnamentModule.GetOffSetHour() != null)
            {
                result.ClientServerOffset = OrnamentModule.GetOffSetHour();
            }


            //refresh online.
            User user = OrnamentContext.MemberShip.CurrentUser();

            if (user != null)
            {
                IMessageDaoFactory daoFactory = OrnamentContext.DaoFactory.MessageDaoFactory;
                int cout = daoFactory.SimpleMessageDao.CountNotifyMsg(user, ReadStatus.UnRead) +
                           daoFactory.PersonalMessageDao.CountNewMessage(user);

                result.IsLogin    = true;
                result.HasMessage = cout != 0;
            }
            else
            {
                result.IsLogin = false;
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static int OffSetHour(this MemberShipContext context)
        {
            int?clientSetting = OrnamentModule.GetOffSetHour();

            if (clientSetting == null)
            {
                return(0);
            }
            return(clientSetting.Value);
        }
Beispiel #3
0
        public static IHtmlString CorrectTimeZone(this HtmlHelper helper, bool refresh)
        {
            const string ssss =
                "<script type=\"text/javascript\">seajs.use([\"/Scripts/Utils.js\"],function (){correctTimeZone(";
            const string a = ");});</script>";

            if (OrnamentModule.GetOffSetHour() == null)
            {
                string edit = refresh ? "true" : "false";
                return(helper.Raw(ssss + edit + a));
            }
            return(helper.Raw(""));
        }
Beispiel #4
0
        public static int GetUtcOffset(this MemberShipContext ocontext)
        {
            int?utcOffset = OrnamentModule.GetOffSetHour();

            return(utcOffset.HasValue ? utcOffset.GetValueOrDefault() : Convert.ToInt32(TimeZoneInfo.Local.BaseUtcOffset.TotalHours));
        }