Esempio n. 1
0
        private async Task RequestMinorCategoryData(bool isLoadingMore)
        {
            MinorData storyData = null;

            if (isLoadingMore)
            {
                storyData = await DataRequester.RequestCategoryStories(CurrentCategoryId.ToString(), _currentDate);
            }
            else
            {
                ResetStorys();
                storyData = await DataRequester.RequestCategoryLatestStories(CurrentCategoryId.ToString());

                if (storyData != null)
                {
                    var firstStoryId = storyData.stories.First().id;
                    TopStoryList = new List <TopStory>()
                    {
                        new TopStory()
                        {
                            image = storyData.background, id = Misc.Unvalid_Image_Id, title = storyData.description
                        }
                    };
                    CurrentStoryId = firstStoryId.ToString();
                }
            }
            if (storyData == null || storyData.stories.Count == 0)
            {
                return;
            }

            _currentDate = storyData.stories.Last().id.ToString();

            StoryDataList.AddRange(storyData.stories);
        }
Esempio n. 2
0
        protected string GetBrowseUrl(object dataItem)
        {
            ICatalogable node = (ICatalogable)dataItem;
            string       url  = string.Empty;

            switch (node.CatalogNodeType)
            {
            case CatalogNodeType.Category:
                url = "~/Admin/Catalog/Browse.aspx?CategoryId=" + node.Id.ToString();
                break;

            case CatalogNodeType.Product:
                url = "~/Admin/Products/EditProduct.aspx?CategoryId=" + CurrentCategoryId.ToString() + "&ProductId=" + node.Id.ToString();
                break;

            case CatalogNodeType.Webpage:
                url = "~/Admin/Catalog/EditWebpage.aspx?CategoryId = " + CurrentCategoryId.ToString() + "&WebpageId=" + node.Id.ToString();
                break;

            case CatalogNodeType.Link:
                url = "~/Admin/Catalog/EditLink.aspx?CategoryId = " + CurrentCategoryId.ToString() + "&LinkId=" + node.Id.ToString();
                break;
            }
            return(Page.ResolveUrl(url));
        }
Esempio n. 3
0
 protected void BindCurrentCategory()
 {
     BindCategoryHeader();
     BindCGrid();
     LastCategory.Value = CurrentCategoryId.ToString();
 }
Esempio n. 4
0
        protected void CGrid_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            if (e.CommandName.StartsWith("Do_"))
            {
                string[]        args            = e.CommandArgument.ToString().Split("|".ToCharArray());
                CatalogNodeType catalogNodeType = (CatalogNodeType)AlwaysConvert.ToInt(args[0]);
                int             catalogNodeId   = AlwaysConvert.ToInt(args[1]);
                switch (e.CommandName)
                {
                case "Do_Open":
                    //IF CATEGORY, REBIND CURRENT PAGE,
                    //OTHERWISE REDIRECT TO CORRECT EDIT PAGE
                    switch (catalogNodeType)
                    {
                    case CatalogNodeType.Category:
                        //REBIND CURRENT CATEGORY
                        CurrentCategoryId = catalogNodeId;
                        //RESET PAGE INDEX
                        CGrid.PageIndex = 0;
                        break;

                    case CatalogNodeType.Product:
                        Response.Redirect("~/Admin/Products/EditProduct.aspx?CategoryId=" + CurrentCategoryId.ToString() + "&ProductId=" + catalogNodeId.ToString());
                        break;

                    case CatalogNodeType.Webpage:
                        Response.Redirect("~/Admin/Catalog/EditWebpage.aspx?CategoryId=" + CurrentCategoryId.ToString() + "&WebpageId=" + catalogNodeId.ToString());
                        break;

                    case CatalogNodeType.Link:
                        Response.Redirect("~/Admin/Catalog/EditLink.aspx?CategoryId=" + CurrentCategoryId.ToString() + "&LinkId=" + catalogNodeId.ToString());
                        break;
                    }
                    break;

                case "Do_Copy":
                    // THIS WILL COPY THE PRODUCTS WITH THE ORIGNAL CATEGORY INFORMATION PRESERVED
                    CatalogDataSource.Copy(catalogNodeId, catalogNodeType, 0);
                    break;

                case "Do_Delete":
                    DoDelete(catalogNodeType, catalogNodeId);
                    break;

                case "Do_Pub":
                    ICatalogable pubNode = CatalogDataSource.Load(catalogNodeId, catalogNodeType);
                    if (pubNode != null)
                    {
                        //FOR CATEGORIES, WE MUST FIND OUT MORE INFORMATION
                        if (pubNode is Category)
                        {
                            Response.Redirect("ChangeVisibility.aspx?CategoryId=" + ((Category)pubNode).ParentId.ToString() + String.Format("&Objects={0}:{1}", ((Category)pubNode).Id, (byte)(CatalogNodeType.Category)));
                        }
                        //FOR OTHER OBJECTS, WE CAN ADJUST
                        switch (pubNode.Visibility)
                        {
                        case CatalogVisibility.Public:
                            pubNode.Visibility = CatalogVisibility.Hidden;
                            break;

                        case CatalogVisibility.Hidden:
                            pubNode.Visibility = CatalogVisibility.Private;
                            break;

                        default:
                            pubNode.Visibility = CatalogVisibility.Public;
                            break;
                        }
                        if (pubNode is Product)
                        {
                            ((Product)pubNode).Save();
                        }
                        else if (pubNode is Webpage)
                        {
                            ((Webpage)pubNode).Save();
                        }
                        else if (pubNode is Link)
                        {
                            ((Link)pubNode).Save();
                        }
                    }
                    break;
                }
            }
            CGrid.DataBind();
        }