Esempio n. 1
0
        public virtual int?GetCalendarOrganizationID(PXGraph graph, PXCache attributeCache, object extRow)
        {
            if (!GetSourcesSpecification(attributeCache, extRow).SpecificationItems.Any())
            {
                return(FinPeriod.organizationID.MasterValue);
            }

            SourceValuesCollectionItem mainSourceValuesItem =
                GetEvaluatedPrimaryOrganizationIDsValuesItem(graph, attributeCache, extRow);

            List <int?> organizationIDs = mainSourceValuesItem != null
                                ? mainSourceValuesItem.OrganizationIDs
                                : GetEvaluatedOrganizationIDsValues(graph, attributeCache, extRow).OrganizationIDs;

            if (IsIDsUndefined(organizationIDs) &&
                (UseMasterOrganizationIDByDefault ||
                 (UseMasterCalendarSourceType != null && (bool?)BqlHelper.GetCurrentValue(graph, UseMasterCalendarSourceType, extRow) == true)))

            {
                return(FinPeriod.organizationID.MasterValue);
            }

            return(organizationIDs.FirstOrDefault());
        }
Esempio n. 2
0
        public virtual int?GetCalendarOrganizationID(object[] pars,
                                                     bool takeBranchForSelectorFromQueryParams,
                                                     bool takeOrganizationForSelectorFromQueryParams)
        {
            int?organizationID = null;

            SourceValuesCollectionItem sourceValuesItem = EvaluateOrganizationIDsValuesItem(
                new SourceValuesCollectionItem()
            {
                BranchIDs = takeBranchForSelectorFromQueryParams
                                                ? ((int?)pars[0]).SingleToList()
                                                : null,
                OrganizationIDs = takeOrganizationForSelectorFromQueryParams
                                                ? ((int?)pars[takeBranchForSelectorFromQueryParams ? 1 : 0]).SingleToList()
                                                : null
            });

            if (IsIDsUndefined(sourceValuesItem.OrganizationIDs) && UseMasterOrganizationIDByDefault)
            {
                organizationID = FinPeriod.organizationID.MasterValue;
            }

            return(organizationID);
        }
Esempio n. 3
0
        protected virtual SourceValuesCollectionItem EvaluateOrganizationIDsValuesItem(SourceValuesCollectionItem calendarOrganizationIdSourceValuesItem)
        {
            if (calendarOrganizationIdSourceValuesItem == null)
            {
                return(null);
            }

            if (IsIDsUndefined(calendarOrganizationIdSourceValuesItem.OrganizationIDs))
            {
                if (calendarOrganizationIdSourceValuesItem.BranchIDs != null)
                {
                    calendarOrganizationIdSourceValuesItem.OrganizationIDs =
                        calendarOrganizationIdSourceValuesItem.BranchIDs
                        .Select(branchID => PXAccess.GetParentOrganizationID(branchID))
                        .ToList();
                }
            }

            return(calendarOrganizationIdSourceValuesItem);
        }