private void RefreshActivityReminder() { ActivityReminder.Expire(); string key = _REMINDERLIST_SLOT_KEY_PREFIX + PXAccess.GetUserID(); PXContext.SetSlot <EPActivityReminder>(key, null); }
private void RefreshActivityReminder() { ActivityReminder.Expire(); string key = _REMINDERLIST_SLOT_KEY_PREFIX + PXAccess.GetUserID(); PXContext.SetSlot <EPActivityReminder>(key, null); PXDatabase.ResetSlot <EPActivityReminder>(key, typeof(CRActivity), typeof(EPView), typeof(EPAttendee), typeof(CRReminder), typeof(UserPreferences)); }
static void Prefetch(Dictionary <String, List <ExtraFieldInfo> > result) { try { PXContext.SetSlot(PXSelectorAttribute.selectorBypassInit, true); Dictionary <int, ExtraFieldInfo> id2ExtraField = new Dictionary <int, ExtraFieldInfo>(); IEnumerable <PXDataRecord> records = PXDatabase.Provider.SelectMulti(typeof(ExtraField), new PXDataField <ExtraField.extFieldId>(), new PXDataField <ExtraField.dataType>(), new PXDataField <ExtraField.name>(), new PXDataField <ExtraField.dacName>(), new PXDataField <ExtraField.defaultAttributes>()); foreach (PXDataRecord res in records) { ExtraFieldInfo efi = new ExtraFieldInfo() { Id = res.GetInt32(0).GetValueOrDefault(0), DataType = res.GetString(1), Name = res.GetString(2) }; if (!res.IsDBNull(4)) { efi.DefaultAttributes = res.GetString(4); } id2ExtraField.Add(efi.Id, efi); string dacName = res.GetString(3); List <ExtraFieldInfo> le = null; if (!result.TryGetValue(dacName, out le)) { le = new List <ExtraFieldInfo>(); result.Add(dacName, le); } le.Add(efi); } IEnumerable <PXDataRecord> records2 = PXDatabase.Provider.SelectMulti(typeof(ExtraFieldOnGraph), new PXDataField <ExtraFieldOnGraph.extFieldId>(), new PXDataField <ExtraFieldOnGraph.graphName>(), new PXDataField <ExtraFieldOnGraph.attributes>()); foreach (PXDataRecord res in records2) { int extFieldId = res.GetInt32(0).GetValueOrDefault(0); string graphName = res.GetString(1); string attribs = res.GetString(2); ExtraFieldInfo efi; if (!id2ExtraField.TryGetValue(extFieldId, out efi)) { continue; } efi.attributes.Add(new ExtraFieldInfo.FieldOnGraph(graphName, attribs)); } } finally { PXContext.SetSlot <bool>(PXSelectorAttribute.selectorBypassInit, false); } }
public UpdateIfFieldsChangedScope() { Changes currentContext = PXContext.GetSlot <Changes>(); if (currentContext == null) { currentContext = new Changes(); PXContext.SetSlot <Changes>(currentContext); } currentContext.ReferenceCounter++; }
public static EPActivityReminder GetFromSlot(string key, TasksAndEventsReminder graph) { EPActivityReminder slot = PXDatabase.GetSlot <EPActivityReminder, TasksAndEventsReminder>(key, graph, typeof(CRActivity), typeof(EPView), typeof(EPAttendee), typeof(CRReminder), typeof(UserPreferences)); if (slot.DBChanged) { PXContext.SetSlot <EPActivityReminder>(key, null); PXDatabase.ResetSlot <EPActivityReminder>(key, typeof(CRActivity), typeof(EPView), typeof(EPAttendee), typeof(CRReminder), typeof(UserPreferences)); slot = PXDatabase.GetSlot <EPActivityReminder, TasksAndEventsReminder>(key, graph, typeof(CRActivity), typeof(EPView), typeof(EPAttendee), typeof(CRReminder), typeof(UserPreferences)); } return(slot); }
public static TimeZoneInfo.AdjustmentRule GetRule(int year, string id) { var parameter = new DefinitionParameters(id, year); var key = _SLOT_KEY + year + id; Definition def = PXContext.GetSlot <Definition>(key); if (def == null) { using (new PXConnectionScope()) { def = PXDatabase.GetSlot <Definition, DefinitionParameters>(key, parameter, _tables); PXContext.SetSlot(key, def); } } return(def?.Rule); }
public void Dispose() { if (_disposed) { throw new PXObjectDisposedException(); } _disposed = true; Changes currentContext = PXContext.GetSlot <Changes>(); currentContext.ReferenceCounter--; if (currentContext.ReferenceCounter == 0) { PXContext.SetSlot <Changes>(null); } }
public RunningSelectingScope(PXGraph myGraph) { _MyGraphSelecting = myGraph.GetType().FullName; _Previous = PXContext.GetSlot <RunningSelectingScope <DAC> >(); if (_Previous == null) { _GraphList = new List <string>(); } else { _GraphList = new List <string>(_Previous._GraphList); } _GraphList.Add(_MyGraphSelecting); PXContext.SetSlot <RunningSelectingScope <DAC> >(this); }
protected void Page_Load(object sender, EventArgs e) { ds.PrepareScreen(); PXGenericInqGrph genGraph = (PXGenericInqGrph)ds.DataGraph; if (genGraph.Design != null) { if (genGraph.Design.PrimaryScreenID != null && PXList.Provider.IsList(genGraph.Design.PrimaryScreenID)) { PXContext.Session.SetString(LastEntryScreenSessionKey, genGraph.Design.PrimaryScreenID); } // Clear saved searches in case if parameters changed if (genGraph.Design.DesignID != null && PXGenericInqGrph.ParametersChanged[genGraph.Design.DesignID.Value]) { ds.SavedSearchesClear(true); PXGenericInqGrph.ParametersChanged[genGraph.Design.DesignID.Value] = false; } } else // GI configuration with defined ID/Name does not exist in this company (for example, when changing company) { string screenID = PXContext.Session[LastEntryScreenSessionKey] as string; PXContext.Session.SetString("LastUrl", null); // clear last url to prevent loading GI page again (Main.aspx loads LastUrl when there is no ScreenID) string redirectUrl = PXUrl.MainPagePath; if (!String.IsNullOrEmpty(screenID)) { redirectUrl += "?ScreenID=" + screenID; } Redirector.SmartRedirect(HttpContext.Current, redirectUrl); } PXContext.SetSlot <Guid?>("__GEN_INQ_DESIGN_ID__", genGraph.Design.DesignID); var phF = this.FindControl("cont2"); if (!form.Visible) { //grid.GridStyles.ToolsCell.CssClass += " transparent"; form.Parent.Parent.Visible = false; } }
public CBAPIService(String endpoint, string version) { EntityHelper = ServiceLocator.Current.GetInstance <Func <string, string, IEntityHelper> >()(endpoint, version); string userName = "******"; if (PXDatabase.Companies.Length > 0) { var company = PXAccess.GetCompanyName(); if (string.IsNullOrEmpty(company)) { company = PXDatabase.Companies[0]; } userName = userName + "@" + company; } LoginScope = new PXLoginScope(userName, PXAccess.GetAdministratorRoles()); CultureScope = new PX.Common.PXInvariantCultureScope(); if (PXContext.GetSlot <System.Web.SessionState.ISessionStateItemCollection>() == null) { PXContext.SetSlot <System.Web.SessionState.ISessionStateItemCollection>(new System.Web.SessionState.SessionStateItemCollection()); } }
private IEnumerable GetRecords <Table>(string parentKey, Func <IEnumerable <Table> > apiMethod) where Table : class, IBqlTable, new() { var recordsKey = $"{typeof(Table).FullName}.Cache"; var store = PXContext.GetSlot <IDictionary <string, IEnumerable <Table> > >(recordsKey); if (store == null) { store = new Dictionary <string, IEnumerable <Table> >(); PXContext.SetSlot <IDictionary <string, IEnumerable <Table> > >(recordsKey, store); } IEnumerable <Table> records; if (store.TryGetValue(parentKey, out records) == false) { records = apiMethod().ToArray <Table>(); store[parentKey] = records; } return(records); }
void IPrefetchable <PXWizardSiteMapProvider> .Prefetch(PXWizardSiteMapProvider provider) { PXContext.SetSlot("PrefetchSiteMap", true); System.Globalization.CultureInfo prevCulture = null; if (Thread.CurrentThread.CurrentCulture.Name != Thread.CurrentThread.CurrentUICulture.Name) { prevCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture; } Dictionary <Guid, WZScenario> wizardScenarios = GetWizardScenarios(); base.Prefetch(provider); // Main site map if (!PXSiteMap.IsPortal) { foreach (Guid scenarioID in wizardScenarios.Keys) { List <string> scenarioRole = new List <string>(); if (!String.IsNullOrEmpty(wizardScenarios[scenarioID].Rolename)) { scenarioRole.Add(wizardScenarios[scenarioID].Rolename); } // If scenario is not active we should use different graph bool scenarioIsActive = wizardScenarios[scenarioID].Status == WizardScenarioStatusesAttribute._ACTIVE; PXSiteMapNode node, rootScenarioNode; if (scenarioIsActive) { node = base.FindSiteMapNodesFromGraphType(typeof(WizardScenarioMaint).FullName, false).FirstOrDefault(); } else { node = base.FindSiteMapNodesFromGraphType(typeof(WizardNotActiveScenario).FullName, false).FirstOrDefault(); } string url = PXSiteMap.DefaultFrame; if (node != null) { url = String.Format("{0}?ScenarioID={1}", node.Url, System.Web.HttpUtility.UrlEncode(scenarioID.ToString())); } rootScenarioNode = base.FindSiteMapNodesFromScreenID(WizardRootNode, false).FirstOrDefault(); PXSiteMapNode scenarioNode = CreateWizardNode(provider, scenarioID, url, wizardScenarios[scenarioID].Name, wizardScenarios[scenarioID].Name, new PXRoleList(scenarioRole.Count == 0 ? null : scenarioRole, null, null), null, "WZ201500"); if (wizardScenarios[scenarioID].NodeID != Guid.Empty) { if (scenarioIsActive) { if (rootScenarioNode != null && rootScenarioNode.NodeID == (Guid)wizardScenarios[scenarioID].NodeID) { PXSiteMapNode DummyNode = base.FindSiteMapNodesFromScreenID("WZ000001", false).FirstOrDefault(); if (DummyNode == null) { DummyNode = CreateWizardNode(provider, Guid.NewGuid(), PXSiteMap.DefaultFrame, "Work Area", "Work Area", null, null, "WZ000001"); AddNode(DummyNode, rootScenarioNode.NodeID); } AddNode(scenarioNode, DummyNode.NodeID); } else { AddNode(scenarioNode, (Guid)wizardScenarios[scenarioID].NodeID); } } else { AddNode(scenarioNode, Guid.Empty); } } else { if (scenarioIsActive) { if (rootScenarioNode != null) { PXSiteMapNode DummyNode = base.FindSiteMapNodesFromScreenID("WZ000001", false).FirstOrDefault(); if (DummyNode == null) { DummyNode = CreateWizardNode(provider, Guid.NewGuid(), PXSiteMap.DefaultFrame, "Work Area", "Work Area", null, null, "WZ000001"); AddNode(DummyNode, rootScenarioNode.NodeID); } AddNode(scenarioNode, DummyNode.NodeID); } } else { AddNode(scenarioNode, Guid.Empty); } } } } if (prevCulture != null) { Thread.CurrentThread.CurrentCulture = prevCulture; } PXContext.SetSlot("PrefetchSiteMap", false); }
void IPrefetchable <DefinitionParams> .Prefetch(DefinitionParams parameters) { try { PXContext.SetSlot <bool>(PXSelectorAttribute.selectorBypassInit, true); List <object> attributes = new List <object>(); List <string> distinct = new List <string>(); PXView view = null; IBqlSearch srch = null; if (parameters.Selector == null) { PXFieldState state = parameters.Foreign.GetStateExt(null, parameters.Field.Name) as PXFieldState; if (state != null && !String.IsNullOrEmpty(state.ViewName)) { view = parameters.Main.Graph.Views[state.ViewName]; srch = view.BqlSelect as IBqlSearch; } } else { view = new PXView(parameters.Main.Graph, true, parameters.Selector); srch = view.BqlSelect as IBqlSearch; } if (srch != null) { if (!view.AllowSelect) { throw new PXException(ErrorMessages.NotEnoughRightsToAccessObject, view.GetItemType().Name); } object current = parameters.Main.CreateInstance(); foreach (object res in view.SelectMultiBound(new object[] { current })) { object attr = (res is PXResult ? ((PXResult)res)[0] : res); if (attr != null) { string name = view.Cache.GetValue(attr, srch.GetField().Name) as string; if (!String.IsNullOrEmpty(name) && !distinct.Contains(name)) { distinct.Add(name); attributes.Add(attr); } } } // Creating empty graph to get original field state without overridden attributes on CacheAttached in parameters.Main.Graph PXGraph independentGraph = PXGraph.CreateInstance <AttrGraph>(); PXCache independentCache = independentGraph.Caches[parameters.Main.GetItemType()]; foreach (IBqlParameter par in view.BqlSelect.GetParameters()) { if (par.HasDefault && par.GetReferencedType().IsNested&& BqlCommand.GetItemType(par.GetReferencedType()).IsAssignableFrom(parameters.Main.GetItemType())) { PXFieldState state = independentCache.GetStateExt(null, par.GetReferencedType().Name) as PXFieldState; // graph-independent state if (state != null && !String.IsNullOrEmpty(state.ViewName)) { PXView parview = independentGraph.Views[state.ViewName]; List <object> pars = new List <object>(); IBqlSearch parsrch = parview.BqlSelect as IBqlSearch; if (parsrch != null) { foreach (object res in parview.SelectMultiBound(new object[] { current })) { object item = res; if (item is PXResult) { item = PXResult.Unwrap(item, parview.Cache.GetItemType()); } if (item is PXFieldState) { item = PXFieldState.UnwrapValue(item); } object cls = parview.Cache.GetValue(item, parsrch.GetField().Name); if (cls != null) { parameters.Main.SetValue(current, par.GetReferencedType().Name, cls); foreach (object parres in view.SelectMultiBound(new object[] { current })) { object attr = (parres is PXResult ? ((PXResult)parres)[0] : parres); if (attr != null) { string name = view.Cache.GetValue(attr, srch.GetField().Name) as string; if (!String.IsNullOrEmpty(name) && !distinct.Contains(name)) { distinct.Add(name); attributes.Add(attr); } } } } } } } break; } } } List <PXFieldState> fields = new List <PXFieldState>(); foreach (object attr in attributes) { var fs = CreateFieldState(((string)view.Cache.GetValue(attr, srch.GetField().Name)) + '_' + parameters.FieldName, (string)view.Cache.GetValue(attr, parameters.DescriptionField), (int)view.Cache.GetValue(attr, parameters.ControlTypeField), (string)view.Cache.GetValue(attr, parameters.EntryMaskField), (string)view.Cache.GetValue(attr, parameters.ListField)); if (fs != null) { fields.Add(fs); } } Fields = fields.ToArray(); } finally { PXContext.SetSlot <bool>(PXSelectorAttribute.selectorBypassInit, false); } }
public void Clear <Table>() where Table : class, IBqlTable, new() { var recordsKey = $"{typeof(Table).FullName}.Cache"; PXContext.SetSlot <IEnumerable <Table> >(recordsKey, null); }
void IDisposable.Dispose() { PXContext.SetSlot(scopeKey, false); }
public FlaggedModeScopeBase() { PXContext.SetSlot(scopeKey, true); }
private void SynchronizeFolderContentsWithScreen(string screenID, string folderID, bool isForcingSync) { // Retrieve top-level folder list var tokenHandler = PXGraph.CreateInstance <UserTokenHandler>(); List <BoxUtils.FileFolderInfo> boxFolderList = new List <BoxUtils.FileFolderInfo>(); if (FieldsGroupingByScreenID.Select(screenID).Any()) { boxFolderList = BoxUtils.GetFolderList(tokenHandler, folderID, (int)BoxUtils.RecursiveDepth.FirstSubLevel).Result; boxFolderList = boxFolderList.Where(x => x.Name.Contains("\\")).ToList(); } else { boxFolderList = BoxUtils.GetFolderList(tokenHandler, folderID, (int)BoxUtils.RecursiveDepth.NoDepth).Result; } foreach (BoxUtils.FileFolderInfo boxFolderInfo in boxFolderList) { BoxFolderCache bfc = FoldersByFolderID.Select(boxFolderInfo.ID); if (bfc != null) { //Make sure NoteDoc still exists NoteDoc nd = NoteDocs.Select(bfc.RefNoteID); if (nd == null) { //NoteDoc can't be found; this is likely a file coming from a record that was deleted. //Since an existing folder may be renamed to something which exists, we want to force system to treat it as if it was a new folder FoldersByFolderID.Delete(bfc); bfc = null; } } if (bfc == null) { // We've never seen this folder; sync it Guid?refNoteID; if (screenID == ActivityMaintScreenId) { //Activity folders use custom naming defined in GetFolderNameForActivityRow() - just look for GUID inside it. refNoteID = ExtractGuidFromString(boxFolderInfo.Name); } else { refNoteID = FindMatchingNoteIDForFolder(screenID, boxFolderInfo.Name); } if (refNoteID == null) { // User may have created some folder manually with a name not matching to any record, or record // may have been deleted in Acumatica. We can safely ignore it, but let's write to trace. PXTrace.WriteWarning(string.Format("No record found for folder {0} (screen {1}, ID {2})", boxFolderInfo.Name, screenID, boxFolderInfo.ID)); continue; } bfc = (BoxFolderCache)FoldersByNote.Select(refNoteID); if (bfc != null) { // A folder existed before for this record; clear the previous entry for this refNoteID FoldersByNote.Delete(bfc); } // Store folder in cache for future reference bfc = (BoxFolderCache)FoldersByFolderID.Cache.CreateInstance(); bfc.FolderID = boxFolderInfo.ID; bfc.ParentFolderID = boxFolderInfo.ParentFolderID; bfc.RefNoteID = refNoteID; bfc.LastModifiedDateTime = null; //To force initial sync bfc = FoldersByFolderID.Insert(bfc); } if (isForcingSync || bfc.LastModifiedDateTime != boxFolderInfo.ModifiedAt) { RefreshRecordFileList(screenID, boxFolderInfo.Name, boxFolderInfo.ID, bfc.RefNoteID, isForcingSync); bfc.LastModifiedDateTime = boxFolderInfo.ModifiedAt; FoldersByFolderID.Update(bfc); PXContext.SetSlot <bool>("BoxDisableLoad", true); try { Actions.PressSave(); } finally { PXContext.SetSlot <bool>("BoxDisableLoad", false); } } } }
public void RefreshRecordFileList(string screenID, string folderName, string folderID, Guid?refNoteID, bool isForcingSync) { var tokenHandler = PXGraph.CreateInstance <UserTokenHandler>(); //Get list of files contained in the record folder. RecurseDepth=0 will retrieve all subfolders List <BoxUtils.FileFolderInfo> boxFileList = BoxUtils.GetFileList(tokenHandler, folderID, (int)BoxUtils.RecursiveDepth.Unlimited).Result; // Remove files from cache if they don't exist on Box server foreach (PXResult <BoxFileCache, UploadFileRevisionNoData, UploadFile, NoteDoc> result in FilesByNoteID.Select(refNoteID)) { BoxUtils.FileFolderInfo boxFile = boxFileList.FirstOrDefault(f => f.ID == ((BoxFileCache)result).FileID); if (boxFile == null) { //File was deleted FilesByNoteID.Delete(result); UploadFiles.Delete(result); UploadFileRevisions.Delete(result); NoteDocs.Delete(result); } else { // File still exists, remove it from in-memory list // so we don't process it as a new file in the next loop boxFileList.Remove(boxFile); } } // Remove any files/folders coming from activities stored beneath the current record, they've been processed above var filesFoundOnlyOnServer = boxFileList.Where(x => !x.Name.StartsWith(Messages.ActivitiesFolderName)).ToList(); //Check for underlying activities records BoxFolderCache currentFolder = FoldersByFolderID.Select(folderID); if (currentFolder != null && boxFileList.Any(x => x.Name.StartsWith(Messages.ActivitiesFolderName))) { // If nullOrEmpty, Folder may have been created manually if (string.IsNullOrEmpty(currentFolder.ActivityFolderID)) { //Find actual folder ID and save in BoxFolderCache's ActivityFolderID field BoxUtils.FileFolderInfo activityFolderinfo = BoxUtils.FindFolder(tokenHandler, folderID, Messages.ActivitiesFolderName).Result; if (activityFolderinfo != null) { currentFolder.ActivityFolderID = activityFolderinfo?.ID; FoldersByFolderID.Update(currentFolder); } } if (currentFolder.ActivityFolderID != null) { SynchronizeFolderContentsWithScreen(ActivityMaintScreenId, currentFolder.ActivityFolderID, isForcingSync); } } //Remaining files aren't found in cache but are in Box server. if (filesFoundOnlyOnServer.Any()) { if (refNoteID == null) { // User may have created some folder manually with a name not matching to any record, or record // may have been deleted in Acumatica. We can safely ignore it, but let's write to trace. PXTrace.WriteWarning(string.Format("No record found for folder {0} (screen {1}, ID {2})", folderName, screenID, folderID)); return; } UploadFileMaintenance ufm = PXGraph.CreateInstance <UploadFileMaintenance>(); ufm.IgnoreFileRestrictions = true; ufm.RowInserting.AddHandler <UploadFileRevision>(delegate(PXCache sender, PXRowInsertingEventArgs e) { ((UploadFileRevision)e.Row).BlobHandler = Guid.NewGuid(); }); //Add files to the caches foreach (BoxUtils.FileFolderInfo boxFile in filesFoundOnlyOnServer) { ufm.Clear(); string fileName = string.Format("{0}\\{1}", folderName, boxFile.Name.Replace(Path.GetInvalidPathChars(), ' ')); FileInfo fileInfo = ufm.GetFileWithNoData(fileName); Guid? blobHandlerGuid; if (fileInfo == null) { fileInfo = new FileInfo(fileName, null, new byte[0]); //The SaveFile call will trigger a Load() on the BoxBlobStorageProvider which can be skipped PXContext.SetSlot <bool>("BoxDisableLoad", true); try { if (!ufm.SaveFile(fileInfo)) { throw new PXException(Messages.ErrorAddingFileSaveFileFailed, fileName); } } finally { PXContext.SetSlot <bool>("BoxDisableLoad", false); } if (!fileInfo.UID.HasValue) { throw new PXException(Messages.ErrorAddingFileUIDNull, fileName); } UploadFileMaintenance.SetAccessSource(fileInfo.UID.Value, null, screenID); NoteDoc noteDoc = (NoteDoc)NoteDocs.Cache.CreateInstance(); noteDoc.NoteID = refNoteID; noteDoc.FileID = fileInfo.UID; NoteDocs.Insert(noteDoc); blobHandlerGuid = ufm.Revisions.Current.BlobHandler; } else { //File already exists in the database, retrieve BlobHandler if (!fileInfo.UID.HasValue) { throw new PXException(Messages.GetFileWithNoDataReturnedUIDNull, fileName); } blobHandlerGuid = GetBlobHandlerForFileID(fileInfo.UID.Value); //Clear old references of this blob handler from cache; it will be reinserted with up-to-date info var bfcOrphan = (BoxFileCache)FilesByBlobHandler.Select(blobHandlerGuid); if (bfcOrphan != null) { FilesByBlobHandler.Delete(bfcOrphan); } //Update NoteDoc entry if existing file was moved to new NoteID or create it if not there NoteDoc nd = (NoteDoc)NoteDocsByFileID.Select(fileInfo.UID); if (nd == null) { nd = (NoteDoc)NoteDocs.Cache.CreateInstance(); nd.NoteID = refNoteID; nd.FileID = fileInfo.UID; NoteDocs.Insert(nd); } else if (nd.NoteID != refNoteID) { nd.NoteID = refNoteID; NoteDocs.Update(nd); } } var bfc = (BoxFileCache)FilesByBlobHandler.Cache.CreateInstance(); bfc.BlobHandler = blobHandlerGuid; bfc.FileID = boxFile.ID; bfc.ParentFolderID = boxFile.ParentFolderID; bfc = FilesByBlobHandler.Insert(bfc); } } }
protected void Page_Load(object sender, EventArgs e) { ds.PrepareScreen(); PXGenericInqGrph genGraph = (PXGenericInqGrph)ds.DataGraph; if (genGraph.Design != null) { // Check access rights - they are handled by SiteMapProvider by URL // but GI can be opened by using different URLs (by ID and by Name) if (!PXGraph.ProxyIsActive && !PXGraph.GeneratorIsActive && this.Context != null) { string nodeUrl = PXUrl.IgnoreSystemParameters(PXUrl.ToRelativeUrl(this.Request.Url.ToString())); var node = PXSiteMap.Provider.FindSiteMapNodeUnsecure(nodeUrl); if (node == null || !node.IsAccessibleToUser(this.Context)) { // If there is no access to the GI itself or it is not in site map, // consider it as a "Preview" mode in the GI designer and check access rights for the GI designer itself var designerNode = PXSiteMap.Provider.FindSiteMapNodeByGraphType(typeof(PX.Data.Maintenance.GI.GenericInquiryDesigner).FullName); if (designerNode == null) { Redirector.SmartRedirect(HttpContext.Current, PXUrl.MainPagePath); return; } } } if (genGraph.Design.PrimaryScreenID != null && PXList.Provider.IsList(genGraph.Design.PrimaryScreenID)) { PXContext.Session.SetString(LastEntryScreenSessionKey, genGraph.Design.PrimaryScreenID); } // Clear saved searches in case if parameters changed if (genGraph.Design.DesignID != null && PXGenericInqGrph.ParametersChanged[genGraph.Design.DesignID.Value]) { ds.SavedSearchesClear(true); PXGenericInqGrph.ParametersChanged[genGraph.Design.DesignID.Value] = false; } } else // GI configuration with defined ID/Name does not exist in this company (for example, when changing company) { string screenID = PXContext.Session[LastEntryScreenSessionKey] as string; PXContext.Session.SetString("LastUrl", null); // clear last url to prevent loading GI page again (Main page loads LastUrl when there is no ScreenID) string redirectUrl = PXUrl.MainPagePath; if (!String.IsNullOrEmpty(screenID)) { redirectUrl += "?ScreenID=" + screenID; } Redirector.SmartRedirect(HttpContext.Current, redirectUrl); } PXContext.SetSlot <Guid?>("__GEN_INQ_DESIGN_ID__", genGraph.Design.DesignID); var phF = this.FindControl("cont2"); if (!form.Visible) { //grid.GridStyles.ToolsCell.CssClass += " transparent"; form.Parent.Parent.Visible = false; } }
public void Dispose() { PXContext.SetSlot <RunningSelectingScope <DAC> >(_Previous); }
protected void Page_Load(object sender, EventArgs e) { PXContext.SetSlot <Guid?>("__GEN_INQ_DESIGN_ID__", ((PXGenericInqGrph)ds.DataGraph).Design.DesignID); }