Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                DisplayInfo di   = null;
                string      path = SiteHelper.TempFilePath(Server);

                this.galleryThumbnails1.Controls.Clear();

                Page.PreRender += this.Default_PreRender;

                this.GetImagesCount();

                if (!Page.IsPostBack)
                {
                    di = this.Session["DisplayInfo"] as DisplayInfo;
                    if (di != null)
                    {
                        di.From    = 0;
                        di.Count   = ImagesCountOnPage;
                        di.GroupId = this.GetGroupId();

                        var list = new DumpedDataProvider(di.ConnStr, path).LoadMedia(di.GroupId, di.From, di.Count);
                        this.Session["DisplayInfo"]     = di;
                        this.Session["DumpedMediaList"] = list;

                        this.GroupsLine1.LinkNext.Visible = di.ImagesCount > di.Count;
                    }
                    else
                    {
                        this.ShowMessage("Unable to find database connection string.");
                    }

                    this.GroupsLine1.LinkPrev.Visible = false;

                    this.LoadCatalog();

                    this.ShowSingleImage();
                }
                else
                {
                    di = this.Session["DisplayInfo"] as DisplayInfo;
                    if (di != null)
                    {
                        di.Count = ImagesCountOnPage;
                        this.Session["DisplayInfo"] = di;
                    }
                }
            }
            catch (Exception ex)
            {
                this.ShowMessage(ex.Message);
                this.LogError(ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Start event of the Session control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void Session_Start(object sender, EventArgs e)
        {
            ////get connection string and put it to session

            string connStr = string.Empty;

            try
            {
                connStr = ConfigurationManager.ConnectionStrings["WinkasDatabase"].ToString();
                var di = new DisplayInfo {
                    ConnStr = connStr
                };
                this.Session["DisplayInfo"] = di;
            }
            catch (Exception ex)
            {
                string msg =
                    string.Format(
                        "Unable to find database connection string in the config file. Message: {0}", ex.Message);
                this.LogError(msg);
                return;
            }
        }