Ejemplo n.º 1
0
        /// <summary>
        /// Shows the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="page">The page.</param>
        /// <returns></returns>
        public ActionResult Show(string id, string page)
        {
            int currentPage = (string.IsNullOrEmpty(page) ? 1 : Convert.ToInt32(page));
            List <AlphabetPage> alphabetPages = _pagingRepository.RetrievePagingByUserId(Owner.Id);
            char        selectedLetter        = GetSelectedLetter(id, alphabetPages);
            AlphaPaging paging = _pagingService.RetreivePagingByLetterAndUserId(selectedLetter, Owner.Id, currentPage);

            IDictionary <string, string> crumbs = GetBreadCrumbs();

            crumbs.Add("letter", string.Empty);
            crumbs.Add(selectedLetter.ToString(), UrlService.UserUrl(string.Format("tags/show/{0}", selectedLetter)));

            MediaGroupedByTagsView mediaGroupedByTagsView = new MediaGroupedByTagsView
            {
                MediaByTags        = paging.MediaGroupedByTags,
                Name               = selectedLetter.ToString(),
                AlphabetPagingView = new AlphabetPagingView {
                    AlphabetPages = alphabetPages, SelectedLetter = selectedLetter
                },
                NumericPaging = new NumericPaging {
                    CurrentPage = currentPage, PageSize = 5, TotalCount = paging.TagCount
                },
                Authorization        = Authorization,
                PersistentCollection = _persistentCollectionService,
                Cookie = SiteCookie
            };

            // _persistentCollectionService.SetBackUrl(string.Format("{0}/tags/show/{1}", Authorization.Owner.Username, selectedLetter), SiteCookie);
            // _persistentCollectionService.Set(Authorization.Owner.Username + "_tags_letter_" + selectedLetter, new List<Media>(), Persistence.Permanent);

            mediaGroupedByTagsView = SetAuthorizationAndUrlService(mediaGroupedByTagsView);
            return(View(mediaGroupedByTagsView, crumbs));
        }
        /// <summary>
        /// Retreives the paging by letter and user id.
        /// </summary>
        /// <param name="letter">The letter.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="currentPage">The current page.</param>
        /// <returns></returns>
        public AlphaPaging RetreivePagingByLetterAndUserId(char letter, int userId, int currentPage)
        {
            List <Tag> tags = _pagingRepository.RetrievePagingByUserIdAndLetter(letter, userId, currentPage, 5);

            AlphaPaging alphaPaging = new AlphaPaging
            {
                MediaGroupedByTags = _mediaRepository.RetrieveMediaGroupedByTagsAndUserId(tags, userId),
                TagCount           = _pagingRepository.RetrievePagingCountByUserIdAndLetter(letter, userId)
            };

            return(alphaPaging);
        }
Ejemplo n.º 3
0
        protected void AddRootAddButton()
        {
            AlphaPaging ap = ctrlSearch.FindControl <AlphaPaging>("ctrlAlphaPaging");

            if (ap.FindControl <ImageButton>("imgbtnAddRoot") == null)
            {
                ImageButton imgbtnAdd = new ImageButton();
                imgbtnAdd.ID       = "imgbtnAddRoot";
                imgbtnAdd.ImageUrl = "~/App_Themes/Admin_Default/images/add.png";
                //imgbtnAdd.Click += new ImageClickEventHandler(this.imgbtnAdd_Click);
                imgbtnAdd.OnClientClick = "return ShowInsertForm();";
                imgbtnAdd.ToolTip       = AppLogic.GetString("admin.common.Add", ThisCustomer.LocaleSetting) + " " + EntityType;

                ap.Controls.Add(imgbtnAdd);
            }
        }
        protected void AddRootAddButton()
        {
            AlphaPaging ap = ctrlSearch.FindControl <AlphaPaging>("ctrlAlphaPaging");

            if (ap.FindControl <HyperLink>("lnkAddProduct") == null)
            {
                HyperLink hl = new HyperLink();
                hl.ID                    = "lnkAddProduct";
                hl.Text                  = "Add Product";
                hl.ImageUrl              = "~/App_Themes/Admin_Default/images/add.png";
                hl.ToolTip               = AppLogic.GetString("admin.productgrid.AddNewProduct", ThisCustomer.LocaleSetting);
                hl.Attributes["style"]   = "cursor:pointer;";
                hl.Attributes["src"]     = "#";
                hl.Attributes["onclick"] = "return ShowInsertForm();";

                ap.Controls.Add(hl);
            }
        }