コード例 #1
0
        public List <License> GetAllOrSelectedLicenses(long?selectedSoftwareTypeID)
        {
            List <License> licenses = new List <License>();

            if (selectedSoftwareTypeID == null)
            {
                licenses = repository.GetAllLicenses();
            }
            else
            {
                licenses = repository.GetAllLicencesOfLicenseType(selectedSoftwareTypeID.Value);
            }


            foreach (var item in licenses)
            {
                if (item.LicenseType.LimitedUse == true)
                {
                    int qtyAssetLicensesPerLicense = repositoryAssetLicense.QtyAssetLicensePerLicense(item.LicenseID);

                    //if (item.QtyLimited > qtyAssetLicensesPerLicense)
                    //{
                    // If this license has still qty not used! Than changed the QtyLimited to the real one.
                    item.QtyLimited = item.QtyLimited - qtyAssetLicensesPerLicense;
                    //}
                }

                if (item.LicenseType.UnlimitedUse == true)
                {
                    item.QtyLimited = 88;
                }
            }

            return(licenses);
        }