private Notify GetNotify(NotifyProxy proxy) { if (proxy == null) { return(null); } Notify notify = new Notify(); notify.NotifyID = proxy.NotifyID; notify.Content = proxy.Content; //notifyProxy.Url = notify.Url; notify.UserID = proxy.UserID; foreach (NotifyActionProxy action in proxy.Actions) { notify.Actions.Add(new NotifyAction(action.Title, action.Url, action.IsDialog)); } notify.TypeName = proxy.TypeName; notify.ClientID = proxy.ClientID; notify.TypeID = proxy.TypeID; notify.Keyword = proxy.Keyword; notify.IsRead = proxy.IsRead; notify.UpdateDate = proxy.UpdateDate; notify.CreateDate = proxy.PostDate; notify.DataTable = new StringTable(); foreach (StringKeyValueProxy item in proxy.DataTable) { notify.DataTable.Add(item.Key, item.Value); } return(notify); }
public Notify GetNotify(int operatorID, int notifyID) { if (operatorID <= 0) { ThrowError(new NotLoginError()); return(null); } if (notifyID <= 0) { ThrowError(new InvalidParamError("notifyID")); return(null); } #if !Passport PassportClientConfig config = Globals.PassportClient; if (config.EnablePassport) { NotifyProxy notify = config.PassportService.Notify_GetNotify(operatorID, notifyID); if (notify == null) { return(null); } //if(T is friend return(GetNotify(notify)); } else #endif { Notify notify = NotifyDao.Instance.GetNotify <Notify>(null, notifyID, false); if (notify != null) { if (notify.UserID == operatorID) { return(notify); } if (ManagePermission.Can(operatorID, BackendPermissions.ActionWithTarget.Manage_Notify, notify.UserID)) { return(notify); } } return(null); } }
public static NotifyProxy GetNotifyProxy(Notify notify) { if (notify == null) { return(null); } NotifyProxy notifyProxy = new NotifyProxy(); notifyProxy.NotifyID = notify.NotifyID; notifyProxy.Content = notify.Content; //notifyProxy.Url = notify.Url; notifyProxy.PostDate = notify.UpdateDate; notifyProxy.UserID = notify.UserID; notifyProxy.UpdateDate = notifyProxy.UpdateDate; foreach (NotifyAction action in notify.Actions) { notifyProxy.Actions.Add(new NotifyActionProxy(action.Title, action.Url, action.IsDialog)); } notifyProxy.TypeName = notify.TypeName; notifyProxy.ClientID = notify.ClientID; notifyProxy.TypeID = notify.TypeID; notifyProxy.Keyword = notify.Keyword; notifyProxy.IsRead = notify.IsRead; notifyProxy.UpdateDate = notify.UpdateDate; notifyProxy.DataTable = new List <StringKeyValueProxy>(); foreach (string key in notify.DataTable.Keys) { notifyProxy.DataTable.Add(new StringKeyValueProxy(key, notify.DataTable[key])); } return(notifyProxy); }
public NotifyCollection GetTopNotifys(int userID, int count, int type) { #if !Passport PassportClientConfig settings = Globals.PassportClient; if (settings.EnablePassport) { NotifyProxy[] notifys = new NotifyProxy[0]; try { notifys = settings.PassportService.Notify_GetTopNotify(userID, count, type); } catch (Exception ex) { ThrowError(new APIError(ex.Message)); } NotifyCollection result = new NotifyCollection(); foreach (NotifyProxy proxy in notifys) { result.Add(GetNotify(proxy)); } return(result); } else #endif { NotifyCollection notifys; //string key = string.Format(cacheKey_UserNotifyType, userID, type, count, 1); //if (!CacheUtil.TryGetValue<NotifyCollection>(key, out notifys)) //{ notifys = NotifyDao.Instance.GetTopNotifys(userID, type, count); // CacheUtil.Set<NotifyCollection>(key, notifys); //} return(notifys); } }
private NotifyManager() { proxy = new NotifyProxy <object>(); }