protected void SearchCaption_WikiChange(object sender, PXCallBackEventArgs e) { if (!string.IsNullOrEmpty(Request.RawUrl)) { string path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; var url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/WikiSP.aspx"), txtSearch.Value); url = url + "&wikiid=" + SearchCaption.Value + "&wikinumber=" + SearchCaption.SelectedIndex.ToString() + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID; throw new Exception("Redirect0:" + url); } }
public void exportAsReport() { var design = Base.Designs.Current; if (design == null) { return; } string reportName = _nameRegex.Replace(design.Name ?? "", ""); if (String.IsNullOrEmpty(reportName)) { reportName = "Report1"; } var report = new Report { Name = reportName, SchemaUrl = PXUrl.SiteUrlWithPath(), Items = { new PageHeaderSection() { Name = "pageHeaderSection1" }, new DetailSection() { Name = "detailSection1" }, new PageFooterSection() { Name = "pageFooterSection1" } } }; var tableByAlias = ConvertTables(report); ConvertRelations(report, tableByAlias); ConvertParameters(report); ConvertFilters(report); ConvertGroups(report); ConvertSorts(report); byte[] data = SerializeReport(report); var fileInfo = new FileInfo(reportName + ".rpx", null, data); throw new PXRedirectToFileException(fileInfo, true); }
private void CreateWikiMenu(PXGraph graph, PXDropDown dd) { PXListItem liall = new PXListItem("Entire Help"); dd.Items.Add(liall); foreach (PXResult result in PXSelect <WikiDescriptor> .Select(graph)) { WikiDescriptor wiki = result[typeof(WikiDescriptor)] as WikiDescriptor; if (wiki != null && wiki.PageID != null) { var node = PXSiteMap.Provider.FindSiteMapNodeFromKey((Guid)wiki.PageID); if (node != null) { string title = wiki.WikiTitle ?? node.Title; PXListItem li = new PXListItem(title, wiki.PageID.ToString()); dd.Items.Add(li); } } } for (int i = 0; i < dd.Items.Count; i++) { if (WikiID == dd.Items[i].Value) { dd.SelectedIndex = i; } } string path = PXUrl.SiteUrlWithPath(); var url = ""; path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/Wiki.aspx"), txtSearch.Value); url = url + "&wikiid=" + SearchCaption.Value + "&wikinumber=" + SearchCaption.SelectedIndex.ToString() + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=1" + "&globalsearchcaption=" + Globalsearchcaption; }
private void CreateGlobalSearchCaption(PXGraph graph, PXDropDown dd) { PXListItem liWikis = new PXListItem("Help"); dd.Items.Add(liWikis); PXListItem liEntities = new PXListItem("Entities"); dd.Items.Add(liEntities); PXListItem liFiles = new PXListItem("Files"); dd.Items.Add(liFiles); PXListItem liNotes = new PXListItem("Notes"); dd.Items.Add(liNotes); PXListItem liScreens = new PXListItem("Form Titles"); dd.Items.Add(liScreens); Int32 select; Int32.TryParse(Globalsearchcaption, out select); dd.SelectedIndex = select; string path = PXUrl.SiteUrlWithPath(); var url = ""; switch (dd.SelectedIndex) { case 0: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; 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=" + ProductID + "&orderID=" + OrderID + "&isWiki=1" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; case 1: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/Entity.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; case 2: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/File.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; case 3: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/Note.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; case 4: path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; url = string.Format("{0}Search/{1}?query={2}&adv=1", path, this.ResolveClientUrl("~/Search/FormsTitle.aspx"), txtSearch.Value); url = url + "&wikiid=" + WikiID + "&wikinumber=" + WikiNumber + "&categoryID=" + CategoryID + "&productID=" + ProductID + "&orderID=" + OrderID + "&isWiki=0" + "&globalsearchcaption=" + dd.SelectedIndex.ToString(); break; } }
protected void Rate_PageRate(object sender, EventArgs e) { Filltables(); Guid currentwikipage = new Guid(pageid); PXGraph article = PXGraph.CreateInstance(typeof(KBArticleMaint)); PXCache response = article.Caches[typeof(KBResponse)]; PXCache responsesummary = article.Caches[typeof(KBResponseSummary)]; PXResult <WikiPage, WikiPageLanguage, WikiRevision> result = (PXResult <WikiPage, WikiPageLanguage, WikiRevision>) PXSelectJoin <WikiPage, InnerJoin <WikiPageLanguage, On <WikiPageLanguage.pageID, Equal <WikiPage.pageID> >, InnerJoin <WikiRevision, On <WikiRevision.pageID, Equal <WikiPage.pageID> > > >, Where <WikiPage.pageID, Equal <Required <WikiPage.pageID> > >, OrderBy <Desc <WikiRevision.pageRevisionID> > > .SelectWindowed(new PXGraph(), 0, 1, currentwikipage); Guid userId = PXAccess.GetUserID(); PXResult <KBResponseSummary> resultsummary = (PXResult <KBResponseSummary>) PXSelect <KBResponseSummary, Where <KBResponseSummary.pageID, Equal <Required <KBResponseSummary.pageID> > > > .SelectWindowed(article, 0, 1, currentwikipage); PXResult <KBResponse> resnonse = (PXResult <KBResponse>) PXSelect <KBResponse, Where <KBResponse.userID, Equal <Required <KBResponse.userID> >, And <KBResponse.pageID, Equal <Required <KBResponse.pageID> > > > > .SelectWindowed(article, 0, 1, userId, currentwikipage); if (result != null) { WikiPage wp = result[typeof(WikiPage)] as WikiPage; WikiPageLanguage wpl = result[typeof(WikiPageLanguage)] as WikiPageLanguage; KBResponseSummary kbrs = responsesummary.CreateInstance() as KBResponseSummary; KBResponse newresnonse = response.CreateInstance() as KBResponse; if (resultsummary != null) { kbrs = resultsummary[typeof(KBResponseSummary)] as KBResponseSummary; } if (resnonse != null) { newresnonse = resnonse[typeof(KBResponse)] as KBResponse; if (wp != null && wpl != null && newresnonse.NewMark != null) { if (newresnonse.OldMark != 0) { kbrs.Marksummary = kbrs.Marksummary - newresnonse.OldMark; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; } else { kbrs.Markcount = kbrs.Markcount + 1; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; } 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; kbrs.AvRate = dAvRate; responsesummary.Update(kbrs); responsesummary.PersistUpdated(kbrs); responsesummary.Clear(); newresnonse.PageID = currentwikipage; newresnonse.RevisionID = 1; newresnonse.OldMark = newresnonse.NewMark; newresnonse.Date = PXTimeZoneInfo.Now; newresnonse.Summary = ""; newresnonse.CreatedByID = wp.CreatedByID; newresnonse.CreatedByScreenID = "WP00000"; newresnonse.CreatedDateTime = wp.CreatedDateTime; newresnonse.LastModifiedByID = wp.LastModifiedByID; newresnonse.LastModifiedByScreenID = "WP00000"; newresnonse.LastModifiedDateTime = wp.LastModifiedDateTime; response.Update(newresnonse); response.PersistUpdated(newresnonse); response.Clear(); } } else { if (wp != null && wpl != null && newresnonse.NewMark != null) { newresnonse.PageID = currentwikipage; newresnonse.RevisionID = 1; newresnonse.OldMark = newresnonse.NewMark; newresnonse.Date = PXTimeZoneInfo.Now; newresnonse.UserID = userId; newresnonse.Summary = ""; newresnonse.CreatedByID = wp.CreatedByID; newresnonse.CreatedByScreenID = "WP00000"; newresnonse.CreatedDateTime = wp.CreatedDateTime; newresnonse.LastModifiedByID = wp.LastModifiedByID; newresnonse.LastModifiedByScreenID = "WP00000"; newresnonse.LastModifiedDateTime = wp.LastModifiedDateTime; if (kbrs == null || kbrs.PageID == null) { kbrs.PageID = currentwikipage; kbrs.CreatedByID = wp.CreatedByID; kbrs.CreatedByScreenID = "WP00000"; kbrs.CreatedDateTime = wp.CreatedDateTime; kbrs.LastModifiedByID = wp.LastModifiedByID; kbrs.LastModifiedByScreenID = "WP00000"; kbrs.LastModifiedDateTime = wp.LastModifiedDateTime; kbrs.Markcount = 1; kbrs.Marksummary = newresnonse.NewMark; 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; kbrs.AvRate = dAvRate; responsesummary.Insert(kbrs); responsesummary.PersistInserted(kbrs); responsesummary.Clear(); } else { kbrs.Markcount = kbrs.Markcount + 1; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; responsesummary.Update(kbrs); responsesummary.PersistUpdated(kbrs); responsesummary.Clear(); } response.Insert(newresnonse); response.PersistInserted(newresnonse); response.Clear(); } } string path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; var url = string.Format("{0}Wiki/{1}?pageid={2}", path, this.ResolveClientUrl("~/Wiki/ShowWiki.aspx"), pageid); url = url + "&rateid=" + Rate.Value; throw new Exception("Redirect0:" + url); } }