protected void Page_Load(object sender, EventArgs e)
 {
     BindingList<Screenshot> screenshots = DataProvider.Instance.GetScreenshots();
     if (screenshots.Count > 0) {
         Random r = new Random(Guid.NewGuid().ToByteArray()[1]);
         int ix = r.Next(0, screenshots.Count - 1);
         MainScreenshot = screenshots[ix];
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            string screenshotIDString = this.Request.QueryString[SCREENSHOT_ID_QUERY_STRING_KEY];
            int screenshotID = 0;
            if (screenshotIDString != null && int.TryParse(screenshotIDString, out screenshotID)) {
                this.Screenshot = DataProvider.Instance.GetScreenshot(screenshotID);
            }

            if (this.Screenshot == null) {
                this.Screenshot = new Screenshot();
                this.Screenshot.DateTaken = DateTime.Now;
            }

            if (!this.IsPostBack) {
                _captionTextBox.Text = this.Screenshot.Caption;
            }
        }
 public void DeleteScreenshot(Screenshot screenshot)
 {
     Helper.ExecuteNonQuery(
         Helper.CreateCommand("[TrialBalanceMedia].[DeleteScreenshot]",
             Helper.CreateParameter("@screenshotID", screenshot.ScreenshotID)));
 }
 public void SaveScreenshot(Screenshot screenshot)
 {
     SqlParameter p = Helper.CreateOutParameter("@screenshotID", screenshot.ScreenshotID);
     Helper.ExecuteNonQuery(
         Helper.CreateCommand("[TrialBalanceMedia].[SaveScreenshot]",
             p,
             Helper.CreateParameter("@dateTaken", screenshot.DateTaken),
             Helper.CreateParameter("@caption", screenshot.Caption)));
     screenshot.ScreenshotID = (int)p.Value;
 }