示例#1
0
    /// <summary>
    /// Fill the branches drop-down list.
    /// </summary>
    private void FillBrachesList()
    {
        PXToolBarContainer cont     = (PXToolBarContainer)tlbPath.Items["branch"];
        PXDropDown         dropDown = this.GetBranchCombo();

        if (ControlHelper.IsReloadPage(dropDown))
        {
            dropDown.CallbackUpdatable = true;
        }

        string currBranchId  = null;
        int?   currentBranch = PXAccess.GetBranchID();

        List <PXAccess.BranchCollection.Info> items = GetBranches().ToList();

        items.Sort((a, b) => string.Compare(a.Cd, b.Cd));

        dropDown.Items.Clear();
        foreach (PXAccess.BranchCollection.Info item in items)
        {
            var current = (currentBranch != null && currentBranch.Equals(item.Id));
            dropDown.Items.Add(new PXListItem(item.Name, item.Id.ToString()));
            if (current)
            {
                currBranchId = item.Id.ToString();
            }
        }

        if (PXAccess.FeatureInstalled("PX.Objects.CS.FeaturesSet+Branch") && dropDown.Items.Count > 0)
        {
            if (ControlHelper.IsReloadPage(tlbPath))
            {
                tlbPath.CallbackUpdatable = true;
            }
            if (currentBranch != null)
            {
                dropDown.Value = currBranchId;
            }
            else
            {
                dropDown.Items.Insert(0, new PXListItem("Select Branch", null));
            }
            dropDown.ItemChanged += Branch_ItemClick;
        }
        else
        {
            cont.Visible = false;
            PXToolBarLabel lbl = tlbPath.Items["branchLabel"] as PXToolBarLabel;
            if (lbl != null)
            {
                lbl.Visible = false;
            }
            lbl = tlbPath.Items["branchSep"] as PXToolBarLabel;
            if (lbl != null)
            {
                lbl.Visible = false;
            }
        }
    }
示例#2
0
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!this.Page.IsCallback)
        {
            this.Page.ClientScript.RegisterHiddenField(_pivotIdField, string.Empty);
        }
        else
        {
            string pivotIDstr = this.Request.Form[_pivotIdField];
            int    pivotID;
            if (!string.IsNullOrEmpty(pivotIDstr) && int.TryParse(pivotIDstr, out pivotID))
            {
                DataSource.PivotTableID = pivotID;
            }
        }

        Title = DataSource.PivotTitle;
        tlbPivot.Style[HtmlTextWriterStyle.Display] = "none";

        // show tabs only if there is special parameter in the URL
        if (!String.Equals(this.Request.QueryString[PXPivotTableGraph.ShowTabsParam], true.ToString(), StringComparison.OrdinalIgnoreCase))
        {
            return;
        }

        string screenID     = this.Request.QueryString[typeof(PivotTable.screenID).Name];
        string pivotTableID = this.Request.QueryString[typeof(PivotTable.pivotTableID).Name];
        bool   isFirst      = true;

        if (!string.IsNullOrEmpty(screenID) && !this.Page.IsCallback)
        {
            foreach (PivotTable table in PXPivotTableGraph.PivotTables
                     .Where(t => String.Equals(t.ScreenID, screenID, StringComparison.OrdinalIgnoreCase) &&
                            !String.IsNullOrEmpty(t.Name)))
            {
                var btn = new PXToolBarButton
                {
                    Text        = table.Name,
                    Key         = table.PivotTableID.Value.ToString(),
                    ToggleMode  = true,
                    ToggleGroup = "1"
                };

                btn.Pushed = (pivotTableID == btn.Key);
                if (isFirst)
                {
                    btn.Attributes["first-tab"] = "1";
                    isFirst = false;
                }
                tlbPivot.Items.Add(btn);
            }
            if (tlbPivot.Items.Count > 1)
            {
                var lbl = new PXToolBarLabel()
                {
                    Width = Unit.Percentage(100)
                };
                tlbPivot.Items.Add(lbl);
                tlbPivot.Style[HtmlTextWriterStyle.Display] = "";
            }
        }
    }