Пример #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (UserId > -1)
                {

                    if (!IsPostBack)
                    {
                       // Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "miniprofile", (this.TemplateSourceDirectory + "/js/miniprofile.js?v=5"));
                        Ourspace_Utilities.View util = new Ourspace_Utilities.View();
                        lblName.Text = UserInfo.FirstName;
                        int points = util.GetUserPoints(UserInfo.UserID);
                        lblPointsNo.Text = points.ToString();
                        int level1 = util.GetLevel(0);
                        int level2 = util.GetLevel(50);
                        int level3= util.GetLevel(100);
                        int level4 = util.GetLevel(101);
                        int level5 = util.GetLevel(222);
                        int level6 = util.GetLevel(580);

                        util.GetLevel(points).ToString();
                        util.GetLevel(points).ToString();

                        util.GetLevel(points).ToString();

                        img_Profile.ImageUrl = GetImageUrl(UserId);
                        img_Profile.ImageUrl = util.GetOurSpaceUserImgUrl(Server, UserId);
                        lblLevelNo.Text = util.GetLevel(points).ToString();
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {

                if (Request.QueryString["facebook"] != null)
                {
                    isFacebook = true;
                }

                ScriptManager objScriptManager = ScriptManager.GetCurrent(this.Page);
                ScriptReference objScriptReference;

                objScriptReference = new ScriptReference(@"~/DesktopModules/Ourspace_Dashboard/js/textboxLimiter.js");
                objScriptManager.Scripts.Add(objScriptReference);

                objScriptReference = new ScriptReference(@"~/DesktopModules/Ourspace_Dashboard/js/jquery-ui-1.8.16.custom.min.js");
                objScriptManager.Scripts.Add(objScriptReference);
                // objScriptReference = new ScriptReference(@"~/DesktopModules/Ourspace_Dashboard/js/dashboard.js");
                //objScriptManager.Scripts.Add(objScriptReference);

                Page.ClientScript.RegisterClientScriptInclude("dashboard.js", this.TemplateSourceDirectory + "/js/dashboard.js");

                Ourspace_Utilities.View util = new Ourspace_Utilities.View();
                if (!IsPostBack)
                {
                    hdnfldCurrentUser.Value = UserId.ToString();
                    if (Request.QueryString["user"] != null)
                    {
                        hdnfldCurrentUser.Value = Request.QueryString["user"];
                    }

                    LoadNotifications();
                    int points = util.GetUserPoints(int.Parse(hdnfldCurrentUser.Value));

                    //lblSideLevel.Text = util.GetLevel(points).ToString();

                    int userLevel = util.GetLevel(Convert.ToInt32(points));
                   lblSideLevel.Text = userLevel.ToString() + " (<span><i>" + util.GetLevelName(userLevel, LocalResourceFile.Replace("Ourspace_Dashboard", "Ourspace_Utilities")) + "</i></span>)";

                    lblSidePoints.Text = points.ToString();
                    lblPoints.Text = points.ToString();
                    lblSidePoints.Text = lblPoints.Text;
                    int pointsToNextLevel = util.GetPointsToNextLevel(points);
                    if (pointsToNextLevel == -1)
                        lblPointsToNextLevel.Text = "-";
                    else
                        lblPointsToNextLevel.Text = pointsToNextLevel.ToString();

                    lblReferrals.Text = util.GetUserReferralCount(UserId) + "";

                }
                if (Request.QueryString["user"] != null && int.Parse(Request.QueryString["user"]) != UserId)
                {
                    lnkBtnEditProfile.Visible = false;
                }

                imgProfilePic.ImageUrl = util.GetHighResUserImgUrl(Server, int.Parse(hdnfldCurrentUser.Value));

                UserInfo userInfo = UserController.GetUserById(0, int.Parse(hdnfldCurrentUser.Value));
                lblUserFullName.Text = userInfo.FirstName + " " + userInfo.LastName;

                lblMemberSinceDate.Text = String.Format("{0:MMMM d, yyyy}", userInfo.Membership.CreatedDate);
                //UserInfo userInfo = UserInfo;
                // Loading user info
                lbl_FirstNameValue.Text = userInfo.Profile.FirstName;
                lbl_LastNameValue.Text = userInfo.Profile.LastName;
                string dob = userInfo.Profile.GetPropertyValue("DOB");
                if (userInfo.Profile.ProfileProperties.GetByName("DOB") != null)
                {

                    // lbl_AgeValue.Text  = String.Format("{0:MMMM d, yyyy}", DateTime.Parse(userInfo.Profile.ProfileProperties.GetByName("DOB").PropertyValue));
                    txt_DOB.Text = DateTime.Parse(userInfo.Profile.ProfileProperties.GetByName("DOB").PropertyValue).ToString("dd-MM-yyyy");
                    hdnfld_DOB.Value = DateTime.Parse(userInfo.Profile.ProfileProperties.GetByName("DOB").PropertyValue).ToString("dd-MM-yyyy");

                }
                lbl_CityValue.Text = userInfo.Profile.GetPropertyValue("City"); ;
                lbl_CountryValue.Text = userInfo.Profile.Country;

                if (Session["FacebookUserId"] != null && Session["FacebookUserId"].ToString() == "0" /*&& Request.QueryString["user"] != null*/)
                {
                    lnkbtn_ChangePhoto.Visible = true;
                    lnkbtn_ChangePassword.Visible = true;
                }

                // txt_DOB.Visible = true;

            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }