/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { WideBoxStart1.Title = Lang.Trans("Status"); MiscTemplates.SubscriptionCompleted subscriptionCompletedTemplate = new MiscTemplates.SubscriptionCompleted(LanguageId); lblMessage.Text = subscriptionCompletedTemplate.Text; if (CurrentUserSession != null) { Classes.User user = new User(CurrentUserSession.Username); user.Load(); CurrentUserSession.Paid = user.Paid; CurrentUserSession.BillingPlanOptions = null; CurrentUserSession.Credits = user.Credits; } //if (!Config.Credits.Required) //{ // if (CurrentUserSession != null && !Classes.User.IsNonPaidMember(CurrentUserSession.Username)) // { // CurrentUserSession.Paid = true; // CurrentUserSession.BillingPlanOptions = null; // } //} //else //{ // if (CurrentUserSession != null) // CurrentUserSession.Credits = Classes.User.Load(CurrentUserSession.Username).Credits; //} }
protected void Page_Load(object sender, EventArgs e) { // This page checks your database to see if your users have any WM windows that need to be launched // Also, it updates your database telling your site that the user is currently on the site // This will need to be set to the userID of the currently logged in member String strUserID = CurrentUserSession == null ? null : CurrentUserSession.Username; int iRefreshInterval = Request.QueryString["iRefreshInterval"] != null ? Int32.Parse(Request.QueryString["iRefreshInterval"]) : 5; if (iRefreshInterval > 0) { metaRefresh.Attributes["HTTP-EQUIV"] = "refresh"; metaRefresh.Attributes["content"] = String.Format("{0};URL={1}?iRefreshInterval={2}", iRefreshInterval, Request.FilePath, iRefreshInterval); } else metaRefresh.Visible = false; // clear out any old values (that were requested over 15 minutes ago) InstantMessenger.DeleteOldOpenWindowRequests(); if (strUserID != null) { // update your database so that everyone knows this user is online right now CurrentUserSession.UpdateLastOnline(false); // execute strQuery against your database // select a list of users who want to talk with the current user and we haven't opened a window for 5 mins // join it with your existing users table so you can get their display name string[] users = InstantMessenger.FetchPendingUsers(strUserID); StringBuilder sb = new StringBuilder(); sb.Append("<script language=\"javascript\">\n"); sb.Append("<!--\n"); foreach (string user in users) { User targetUser = new User(user); targetUser.Load(); InstantMessenger.SetWindowOpened(user, strUserID); //Modified by Miroslav Parvanov //real names are changed back to usernames sb.AppendFormat("window.parent.up_launchWM('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}');\n", strUserID, user, CurrentUserSession.Username, targetUser.Username, targetUser.Gender.ToString(), targetUser.Age, targetUser.City); //sb.AppendFormat("window.parent.up_launchWM('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}');\n", // strUserID, user, CurrentUserSession.Name, targetUser.Name, // targetUser.Gender.ToString(), targetUser.Age, targetUser.City); } sb.Append("//-->\n"); sb.Append("</script>\n"); ClientScript.RegisterClientScriptBlock(typeof(wmLauncher_), "launchWM", sb.ToString()); } }
/// <summary> /// Loads user account data from DB. /// Throws "NotFoundException" exception. /// </summary> /// <param name="username">Username identifying the user</param> /// <returns>User object</returns> /// <exception cref="NotFoundException">Username was not found.</exception> public static User Load(string username) { string cachekey = String.Format("User_Load_{0}", username); User user; try { if (HttpContext.Current == null) { user = new User(username); user.Load(); } else if (HttpContext.Current.Items[cachekey] == null) { user = new User(username); user.Load(); HttpContext.Current.Items.Add(cachekey, user); } else { user = HttpContext.Current.Items[cachekey] as User; } } catch (NotFoundException) { user = null; //throw new NotFoundException(); } finally { } return user; }
/// <summary> /// Loads user account data from DB. /// Throws "NotFoundException" exception. /// </summary> /// <param name="username">Username identifying the user</param> /// <returns>User object</returns> /// <exception cref="NotFoundException">Username was not found.</exception> public static User Load(string username) { string cachekey = String.Format("User_Load_{0}", username); User user; if (HttpContext.Current == null) { user = new User(username); user.Load(); return user; } else if (HttpContext.Current.Items[cachekey] == null) { user = new User(username); user.Load(); HttpContext.Current.Items.Add(cachekey, user); return user; } else { return HttpContext.Current.Items[cachekey] as User; } }