// Methods protected void btnUploadPhoto_Click(object sender, EventArgs e) { if (this.Page.IsValid) { Photo photo = new Photo(); photo.DateTaken = Convert.ToDateTime(this.txtDatePhotoTaken.Text.Trim()); if (photo.AddOne()) { this.filThumbnail.PostedFile.SaveAs(string.Concat(new object[] { base.Request.PhysicalApplicationPath, @"\Image\PremiumMemberZone\Thumbnail\", photo.PhotoID, ".jpg" })); base.BuildPopup("Successfully, uploaded a photo to server."); } else { base.BuildPopup(MicNets.Model.Utility.NOTICE_INTERNAL_ERROR); } } }
private void SetScreen() { Photo photo = new Photo(); photo.PageIndex = Convert.ToInt32(this.hidPageIndex.Value); photo.PageSize = 9; this.dlPhoto.DataSource = photo.LoadAll(); this.dlPhoto.DataBind(); this.hidMaxPageIndex.Value = photo.MaxPageIndex.ToString(); this.btnFirst.OnClientClick = (photo.PageIndex != 0) ? string.Empty : "return false"; this.btnPrev.OnClientClick = this.btnFirst.OnClientClick; this.btnLast.OnClientClick = (photo.PageIndex != photo.MaxPageIndex) ? string.Empty : "return false"; this.btnNext.OnClientClick = this.btnLast.OnClientClick; this.btnPre2.OnClientClick = this.btnPrev.OnClientClick; this.btnFirst2.OnClientClick = this.btnFirst.OnClientClick; this.btnNext2.OnClientClick = this.btnNext.OnClientClick; this.btnLast2.OnClientClick = this.btnLast.OnClientClick; this.lblPageIndex.Text = string.Concat(new object[] { string.Empty, Convert.ToInt32(this.hidPageIndex.Value) + 1, "/", Convert.ToInt32(this.hidMaxPageIndex.Value) + 1 }); this.lblPageIndex2.Text = this.lblPageIndex.Text; }
private void SetScreen() { Photo photo = new Photo(); photo.PageIndex = Convert.ToInt32(this.hidPageIndex.Value); photo.PageSize = 1; DataRow row = photo.LoadAll().Rows[0]; this.imgPhoto.ImageUrl = "http://i46.photobucket.com/albums/f127/weijunkong/" + row["photoName"].ToString().Replace(" ", string.Empty); this.imgPhoto.ToolTip = row["photoName"].ToString(); this.imgPhoto.Width = new Unit(800); this.lblDatePicTaken.Text = Common.lblDatePicTaken + row["timeTaken"]; if (row["year"].ToString().Equals("0")) { this.lblAge.Text = string.Format(Common.lblAgeNoYear, row["month"]); } else { this.lblAge.Text = string.Format(Common.lblAge, row["year"],row["month"]); } this.hidMaxPageIndex.Value = photo.MaxPageIndex.ToString(); this.btnFirst.OnClientClick = (photo.PageIndex != 0) ? string.Empty : "return false"; this.btnPrev.OnClientClick = this.btnFirst.OnClientClick; this.btnLast.OnClientClick = (photo.PageIndex != photo.MaxPageIndex) ? string.Empty : "return false"; this.btnNext.OnClientClick = this.btnLast.OnClientClick; this.btnPre2.OnClientClick = this.btnPrev.OnClientClick; this.btnFirst2.OnClientClick = this.btnFirst.OnClientClick; this.btnNext2.OnClientClick = this.btnNext.OnClientClick; this.btnLast2.OnClientClick = this.btnLast.OnClientClick; this.lblAge2.Text = this.lblAge.Text; this.lblDatePicTaken2.Text = this.lblDatePicTaken.Text; this.lblPageIndex.Text = string.Concat(new object[] { string.Empty, Convert.ToInt32(this.hidPageIndex.Value) + 1, "/", Convert.ToInt32(this.hidMaxPageIndex.Value) + 1 }); this.lblPageIndex2.Text = this.lblPageIndex.Text; }