Beispiel #1
0
        private int CalculateRequiredNumberOfLicences(UserInstallationRequirement userInstallationRequirements)
        {
            decimal desktopLicencesRequired = GetCountPerComputerType(userInstallationRequirements, ComputerType.Desktop);
            decimal laptopLicencesRequired  = GetCountPerComputerType(userInstallationRequirements, ComputerType.Laptop);

            if (desktopLicencesRequired >= laptopLicencesRequired)
            {
                return((int)desktopLicencesRequired);
            }

            var additionalLicencesRequired = (int)Math.Ceiling((laptopLicencesRequired - desktopLicencesRequired) / 2);

            return((int)desktopLicencesRequired + additionalLicencesRequired);
        }
Beispiel #2
0
 private int GetCountPerComputerType(UserInstallationRequirement installationRequirement, ComputerType type) =>
 installationRequirement.Installations.Where(i => i.Computer.ComputerType == type).Count();