示例#1
0
    // We'll need this code in case we use ASP.NET standard localization
    protected void Page_Init(object sender, EventArgs e)
    {
        base.InsertDocumentsFrame(this.form1);

        Page.Header.Controls.Add(new System.Web.UI.LiteralControl(
                                     "<script type='text/javascript' src=\"" + ResolveUrl("~/Scripts/jquery-3.1.1.min.js") + "\"></script>"));

        if (!Page.IsPostBack)
        {
            var ds = PXPage.GetDefaultDataSource(this.Page);
            if (ds != null)
            {
                ds.ClientEvents.CommandPerformed = "commandResult";
            }
        }
    }
    /// <summary>
    /// The tlbPath callback event handler.
    /// </summary>
    protected void tlbPath_CallBack(object sender, PXCallBackEventArgs e)
    {
        if (e.Command.Name == "AddFav" && PXSiteMap.CurrentNode != null)
        {
            Guid nodeID = PXSiteMap.CurrentNode.NodeID;
            if (!IsInFavorites(nodeID))
            {
                AddFavorite(screenTitle, nodeID);
            }
            else
            {
                PXDatabase.Delete <Favorite>(
                    new PXDataFieldRestrict("UserID", PXAccess.GetUserID()),
                    new PXDataFieldRestrict("SiteMapID", nodeID)
                    );
            }
            PXContext.Session.FavoritesExists["FavoritesExists"] = null;
            PXSiteMap.FavoritesProvider.Clear();

            // check if favorites exists
            using (PXDataRecord exist = PXDatabase.SelectSingle <Favorite>(
                       new PXDataField("UserID"), new PXDataFieldValue("UserID", PXAccess.GetUserID())))
            {
                e.Result = (exist == null) ? "0" : "1";
            }
        }
        else if (e.Command.Name == "ClearFilter")
        {
            var ds = PXPage.GetDefaultDataSource(this.Page);
            if (ds != null)
            {
                var action = ds.DataGraph.Actions[clearFilterCommand];
                if (action != null)
                {
                    action.Press();
                }
            }
            PXCallbackManager.RegisterJavaScript(
                "if (window['__px_alls'] && __px_alls(this) && __px_alls(this)['tlbPath'])__px_alls(this)['tlbPath'].items['clearFilter'].setVisible(false);");
        }
    }
示例#3
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);
    }
示例#4
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());
    }
示例#5
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);
    }
示例#6
0
    //---------------------------------------------------------------------------
    /// <summary>
    /// The page Load event handler.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        var ds = PXPage.GetDefaultDataSource(this.Page);

        if (ds != null && ds.HasActiveContext)
        {
            if (ControlHelper.IsReloadPage(this))
            {
                var ctx = ds.DataGraph.GetContextViewDescriptor();
                if (ctx != null)
                {
                    if (ctx.HeaderValues != null)
                    {
                        screenTitle = string.Join(" - ", ctx.HeaderValues).ToUpper();
                    }
                    if (this.Visible)
                    {
                        var cm = PXCallbackManager.GetInstance();
                        PXCallbackManager.RegisterJavaScript(
                            string.Format("px.elemByID('{0}').innerHTML = '{1}';", LabelScreen.ClientID, screenTitle));
                    }
                }
            }
            else
            {
                screenTitle = " ";
            }
        }

        if (!string.IsNullOrEmpty(screenTitle))
        {
            this.ScreenTitle = HttpUtility.HtmlDecode(screenTitle);
        }
        if (!Page.IsCallback)
        {
            Page.EnableViewState = false;
            RegisterSyncTreeVars();
        }
        if (!this.Visible)
        {
            return;
        }

        Page.ClientScript.RegisterClientScriptBlock(GetType(), "addToFavorites", "var addToFavorites=\"" + PXMessages.Localize(InfoMessages.AddToFavorites) + "\";", true);
        Page.ClientScript.RegisterClientScriptBlock(GetType(), "removeFromFavorites", "var removeFromFavorites=\"" + PXMessages.Localize(InfoMessages.RemoveFromFavorites) + "\";", true);
        if (!this.Page.IsCallback || ControlHelper.IsReloadPage(tlbPath))
        {
            InitHelpMenu();
            RearrangeAuditMenu();
        }

        if (!willShowWelcomePage && this.Request.RawUrl.IndexOf("CS100000.aspx", StringComparison.InvariantCultureIgnoreCase) < 0 &&
            this.Request.RawUrl.IndexOf("/soap/", StringComparison.InvariantCultureIgnoreCase) == -1 &&
            this.Request.RawUrl.IndexOf("/wiki/", StringComparison.InvariantCultureIgnoreCase) == -1)
        {
            if (!PXAccess.FeatureSetInstalled("PX.Objects.CS.FeaturesSet"))
            {
                PXSiteMapNode cs = PXSiteMap.Provider.FindSiteMapNodeByScreenID("CS100000");
                if (cs != null)
                {
                    string navigateUrl = ResolveUrl(cs.Url);
                    if (!Page.IsCallback)
                    {
                        Response.Redirect(navigateUrl);
                    }
                }
            }
        }

        string localPath = Request.Url.LocalPath;

        if (!PXUrl.IsMainPage(Request.RawUrl) && !Request.Url.Query.Contains("PopupPanel=On"))
        {
            if (!localPath.EndsWith("Default.aspx"))
            {
                string lastUrl = (string)PXContext.Session["LastUrl"];
                if (String.IsNullOrEmpty(lastUrl) || lastUrl.EndsWith("Default.aspx"))
                {
                    Controls.Add(new LiteralControl("<script  type=\"text/javascript\">try { window.top.lastUrl=null; } catch (ex) {}</script>\n"));
                }
            }
            PXContext.Session.SetString("LastUrl", Request.RawUrl);
        }

        if (!Page.IsPostBack && !String.IsNullOrEmpty(ScreenID))
        {
            PX.Data.PXAuditJournal.Register(ScreenID);
        }

        if (!string.IsNullOrEmpty(screenTitle))
        {
            string relPath = ResolveUrl(Request.RawUrl);
            string url     = ResolveUrl(Request.RawUrl);
            LabelScreen.HRef = (Page != null && Page.GetType().Name == "wiki_showwiki_aspx") ? PXSessionStateStore.GetSessionUrl(HttpContext.Current, url) : url;

            if (PXSiteMap.CurrentNode != null && PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID))
            {
                string        listScreenID = PXList.Provider.GetListID(PXSiteMap.CurrentNode.ScreenID);
                PXSiteMapNode listNode     = PXSiteMap.Provider.FindSiteMapNodeByScreenID(listScreenID);
                if (listNode != null)
                {
                    LabelScreen.HRef         = ResolveUrl(listNode.Url);
                    LabelScreen.ServerClick += (o, args) =>
                    {
                        PXList.Provider.SetCurrentSearches(PXSiteMap.CurrentNode.ScreenID, null);
                        Response.Redirect(ControlHelper.FixHideScriptUrl(PXPageCache.FixPageUrl(ResolveUrl(listNode.Url)), false));
                    };
                }
            }
            if (screenUrl != null)
            {
                LabelScreen.HRef = screenUrl;
            }

            this.ScreenTitle = screenTitle;
        }

        if (!Page.IsCallback)
        {
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "toolbarNum", "var __toolbarID=\"" + this.tlbTools.ClientID + "\";", true);
        }
        if (ControlHelper.IsReloadPage(this))
        {
            SharedColumnSettings.SaveGrids();
        }
    }
示例#7
0
        private void AppendPanels(ITitleModuleController controller)
        {
            controller.Page.ClientScript.RegisterClientScriptInclude(controller.Page.GetType(), "Console", VirtualPathUtility.ToAbsolute("~/Scripts/console.js"));

            PXSmartPanel panel = new PXSmartPanel
            {
                ID             = _panelID,
                Width          = Unit.Pixel(750),
                Height         = Unit.Pixel(350),
                Caption        = "Acumatica Console",
                CaptionVisible = true,
                AutoRepaint    = true,
                BlockPage      = false,
                LoadOnDemand   = true, //Needed otherwise ClientEvents.AfterShow won't run on 2nd open of the panel
                AutoReload     = true,
                Position       = PanelPosition.Manual,
                Overflow       = OverflowType.Hidden
            };


            panel.ClientEvents.BeforeLoad = "BeforeLoadConsolePanel";
            panel.ClientEvents.BeforeLoad = "AfterLoadConsolePanel";
            panel.ClientEvents.BeforeShow = "BeforeShowConsolePanel";
            panel.ClientEvents.AfterShow  = "AfterShowConsolePanel";
            panel.ClientEvents.BeforeHide = "BeforeHideConsolePanel";
            panel.ClientEvents.AfterHide  = "AfterHideConsolePanel";

            panel.ApplyStyleSheetSkin(controller.Page);

            var ds       = PXPage.GetDefaultDataSource(controller.Page);
            var viewName = ds.DataGraph.PrimaryView;

            var form = new PXFormView()
            {
                ID           = "frmAcuShell",
                SkinID       = "Transparent",
                DataSourceID = ds.ID,
                DataMember   = "ConsoleView",
                AutoRepaint  = true
            };

            form.ApplyStyleSheetSkin(controller.Page);
            form.AutoSize.Enabled = true;

            var cc            = form.TemplateContainer.Controls;
            var consoleOutput = new PXHtmlView {
                ID = "pnlConsoleOutput", DataField = nameof(AcuShell.ConsoleFields.Output), Height = Unit.Percentage(100), Width = Unit.Percentage(100), SkinID = "Label"
            };

            consoleOutput.AutoSize.Enabled   = true; //TODO: Fix resizing of the console output... doesn't work right now
            consoleOutput.AutoSize.MinHeight = 500;
            consoleOutput.AutoSize.Container = DockContainer.Parent;
            cc.Add(consoleOutput);
            cc.Add(new PXTextEdit {
                ID = "pnlConsoleInput", DataField = nameof(AcuShell.ConsoleFields.Input)
            });
            cc.Add(new PXTextEdit {
                ID = "pnlGraphType", DataField = nameof(AcuShell.ConsoleFields.GraphType)
            });

            ((IParserAccessor)panel).AddParsedSubObject(form);

            var editor = new System.Web.UI.WebControls.Panel {
                ID = "pnlConsoleEditor", Height = Unit.Pixel(150), Width = Unit.Percentage(100)
            };

            ((IParserAccessor)panel).AddParsedSubObject(editor);

            controller.AppendControl(panel);
        }