Beispiel #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);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Handles the Click event of the LinkButtonNext 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 LinkButtonNext_Click(object sender, EventArgs e)
        {
            var di = Session["DisplayInfo"] as DisplayInfo;

            if (di != null)
            {
                di.From = di.From + di.Count;
                var list = new DumpedDataProvider(di.ConnStr, SiteHelper.TempFilePath(Server)).LoadMedia(di.GroupId, di.From, di.Count);
                this.Session["DisplayInfo"]     = di;
                this.Session["DumpedMediaList"] = list;

                this.SetControlsState(di.From, di.Count);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Gets the list of images2.
        /// </summary>
        /// <returns>List of images</returns>
        private IEnumerable <EditImage> GetListOfImages()
        {
            try
            {
                var tmpList = new List <EditImage>();
                var di      = this.Session["DisplayInfo"] as DisplayInfo;
                var list    = new DumpedDataProvider(di.ConnStr, SiteHelper.TempFilePath(Server)).LoadMedia(di.GroupId, di.From, di.Count);

                foreach (var item in list)
                {
                    tmpList.Add(new EditImage {
                        Id = item.Id, Url = string.Format("../{0}", item.Thumbnail.GlobalFileUrl), GroupId = item.GroupId
                    });
                }

                return(tmpList);
            }
            catch (Exception ex)
            {
                ////log exception
                //// Logger.Log(ex.Message);
                return(null);
            }
        }
Beispiel #4
0
        public void DumpedDataProvider_LoadAllMedia_Result()
        {
            var list = new DumpedDataProvider(this.databaseConnString, string.Empty).LoadMedia(0, 0, 10000);

            Assert.IsNotNull(list);
        }