private void SetupStreams() { // We need to get all the different types of requests that belong to the user. // - Once we have all the request. Divide them up into categories by object type. // - Display each type using the Request List control. WebService.StreamService streamService = new WebService.StreamService(); Affine.Data.Managers.IStreamManager streamMan = Affine.Data.Managers.LINQ.StreamManager.Instance; Affine.Data.json.UserSetting[] freindRequest = streamMan.GetFriendRequests(this.UserSettings.Id); Affine.Data.json.UserSetting[] groupInvite = streamMan.GetGroupInviteRequests(this.UserSettings.Id); string json = streamMan.ToJsonWithPager(freindRequest); string json2 = streamService.getNotifications(UserSettings.Id, 0, 50); string js = string.Empty; if (Request["n"] != null) { aqufitEntities entities = new aqufitEntities(); long nid = Convert.ToInt64(Request["n"]); Notification notification = entities.UserStreamSet.OfType <Notification>().FirstOrDefault(n => n.Id == nid); if (notification != null) { notification.PublishSettings = (int)Affine.Utils.ConstsUtil.PublishSettings.NOTIFICATION_READ; // this will take it out of the top menu since the user clicked to deal with it.. entities.SaveChanges(); js += "var $sel = $('#atiStreamItem" + Request["n"] + "');"; js += "var targetOffset = $sel.offset().top; "; js += "$sel.css('background-color','#ffcc99').css('border', '2px solid #e47526'); "; js += "$('html,body').animate({scrollTop: targetOffset}, 500);"; } } if (groupInvite.Length > 0) { atiGroupJoinRequest.Visible = true; string json3 = streamMan.ToJsonWithPager(groupInvite); ScriptManager.RegisterStartupScript(this, Page.GetType(), "GroupInviteList", "$(function(){ Aqufit.Page.atiGroupJoinRequest.generateStreamDom('" + json3 + "'); });", true); } ScriptManager.RegisterStartupScript(this, Page.GetType(), "NotificationList", "$(function(){ Aqufit.Page.atiFriendRequestScript.generateStreamDom('" + json + "'); Aqufit.Page.atiStreamScript.generateStreamDom('" + json2 + "'); " + js + " });", true); }
private void SetupStreams() { // We need to get all the different types of requests that belong to the user. // - Once we have all the request. Divide them up into categories by object type. // - Display each type using the Request List control. WebService.StreamService streamService = new WebService.StreamService(); Affine.Data.Managers.IStreamManager streamMan = Affine.Data.Managers.LINQ.StreamManager.Instance; Affine.Data.json.UserSetting[] freindRequest = streamMan.GetFriendRequests(this.UserSettings.Id); Affine.Data.json.UserSetting[] groupInvite = streamMan.GetGroupInviteRequests(this.UserSettings.Id); string json = streamMan.ToJsonWithPager(freindRequest); string json2 = streamService.getNotifications(UserSettings.Id, 0, 50); string js = string.Empty; if (Request["n"] != null) { aqufitEntities entities = new aqufitEntities(); long nid = Convert.ToInt64(Request["n"]); Notification notification = entities.UserStreamSet.OfType<Notification>().FirstOrDefault(n => n.Id == nid); if (notification != null) { notification.PublishSettings = (int)Affine.Utils.ConstsUtil.PublishSettings.NOTIFICATION_READ; // this will take it out of the top menu since the user clicked to deal with it.. entities.SaveChanges(); js += "var $sel = $('#atiStreamItem" + Request["n"] + "');"; js += "var targetOffset = $sel.offset().top; "; js += "$sel.css('background-color','#ffcc99').css('border', '2px solid #e47526'); "; js += "$('html,body').animate({scrollTop: targetOffset}, 500);"; } } if (groupInvite.Length > 0) { atiGroupJoinRequest.Visible = true; string json3 = streamMan.ToJsonWithPager(groupInvite); ScriptManager.RegisterStartupScript(this, Page.GetType(), "GroupInviteList", "$(function(){ Aqufit.Page.atiGroupJoinRequest.generateStreamDom('" + json3 + "'); });", true); } ScriptManager.RegisterStartupScript(this, Page.GetType(), "NotificationList", "$(function(){ Aqufit.Page.atiFriendRequestScript.generateStreamDom('" + json + "'); Aqufit.Page.atiStreamScript.generateStreamDom('" + json2 + "'); " + js + " });", true); }