예제 #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);
        }
 /// <summary>
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 protected override NotifyType GetByName(string name, IMessageDaoFactory messageDaoFactory)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     return(messageDaoFactory.NotifyTypeDao.GetByName(name));
 }
 /// <summary>
 /// </summary>
 /// <param name="t"></param>
 protected override void SaveOrUpdate(NotifyType t, IMessageDaoFactory messageDaoFactory)
 {
     if (t == null)
     {
         throw new ArgumentNullException("t");
     }
     messageDaoFactory.NotifyTypeDao.SaveOrUpdate(t);
 }
예제 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="dao"></param>
 /// <exception cref="ArgumentNullException">dao is null</exception>
 public void Save(IMessageDaoFactory dao)
 {
     if (dao == null)
         throw new ArgumentNullException("dao");
     NewsType type = Id != null ? dao.NewsTypeDao.Get(Id) : new NewsType(Name);
     type.Name = Name;
     type.Remark = Remark;
     dao.NewsTypeDao.SaveOrUpdate(type);
 }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dao"></param>
        /// <exception cref="ArgumentNullException">dao is null</exception>
        public void Save(IMessageDaoFactory dao)
        {
            if (dao == null)
            {
                throw new ArgumentNullException("dao");
            }
            NewsType type = Id != null?dao.NewsTypeDao.Get(Id) : new NewsType(Name);

            type.Name   = Name;
            type.Remark = Remark;
            dao.NewsTypeDao.SaveOrUpdate(type);
        }
 protected override NotifyType CreateInstance(string name, IMessageDaoFactory messageDaoFactory)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     return(new NotifyType
     {
         CommunicationType = CommunicationType.Email,
         Name = name
     });
 }
 protected override NotifyType GetById(string id, IMessageDaoFactory messageDaoFactory)
 {
     if (id == null)
     {
         throw new ArgumentNullException("id");
     }
     if (id.Length != 32)
     {
         throw new ArgumentOutOfRangeException("id", "Id should be 32 length.");
     }
     return(messageDaoFactory.NotifyTypeDao.Get(id));
 }
예제 #8
0
        /// <summary>
        /// 根据名字获取NotifymessageTemplate
        /// </summary>
        /// <param name="name"></param>
        /// <param name="messageDaoFactory"></param>
        /// <returns></returns>
        protected override NotifyMessageTemplate CreateInstance(string name, IMessageDaoFactory messageDaoFactory)
        {
            var result = new NotifyMessageTemplate(_notifyType)
            {
                Name   = name,
                Remark = _remark,
                Type   = _notifyType
            };

            foreach (Content content in _contents)
            {
                result.Contents.Add(content.Language, content);
            }
            return(result);
        }
예제 #9
0
        public T Get(IMessageDaoFactory messageDaoFactory)
        {
            T result = null;

            if (!object.ReferenceEquals(_id, default(TId)) && _id != null)
            {
                result = GetById(_id, messageDaoFactory);
            }

            if (result == null)
            {
                result = GetByName(_name, messageDaoFactory);
                if (result == null)
                {
                    result = CreateInstance(_name, messageDaoFactory);
                    SaveOrUpdate(result, messageDaoFactory);
                }
                _id = result.Id;
            }
            return(result);
        }
 /// <summary>
 /// </summary>
 /// <param name="messageDao"></param>
 public NotifyTypeController(IMessageDaoFactory messageDao)
 {
     _notifyTypeDao = messageDao.NotifyTypeDao;
 }
예제 #11
0
 /// <summary>
 /// </summary>
 /// <param name="messageDao"></param>
 public NotifyTypeController(IMessageDaoFactory messageDao)
 {
     _notifyTypeDao = messageDao.NotifyTypeDao;
 }
예제 #12
0
 public MyMessageController(IMessageDaoFactory messageDaoFactory)
 {
     _messageDaoFactory = messageDaoFactory;
 }
 public PersonalMessagesController(IMessageDaoFactory factory, IMemberShipFactory memberShipFactory)
 {
     _factory           = factory;
     _memberShipFactory = memberShipFactory;
 }
예제 #14
0
 public ClientSender(IMessageDaoFactory daoFactory)
 {
     DaoFactory = daoFactory;
 }
예제 #15
0
 public TaskController(IMemberShipFactory memberShipFactory, IMessageDaoFactory messageDaoFactory)
 {
     _memberShipFactory = memberShipFactory;
     _messageDaoFactory = messageDaoFactory;
 }
예제 #16
0
 public TaskController(IMemberShipFactory memberShipFactory, IMessageDaoFactory messageDaoFactory)
 {
     _memberShipFactory = memberShipFactory;
     _messageDaoFactory = messageDaoFactory;
 }
예제 #17
0
 public NewsController(IMessageDaoFactory factory)
 {
     _factory = factory;
 }
 public PersonalController(IMessageDaoFactory messageDaoFactory)
 {
     _messageDaoFactory = messageDaoFactory;
 }
 public NewsTypeController(IMessageDaoFactory messageDao)
 {
     _messageDao = messageDao;
 }
예제 #20
0
 /// <summary>
 /// 根据Id获取NotifyMessageTemplate
 /// </summary>
 /// <param name="id"></param>
 /// <param name="messageDaoFactory"></param>
 /// <returns></returns>
 protected override NotifyMessageTemplate GetById(string id, IMessageDaoFactory messageDaoFactory)
 {
     return(messageDaoFactory.MessageTemplateDao.Get(id));
 }
예제 #21
0
 protected abstract void SaveOrUpdate(T t, IMessageDaoFactory messageDaoFactory);
예제 #22
0
 protected abstract T GetByName(string name, IMessageDaoFactory messageDaoFactory);
예제 #23
0
 protected abstract T CreateInstance(string name, IMessageDaoFactory messageDaoFactory);
예제 #24
0
 protected abstract T GetById(TId id, IMessageDaoFactory messageDaoFactory);
예제 #25
0
 public ClientSender(IMessageDaoFactory daoFactory)
 {
     DaoFactory = daoFactory;
 }
 public TemplateController(IMessageDaoFactory daoFactory)
 {
     _daoFactory = daoFactory;
 }
예제 #27
0
 public NotifyMessagesController(IMessageDaoFactory messageDaoFactory)
 {
     _messageDaoFactory = messageDaoFactory;
 }
 public PersonalMessagesController(IMessageDaoFactory factory, IMemberShipFactory memberShipFactory)
 {
     _factory = factory;
     _memberShipFactory = memberShipFactory;
 }
 public MyMessageController(IMessageDaoFactory messageDaoFactory)
 {
     _messageDaoFactory = messageDaoFactory;
 }
예제 #30
0
 protected override NotifyMessageTemplate GetByName(string name, IMessageDaoFactory messageDaoFactory)
 {
     return(messageDaoFactory.MessageTemplateDao.GetByName(name));
 }
예제 #31
0
 public NewsController(IMessageDaoFactory factory)
 {
     _factory = factory;
 }
예제 #32
0
 protected override void SaveOrUpdate(NotifyMessageTemplate t, IMessageDaoFactory messageDaoFactory)
 {
     messageDaoFactory.MessageTemplateDao.SaveOrUpdate(t);
 }
 public TemplateController(IMessageDaoFactory daoFactory)
 {
     _daoFactory = daoFactory;
 }
 public NotifyMessagesController(IMessageDaoFactory messageDaoFactory)
 {
     _messageDaoFactory = messageDaoFactory;
 }
 public PersonalController(IMessageDaoFactory messageDaoFactory)
 {
     _messageDaoFactory = messageDaoFactory;
 }
 public NewsTypeController(IMessageDaoFactory messageDao)
 {
     _messageDao = messageDao;
 }