protected void btnUnlockPhotos_Click(object sender, EventArgs e) { if (CurrentUserSession == null) { Response.Redirect("Register.aspx"); return; } if (UnlockedSection.IsSectionUnlocked(CurrentUserSession.Username, User.Username, UnlockedSection.SectionType.Photos, null)) return; if (CurrentUserSession.Credits - CurrentUserSession.BillingPlanOptions.CanViewPhotos.Credits < 0) { StatusPageMessage = "You have to be paid member in order to use this feature!".Translate(); Response.Redirect("Home.aspx"); return; } CurrentUserSession.Credits -= CurrentUserSession.BillingPlanOptions.CanViewPhotos.Credits; CurrentUserSession.Update(true); CreditsHistory creditsHistory = new Classes.CreditsHistory(CurrentUserSession.Username); creditsHistory.Amount = CurrentUserSession.BillingPlanOptions.CanViewPhotos.Credits; creditsHistory.Service = CreditsHistory.eService.ViewPhotos; creditsHistory.Save(); UnlockedSection.UnlockSection(CurrentUserSession.Username, User.Username, UnlockedSection.SectionType.Photos, null, DateTime.Now.AddDays(Config.Credits.PhotoUnlockPeriod)); loadPhotos = true; }
protected void btnUnlockPhotos_Click(object sender, EventArgs e) { if (CurrentUserSession == null) { Response.Redirect("~/Registration.aspx"); return; } if (UnlockedSection.IsSectionUnlocked(CurrentUserSession.Username, User.Username, UnlockedSection.SectionType.Photos, null)) return; if (CurrentUserSession.Credits - CurrentUserSession.BillingPlanOptions.CanViewPhotos.Credits < 0) { Global.GetSessionState()["BillingPlanOption"] = CurrentUserSession.BillingPlanOptions.CanViewPhotos; Response.Redirect("~/ManageProfile.aspx?sel=payment"); return; } CurrentUserSession.Credits -= CurrentUserSession.BillingPlanOptions.CanViewPhotos.Credits; CurrentUserSession.Update(true); CreditsHistory creditsHistory = new Classes.CreditsHistory(CurrentUserSession.Username); creditsHistory.Amount = CurrentUserSession.BillingPlanOptions.CanViewPhotos.Credits; creditsHistory.Service = Classes.CreditsHistory.eService.ViewPhotos; creditsHistory.Save(); UnlockedSection.UnlockSection(CurrentUserSession.Username, User.Username, UnlockedSection.SectionType.Photos, null, DateTime.Now.AddDays(Config.Credits.PhotoUnlockPeriod)); loadPhotos = true; loadComments = Config.Photos.EnablePhotoComments; SetReportAbuseLink(); }