/// <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); }
/// <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); }
/// <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)); }
/// <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); }
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; }
public MyMessageController(IMessageDaoFactory messageDaoFactory) { _messageDaoFactory = messageDaoFactory; }
public PersonalMessagesController(IMessageDaoFactory factory, IMemberShipFactory memberShipFactory) { _factory = factory; _memberShipFactory = memberShipFactory; }
public ClientSender(IMessageDaoFactory daoFactory) { DaoFactory = daoFactory; }
public TaskController(IMemberShipFactory memberShipFactory, IMessageDaoFactory messageDaoFactory) { _memberShipFactory = memberShipFactory; _messageDaoFactory = messageDaoFactory; }
public NewsController(IMessageDaoFactory factory) { _factory = factory; }
public PersonalController(IMessageDaoFactory messageDaoFactory) { _messageDaoFactory = messageDaoFactory; }
public NewsTypeController(IMessageDaoFactory messageDao) { _messageDao = messageDao; }
/// <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)); }
protected abstract void SaveOrUpdate(T t, IMessageDaoFactory messageDaoFactory);
protected abstract T GetByName(string name, IMessageDaoFactory messageDaoFactory);
protected abstract T CreateInstance(string name, IMessageDaoFactory messageDaoFactory);
protected abstract T GetById(TId id, IMessageDaoFactory messageDaoFactory);
public TemplateController(IMessageDaoFactory daoFactory) { _daoFactory = daoFactory; }
public NotifyMessagesController(IMessageDaoFactory messageDaoFactory) { _messageDaoFactory = messageDaoFactory; }
protected override NotifyMessageTemplate GetByName(string name, IMessageDaoFactory messageDaoFactory) { return(messageDaoFactory.MessageTemplateDao.GetByName(name)); }
protected override void SaveOrUpdate(NotifyMessageTemplate t, IMessageDaoFactory messageDaoFactory) { messageDaoFactory.MessageTemplateDao.SaveOrUpdate(t); }