Esempio n. 1
0
    private void CreateProductMenu(PXGraph graph, PXDropDown dd)
    {
        PXListItem liall = new PXListItem(PXMessages.LocalizeNoPrefix(PX.SM.Messages.SearchProduct));

        dd.Items.Add(liall);
        foreach (PXResult result in PXSelect <SPWikiProduct> .Select(graph))
        {
            SPWikiProduct wc = result[typeof(SPWikiProduct)] as SPWikiProduct;
            PXListItem    li = new PXListItem(wc.Description, wc.ProductID);
            dd.Items.Add(li);
        }

        for (int i = 0; i < dd.Items.Count; i++)
        {
            if (ProductID == dd.Items[i].Value)
            {
                dd.SelectedIndex = i;
            }
        }

        string path = PXUrl.SiteUrlWithPath();

        path += path.EndsWith("/") ? "" : "/";
        var url = string.Format("{0}Search/{1}?query={2}&adv=1",
                                path, this.ResolveClientUrl("~/Search/Wiki.aspx"), txtSearch.Value);

        url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" +
              CategoryID + "&productID=" + SearchCaptionProduct.Value + "&orderID=" +
              OrderID + "&isWiki=" + IsWiki + "&globalsearchcaption=" + Globalsearchcaption;
    }
Esempio n. 2
0
    private void InitHeader(Guid pageID)
    {
        PXResult <WikiPage, WikiPageLanguage> result = (PXResult <WikiPage, WikiPageLanguage>) PXSelectJoin <WikiPage,
                                                                                                             InnerJoin <WikiPageLanguage, On <WikiPageLanguage.pageID, Equal <WikiPage.pageID> > >,
                                                                                                             Where <WikiPage.pageID, Equal <Required <WikiPage.pageID> > > > .SelectWindowed(new PXGraph(), 0, 1, pageID);

        PXResult <KBResponseSummary> resultsummary = (PXResult <KBResponseSummary>) PXSelect <KBResponseSummary, Where <KBResponseSummary.pageID, Equal <Required <KBResponseSummary.pageID> > > > .SelectWindowed(new PXGraph(), 0, 1, pageID);

        if (result != null)
        {
            WikiPage          wp   = result[typeof(WikiPage)] as WikiPage;
            WikiPageLanguage  wpl  = result[typeof(WikiPageLanguage)] as WikiPageLanguage;
            KBResponseSummary kbrs = new KBResponseSummary();

            if (resultsummary != null)
            {
                kbrs = resultsummary[typeof(KBResponseSummary)] as KBResponseSummary;
            }

            PXKB.Text = wp.Name + ": " + wpl.Title;

            PXCategori.Text = PXMessages.LocalizeNoPrefix(Msg.Category) + ": ";
            bool firstcategory = false;
            foreach (PXResult <SPWikiCategoryTags, SPWikiCategory> category in PXSelectJoin <SPWikiCategoryTags,
                                                                                             InnerJoin <SPWikiCategory, On <SPWikiCategory.categoryID, Equal <SPWikiCategoryTags.categoryID> > >,
                                                                                             Where <SPWikiCategoryTags.pageID, Equal <Required <SPWikiCategoryTags.pageID> > > > .Select(new PXGraph(), pageID))
            {
                SPWikiCategory wc = category[typeof(SPWikiCategory)] as SPWikiCategory;
                if (firstcategory)
                {
                    PXCategori.Text = PXCategori.Text + ", ";
                }
                PXCategori.Text = PXCategori.Text + wc.Description;
                firstcategory   = true;
            }

            PXProduct.Text = PXMessages.LocalizeNoPrefix(Msg.AppliesTo) + ": ";
            bool firstproduct = false;
            foreach (PXResult <SPWikiProductTags, SPWikiProduct> category in PXSelectJoin <SPWikiProductTags,
                                                                                           InnerJoin <SPWikiProduct, On <SPWikiProduct.productID, Equal <SPWikiProductTags.productID> > >,
                                                                                           Where <SPWikiProductTags.pageID, Equal <Required <SPWikiProductTags.pageID> > > > .Select(new PXGraph(), pageID))
            {
                SPWikiProduct wc = category[typeof(SPWikiProduct)] as SPWikiProduct;
                if (firstproduct)
                {
                    PXProduct.Text = PXProduct.Text + ", ";
                }
                PXProduct.Text = PXProduct.Text + wc.Description;
                firstproduct   = true;
            }

            PXKBName.Text        = PXMessages.LocalizeNoPrefix(Msg.Article) + ": " + wp.Name + ' ';
            PXCreateDate.Text    = PXMessages.LocalizeNoPrefix(Msg.CreateDate) + ": " + wp.CreatedDateTime;
            PXLastPublished.Text = PXMessages.LocalizeNoPrefix(Msg.LastModified) + ": " + wpl.LastPublishedDateTime + ' ';
            PXViews.Text         = PXMessages.LocalizeNoPrefix(Msg.Views) + ": " + kbrs.Views.ToString() + ' ';

            PXRating.Text = PXMessages.LocalizeNoPrefix(Msg.Rating) + ": ";
            if (kbrs != null && kbrs.Markcount != null && kbrs.Markcount != 0 && kbrs.Marksummary != null && kbrs.Marksummary != 0)
            {
                int    AvRate      = (int)((int)kbrs.Marksummary / (int)kbrs.Markcount);
                Int32  Marksummary = (int)kbrs.Marksummary;
                Int32  Markcount   = (int)kbrs.Markcount;
                double dAvRate     = (double)Marksummary / (double)Markcount;
                PXdAvRate.Text = "(" + Math.Round(dAvRate, 2).ToString() + ")";
                switch (AvRate)
                {
                case 0:
                    PXImage1.ImageUrl = "main@FavoritesGray";
                    PXImage2.ImageUrl = "main@FavoritesGray";
                    PXImage3.ImageUrl = "main@FavoritesGray";
                    PXImage4.ImageUrl = "main@FavoritesGray";
                    PXImage5.ImageUrl = "main@FavoritesGray";
                    break;

                case 1:
                    PXImage1.ImageUrl = "main@Favorites";
                    PXImage2.ImageUrl = "main@FavoritesGray";
                    PXImage3.ImageUrl = "main@FavoritesGray";
                    PXImage4.ImageUrl = "main@FavoritesGray";
                    PXImage5.ImageUrl = "main@FavoritesGray";
                    break;

                case 2:
                    PXImage1.ImageUrl = "main@Favorites";
                    PXImage2.ImageUrl = "main@Favorites";
                    PXImage3.ImageUrl = "main@FavoritesGray";
                    PXImage4.ImageUrl = "main@FavoritesGray";
                    PXImage5.ImageUrl = "main@FavoritesGray";
                    break;

                case 3:
                    PXImage1.ImageUrl = "main@Favorites";
                    PXImage2.ImageUrl = "main@Favorites";
                    PXImage3.ImageUrl = "main@Favorites";
                    PXImage4.ImageUrl = "main@FavoritesGray";
                    PXImage5.ImageUrl = "main@FavoritesGray";
                    break;

                case 4:
                    PXImage1.ImageUrl = "main@Favorites";
                    PXImage2.ImageUrl = "main@Favorites";
                    PXImage3.ImageUrl = "main@Favorites";
                    PXImage4.ImageUrl = "main@Favorites";
                    PXImage5.ImageUrl = "main@FavoritesGray";
                    break;

                case 5:
                    PXImage1.ImageUrl = "main@Favorites";
                    PXImage2.ImageUrl = "main@Favorites";
                    PXImage3.ImageUrl = "main@Favorites";
                    PXImage4.ImageUrl = "main@Favorites";
                    PXImage5.ImageUrl = "main@Favorites";
                    break;

                default:
                    PXImage1.ImageUrl = "main@FavoritesGray";
                    PXImage2.ImageUrl = "main@FavoritesGray";
                    PXImage3.ImageUrl = "main@FavoritesGray";
                    PXImage4.ImageUrl = "main@FavoritesGray";
                    PXImage5.ImageUrl = "main@FavoritesGray";
                    break;
                }
            }
        }
    }