Exemple #1
0
        public virtual void NavigateToItem(EPActivity current)
        {
            if (current != null)
            {
                var graphType = EPActivityPrimaryGraphAttribute.GetGraphType(current);
                if (!PXAccess.VerifyRights(graphType))
                {
                    ReminderList.Ask(CR.Messages.AccessDenied, CR.Messages.FormNoAccessRightsMessage(graphType), MessageButtons.OK, MessageIcon.Error);
                }
                else
                {
                    var graph      = (PXGraph)PXGraph.CreateInstance(graphType);
                    var cache      = graph.Caches[current.GetType()];
                    var searchView = new PXView(
                        graph,
                        false,
                        BqlCommand.CreateInstance(typeof(Select <>), cache.GetItemType()));
                    var startRow  = 0;
                    var totalRows = 0;
                    var acts      = searchView.
                                    Select(null, null,
                                           new object[] { current.TaskID },
                                           new string[] { typeof(EPActivity.taskID).Name },
                                           null, null, ref startRow, 1, ref totalRows);

                    if (acts != null && acts.Count > 0)
                    {
                        var act = acts[0];
                        cache.Current = act;
                        PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);
                    }
                }
            }
        }