Example #1
0
        //Checking whether the hardware component have enough resources for the new software
        public static bool haveEnoughMemCap(HardwareComponent currentHardware, SoftwareComponent currentSoftware)
        {
            bool result = true;

            if (currentHardware.MaxCapacity < currentSoftware.CapacityCons || currentHardware.MaxMemory < currentSoftware.MemoryCons)
            {
                result = false;
            }

            return(result);
        }
Example #2
0
        //TODO
        //Move methods-command to static class

        #region Methods
//Check if name of the given hardware component exist when adding a new software component.
        public static bool isHardwareCompExist(List <HardwareComponent> existingHardware,
                                               SoftwareComponent currentSoftware)
        {
            bool result = true;

            var item = existingHardware.FirstOrDefault(x => x.Name == currentSoftware.HardwareComponentName);

            if (item == null)
            {
                result = false;
            }
            return(result);
        }
Example #3
0
 //Removing software which belongs to the current hardware component and update used capacity and memory
 public void RemoveSoftware(SoftwareComponent currentSofware)
 {
     this.Software.Remove(currentSofware);
     this.usedCapacity -= currentSofware.CapacityCons;
     this.usedMemory   -= currentSofware.CapacityCons;
 }
Example #4
0
 //Adding software which belongs to the current hardware component and update used capacity and memory
 public void AddSoftware(SoftwareComponent currentSoftware)
 {
     this.Software.Add(currentSoftware);
     this.usedCapacity += currentSoftware.CapacityCons;
     this.usedMemory   += currentSoftware.MemoryCons;
 }