protected void Page_Load(object sender, EventArgs e) { GetUserName(); if (!IsPostBack) { user.Text = Session["username"].ToString(); string username = user.Text; string pathFromDB = Usr.GetProfilePicture(Session["userid"].ToString()); string usrphoto = Server.MapPath("./") + pathFromDB; if (pathFromDB != null && System.IO.File.Exists(usrphoto)) { photo.ImageUrl = pathFromDB; } else { photo.ImageUrl = Usr.defaultUserPhoto; } string userid = Session["userid"].ToString(); int numberOfMssg = Usr.NumberOfNotifications(userid); if (numberOfMssg > 0) { Label myLabel = this.FindControl("NowaWiadomosc") as Label; myLabel.Text = numberOfMssg.ToString(); } Label OdwiedziliTotal = this.FindControl("OdwiedziliTotal") as Label; Label OdwiedziliNew = this.FindControl("OdwiedziliNew") as Label; if (GetNumberOfNewVisits() == 0) { OdwiedziliNew.Visible = false; } else { OdwiedziliNew.Text = GetNumberOfNewVisits().ToString() + "/"; } OdwiedziliTotal.Text = Usr.GetNumberOfAllVisits(userid).ToString(); } }
protected void GetNumberOfViewed() { string userid = Session["userid"].ToString(); int numberOfVisits = Usr.GetNumberOfAllVisits(userid); int ii = 0; int perPage = 2; for (ii = 0; ii < (numberOfVisits / perPage); ii++) { LinkButton anchor = new LinkButton(); // anchor.PostBackUrl = "Odwiedzili.aspx?odwiedzili="+(ii+1); anchor.Text = (ii + 1).ToString(); anchor.ID = "link" + (ii + 1); anchor.Command += new CommandEventHandler(FillOdwiedzili); anchor.CommandArgument = (ii + 1).ToString(); links.Controls.Add(anchor); } }