示例#1
0
    private List <PropertyInfo> GetPrimaryViewKeyFields(PXDataSource ds)
    {
        if (ds != null)
        {
            if (!string.IsNullOrEmpty(ds.DataGraph.PrimaryView))
            {
                Type primaryViewType = ds.DataGraph.Views[ds.DataGraph.PrimaryView].Cache.GetItemType();

                return(primaryViewType.GetProperties().Where(p => p.CustomAttributes.Any(c =>
                                                                                         c.NamedArguments.Any(n => n.MemberName.Equals("IsKey")))).ToList());
            }
        }

        return(new List <PropertyInfo>());
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!PXAccess.FeatureInstalled <FeaturesSet.payrollModule>())
        {
            return;
        }

        PREarningTypeMaint graph = PXGraph.CreateInstance <PREarningTypeMaint>();
        string             url   = PXDataSource.getMainForm(graph.GetType());

        if (url == null)
        {
            return;
        }

        graph.Unload();
        PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = graph.GetType();
        Response.Redirect(this.ResolveUrl(url));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var graph = PXGraph.CreateInstance <FileHandler>();

        try
        {
            BoxFolderCache relatedFolder = graph.FoldersByFolderID.Select(Request.QueryString["itemID"]);
            new EntityHelper(graph).NavigateToRow(relatedFolder.RefNoteID, PXRedirectHelper.WindowMode.Same);
        }
        catch (PXRedirectRequiredException ex)
        {
            string url = PXDataSource.getMainForm(ex.Graph.GetType());
            if (url != null)
            {
                ex.Graph.Unload();
                PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                Response.Redirect(this.ResolveUrl(url));
            }
        }
    }
示例#4
0
    private void InitAuditMenu()
    {
        auditMenuEnabled = false;
        PXToolBarButton btn = (PXToolBarButton)tlbTools.Items[_TOOLBAR_HELP];

        if (AuditHistoryAvailable && !String.IsNullOrEmpty(this.screenID) && PX.Data.Process.PXAuditHelper.IsUserAuditor)
        {
            PXMenuItem item = null;
            if (PX.Data.PXDatabase.AuditRequired(this.screenID.Replace(".", "")))
            {
                item = new PXMenuItem("Audit History...");
                item.AutoCallBack.Command           = "auditHistory";
                item.AutoCallBack.ActiveBehavior    = true;
                item.AutoCallBack.Behavior.PostData = PostDataMode.Page;
                item.AutoCallBack.Behavior.Name     = "auditHistory";
                item.Value = "auditHistory";
            }
            else if (this.Page is PXPage)
            {
                //Don't initialize Audit History button on wiki page
                if (!(PXSiteMap.CurrentNode is PXWikiMapNode))
                {
                    PXDataSource datasource = ((PXPage)this.Page).DefaultDataSource;
                    if (datasource != null && PX.Data.Process.PXAuditHelper.IsInfoAvailable(datasource.DataGraph, datasource.PrimaryView))
                    {
                        PXCache cache = datasource.DataGraph.Views[datasource.PrimaryView].Cache;
                        item = new PXMenuItem("Audit History...")
                        {
                            PopupPanel = "pnlAudit"
                        };
                    }
                }
            }

            if (item != null)
            {
                btn.MenuItems.Add(item);
                auditMenuEnabled = true;
            }
        }
    }
示例#5
0
    protected void btnAuditDetails_CallBack(object sender, PXCallBackEventArgs e)
    {
        if (this.Page is PXPage)
        {
            PXDataSource datasource = ((PXPage)this.Page).DefaultDataSource;
            if (datasource != null)
            {
                String key     = PX.Data.Process.PXAuditHelper.CollectAudit(datasource.DataGraph, datasource.PrimaryView);
                String message = null;
                if (key != null)
                {
                    message = String.Concat("Redirect4:", ResolveUrl("~/frames/audit.aspx"), "?key=", key, "&preserveSession=true");
                }
                else
                {
                    message = PX.Data.ErrorMessages.AuditNotAvailable;
                }

                throw new Exception(message);
            }
        }
    }
示例#6
0
    public string GetRefNbrField()
    {
        PXDataSource ds          = PXPage.GetDefaultDataSource(this.Page);
        string       refNbrField = string.Empty;

        if (ds != null)
        {
            List <PropertyInfo> keyFields = GetPrimaryViewKeyFields(ds);

            if (keyFields.Any())
            {
                IEnumerable <PropertyInfo> docTypeFields = keyFields.
                                                           Where(f => f.Name.Contains("RefNbr", StringComparison.OrdinalIgnoreCase) ||
                                                                 f.Name.Contains("OrderNbr", StringComparison.OrdinalIgnoreCase));

                if (docTypeFields.Any())
                {
                    refNbrField = docTypeFields.First().Name;
                }
            }
        }
        return(refNbrField);
    }
示例#7
0
    /// <summary>
    /// The Audit panel load event handler.
    /// </summary>
    protected void pnlAudit_LoadContent(object sender, EventArgs e)
    {
        PXDataSource datasource = ((PXPage)this.Page).DefaultDataSource;

        PX.Data.Process.AUAuditPanelInfo info = null;
        if (datasource != null)
        {
            info = PX.Data.Process.PXAuditHelper.CollectInfo(datasource.DataGraph, datasource.PrimaryView);
        }
        if (info != null)
        {
            foreach (String field in PX.Data.Process.PXAuditHelper.FIELDS)
            {
                PXTextEdit edit = (PXTextEdit)frmAudit.FindControl("ed" + field);
                if (edit != null)
                {
                    Object result = typeof(PX.Data.Process.AUAuditPanelInfo).InvokeMember(field, System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, null, info, null);
                    edit.Text = result == null ? null : result.ToString();
                }
            }
        }
        else
        {
            frmAudit.Visible = false;
            ((PXLabel)pnlAudit.FindControl("lblWarning")).Visible = true;
        }

        PXSiteMapNode node = PXSiteMap.Provider.FindSiteMapNodeByScreenID("SM205510");

        if (node != null)
        {
            PXButton btnActivate = (PXButton)pnlAuditButtons.FindControl("btnAuditActivate");
            btnActivate.Visible     = true;
            btnActivate.NavigateUrl = String.Concat(ResolveUrl(node.Url), "?ScreenId=", this.screenID.Replace(".", ""));
        }
    }
示例#8
0
    protected virtual void Page_Init(object sender, EventArgs e)
    {
        this.ds  = this.DataSource;
        this.tab = this.TabView;
        T graph = (T)ds.DataGraph;

        /*T graph = Activator.CreateInstance(typeof(T)) as T;
         * if (graph == null) return;
         * ds.DataGraph = graph;*/

        /*if(string.IsNullOrEmpty(this.Request.QueryString["wiki"]))
         * {
         *  WikiPage current = (WikiPage)graph.Caches[typeof(WikiPage)].Current;
         *  if (current != null)
         *  {
         *      wiki = current.WikiID.ToString();
         *      if (!this.Page.IsCallback && !this.Page.IsPostBack && !string.IsNullOrEmpty(wiki))
         *      {
         *          graph.InitNew(PX.Common.GUID.CreateGuid(wiki), PX.Common.GUID.CreateGuid(current.ParentUID.ToString()), current.Name);
         *          ds.PageLoadBehavior = PXPageLoadBehavior.PopulateSavedValues;
         *          this.hasQueryParams = true;
         *      }
         *  }
         * }
         * else
         * {
         */
        if (!this.Page.IsCallback && !this.Page.IsPostBack && !string.IsNullOrEmpty(Request.QueryString["wiki"]))
        {
            graph.InitNew(PX.Common.GUID.CreateGuid(this.Request.QueryString["wiki"]), PX.Common.GUID.CreateGuid(this.Request.QueryString["parent"]), this.Request.QueryString["name"]);
            graph.Caches[typeof(PX.SM.WikiArticle)].IsDirty = false;
            ds.PageLoadBehavior = PXPageLoadBehavior.PopulateSavedValues;
            this.hasQueryParams = true;
        }
        //}
    }
示例#9
0
    public string GetRefNbrFieldValue()
    {
        PXDataSource ds          = PXPage.GetDefaultDataSource(this.Page);
        object       refNbrField = string.Empty;

        if (ds != null)
        {
            List <PropertyInfo> keyFields = GetPrimaryViewKeyFields(ds);

            if (keyFields.Any())
            {
                List <PropertyInfo> refNbrFields = keyFields.
                                                   Where(f => f.Name.Contains("RefNbr", StringComparison.OrdinalIgnoreCase) ||
                                                         f.Name.Contains("OrderNbr", StringComparison.OrdinalIgnoreCase)).ToList();

                if (refNbrFields.Any() && ds.DataGraph.Views[ds.DataGraph.PrimaryView].Cache.Current != null)
                {
                    refNbrField = refNbrFields.First().GetValue(
                        ds.DataGraph.Views[ds.DataGraph.PrimaryView].Cache.Current);
                }
            }
        }
        return(refNbrField == null ? string.Empty : refNbrField.ToString());
    }
示例#10
0
    public string GetDocTypeFieldValue()
    {
        PXDataSource ds           = PXPage.GetDefaultDataSource(this.Page);
        string       docTypeField = string.Empty;

        if (ds != null)
        {
            List <PropertyInfo> keyFields = GetPrimaryViewKeyFields(ds);

            if (keyFields.Any())
            {
                List <PropertyInfo> docTypeFields = keyFields.
                                                    Where(f => f.Name.Contains("DocType", StringComparison.OrdinalIgnoreCase) ||
                                                          f.Name.Contains("OrderType", StringComparison.OrdinalIgnoreCase)).ToList();

                if (docTypeFields.Any())
                {
                    docTypeField = docTypeFields.First().Name;
                }
            }
        }

        return(docTypeField);
    }