See it live: click here
When you install the module and place it on a page in your DNN site, you may see a message indicating that the Site Log must be enabled to use the module. Clicking Enable Site Log will enable the Site Log. If your Site Log is already enabled, you will not see this message.
#region RefreshIteration private void RefreshIteration(object sender, EventArgs e) { BasicHttpBinding bind = new BasicHttpBinding(); EndpointAddress MyEndpointAddress = new EndpointAddress(strWebServiceBase + "Webservice.asmx"); var proxy = new WebServiceSoapClient(bind, MyEndpointAddress); ShowUserCount(proxy); ShowTopUsers(proxy); } #endregion
#region proxy_GetDashboardTopUsersCompleted void proxy_GetDashboardTopUsersCompleted(object sender, GetDashboardTopUsersCompletedEventArgs e) { // Put the results in the collection colDashboardData = e.Result; // Get the anonymous requests BasicHttpBinding bind = new BasicHttpBinding(); EndpointAddress MyEndpointAddress = new EndpointAddress(strWebServiceBase + "Webservice.asmx"); var proxy = new WebServiceSoapClient(bind, MyEndpointAddress); proxy.GetDashboardTopAnonymousUsersCompleted += new EventHandler<GetDashboardTopAnonymousUsersCompletedEventArgs>(proxy_GetDashboardTopAnonymousUsersCompleted); proxy.GetDashboardTopAnonymousUsersAsync(strPassword); } #endregion
#region proxy_GetDashboardTopAnonymousUsersCompleted void proxy_GetDashboardTopAnonymousUsersCompleted(object sender, GetDashboardTopAnonymousUsersCompletedEventArgs e) { // Add the results to the collection colDashboardData.Add(e.Result[0]); ((BarSeries)TopUsers.Series[0]).ItemsSource = colDashboardData; } #endregion
#region GetDashboardUserCount [WebMethod] public int GetDashboardUserCount(string strPassword) { int intDashboardUserCount = 0; string CacheDashboardUserCount = ""; DashboardPortalInfo objDashboardPortalInfo = GetDashboardPortalInfo(strPassword); // Password is valid only if PortalID is not -1 if (objDashboardPortalInfo.PortalID > -1) { // Try to get the value out of the Cache // The cache key is preceeded by the PortalID CacheDashboardUserCount = HttpContext.Current.Cache.Get(String.Format("{0}{1}", objDashboardPortalInfo.PortalID.ToString(), "AdefWebserver_DashboardUserCount")) as String; if (CacheDashboardUserCount == null) { // We only want the data for the 20 minutes DateTime dtLastRefreshTime = DateTime.Now.AddMinutes(-20); // The DashboardUserCount does not exist or has expired // Get the current value DashboardDALDataContext DashboardDALDataContext = new DashboardDALDataContext(); var SiteLogsResults = (from SiteLogData in DashboardDALDataContext.SiteLogs where SiteLogData.DateTime >= dtLastRefreshTime where SiteLogData.PortalId == objDashboardPortalInfo.PortalID group SiteLogData by SiteLogData.UserHostAddress into UserHostAddress select UserHostAddress).Count(); intDashboardUserCount = SiteLogsResults; // Set the new time to expire and insert into Cache DateTime dtTimeToExpire = DateTime.Now.AddSeconds(Convert.ToDouble(objDashboardPortalInfo.RefreshTime)); HttpContext.Current.Cache.Insert(String.Format("{0}{1}", objDashboardPortalInfo.PortalID.ToString(), "AdefWebserver_DashboardUserCount"), intDashboardUserCount.ToString(), null, dtTimeToExpire, Cache.NoSlidingExpiration); } else { // The value is in the Cache intDashboardUserCount = Convert.ToInt32(CacheDashboardUserCount); } } return intDashboardUserCount; } #endregion
When you employ Silverlight to displays dashboards, you may encounter problems with long running queries timing out. Creating a query for each item separately can alleviate time out problems because each query can be run asynchronously. You can even perform more than one query for a single item if needed.
Silverlight provides a unique solution for displaying data based on long running queries. The Silverlight application itself will never time out. If a single query does time out, the Silverlight application can be programmed to try the request again.
Download the module and source code here:
http://dnnsilverlight.adefwebserver.com/Silverlight20/SilverlightDashboard2/tabid/74/Default.aspx
[Back to: The ADefWebserver DotNetNuke HELP WebSite]
Buy DotNetNuke Modules from Snowcovered |
DotNetNuke™ is a registered trademark of DotNetNuke Corporation.