Ejemplo n.º 1
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (_previousModel != null && _previousModel.IsComplete)
     {
         if (!IsPostBack)
         {
             VariableSelector1.InitializeSelection(_previousModel);
             _previousModel = null;
         }
     }
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Path for selection should always contain tableid and not table name
            if (RouteInstance.RouteExtender != null && RouteInstance.RouteExtender.DoesSelectionPathContainTableName(this))
            {
                var linkItems = new List <LinkManager.LinkItem>();
                linkItems.Add(new LinkManager.LinkItem(PXWeb.PxUrl.TABLE_KEY, PxUrl.Table));
                string redirectLink = LinkManager.CreateLinkMethod("Selection.aspx", false, linkItems.ToArray());
                Response.Redirect(redirectLink, true);
            }

            if (RouteInstance.RouteExtender != null)
            {
                var  tableId      = RouteInstance.RouteExtender.GetTableIdByName(PxUrl.Table);
                bool hasTableData = RouteInstance.RouteExtender.HasTableData(tableId);

                if (!hasTableData)
                {
                    Response.Redirect(RouteInstance.RouteExtender.GetRedirectNoDataPath(tableId), true);
                }
            }

            ((PxWeb)this.Master).FooterText = "Selection";

            string lang  = PxUrl.Language;
            string db    = PxUrl.Database;
            string path  = PxUrl.Path;
            string table = PxUrl.Table;

            string partTable = "";

            //Check if the queryStrings contains partTable
            if (QuerystringManager.GetQuerystringParameter("partTable") != null)
            {
                partTable = QuerystringManager.GetQuerystringParameter("partTable");
            }
            // Bug 273
            // If we have no builder the groupings should be reloaded
            if (PCAxis.Web.Core.Management.PaxiomManager.PaxiomModelBuilder == null)
            {
                VariableSelector1.ReloadGroupings = true;
            }

            if (PCAxis.Web.Core.Management.PaxiomManager.PaxiomModel != null)
            {
                _previousModel = PCAxis.Web.Core.Management.PaxiomManager.PaxiomModel;
            }

            PCAxis.Web.Core.Management.PaxiomManager.PaxiomModel = PXWeb.Management.PxContext.GetPaxiomForSelection(db, path, table, lang);

            if (!IsPostBack)
            {
                Master.HeadTitle = PCAxis.Web.Core.Management.LocalizationManager.GetLocalizedString("PxWebTitleSelection");
                imgShowInformationExpander.ImageUrl = Page.ClientScript.GetWebResourceUrl(typeof(BreadcrumbCodebehind), "PCAxis.Web.Controls.spacer.gif");
                imgShowFootnotesExpander.ImageUrl   = Page.ClientScript.GetWebResourceUrl(typeof(BreadcrumbCodebehind), "PCAxis.Web.Controls.spacer.gif");
                imgShowMetadataExpander.ImageUrl    = Page.ClientScript.GetWebResourceUrl(typeof(BreadcrumbCodebehind), "PCAxis.Web.Controls.spacer.gif");
                Master.SetBreadcrumb(PCAxis.Web.Controls.Breadcrumb.BreadcrumbMode.Selection);
                Master.SetNavigationFlowMode(PCAxis.Web.Controls.NavigationFlow.NavigationFlowMode.Second);
                Master.SetNavigationFlowVisibility(PXWeb.Settings.Current.Navigation.ShowNavigationFlow);
                InitializeVariableSelector();
                InitializeTableInformation();
                InitializeMetatags();
                InitializeMetadata(path);

                //Check if the queryStrings contains partTable and the database type is CNMM
                //if so download subtable variables
                if (!string.IsNullOrEmpty(partTable))
                {
                    DatabaseInfo dbi = PXWeb.Settings.Current.General.Databases.GetDatabase(db);
                    if (dbi.Type == PCAxis.Web.Core.Enums.DatabaseType.CNMM)
                    {
                        SetValuesFromPartTable(partTable);
                    }
                }
            }

            DisplayTableMetadataLinks();
            VariableSelector1.PxActionEvent += new PCAxis.Web.Controls.PxActionEventHandler(HandlePxAction);
            VariableSelector1.MetadataInformationSelected += new VariableSelector.MetadataInformationSelectedEventHandler(HandleMetaDataInformationAction);

            if (_previousModel != null && _previousModel.IsComplete && !IsPostBack)
            {
                VariableSelector1.InitializeSelectedValuesetsAndGroupings(_previousModel);
            }
        }