Exemple #1
0
 public UnitPrice(Appliance appliance)
 {
     Name          = appliance.Name;
     Description   = ApplianceTypeConverter.ConvertTypeToString(appliance.Type);
     Quantity      = 1;
     UnitCostPrice = appliance.DataSheet.Price;
 }
        protected override bool Filter(Appliance obj)
        {
            // Filter based on type first
            if (IncludeBoilers || IncludeCentralHeatingPlants || IncludeContainers || IncludeHeatPumps || IncludeSolarStations ||
                IncludeLowTempHeatPumps || IncludeSolarPanels || IncludeTemperatureControllers || IncludeWaterHeaters)
            {
                switch (obj.Type)
                {
                case ApplianceTypes.Boiler:
                    if (!IncludeBoilers)
                    {
                        return(false);
                    }
                    break;

                case ApplianceTypes.CHP:
                    if (!IncludeCentralHeatingPlants)
                    {
                        return(false);
                    }
                    break;

                case ApplianceTypes.Container:
                    if (!IncludeContainers)
                    {
                        return(false);
                    }
                    break;

                case ApplianceTypes.HeatPump:
                    if (!IncludeHeatPumps)
                    {
                        return(false);
                    }
                    break;

                case ApplianceTypes.LowTempHeatPump:
                    if (!IncludeLowTempHeatPumps)
                    {
                        return(false);
                    }
                    break;

                case ApplianceTypes.SolarPanel:
                    if (!IncludeSolarPanels)
                    {
                        return(false);
                    }
                    break;

                case ApplianceTypes.TemperatureController:
                    if (!IncludeTemperatureControllers)
                    {
                        return(false);
                    }
                    break;

                case ApplianceTypes.SolarStation:
                    if (!IncludeSolarStations)
                    {
                        return(false);
                    }
                    break;

                case ApplianceTypes.WaterHeater:
                    if (!IncludeWaterHeaters)
                    {
                        return(false);
                    }
                    break;

                default:
                    return(false);
                }
            }

            // Filter based on FilterString
            return(obj.Name.ContainsIgnoreCase(FilterString) ||
                   obj.Description.ContainsIgnoreCase(FilterString) ||
                   ApplianceTypeConverter.ConvertTypeToString(obj.Type).ContainsIgnoreCase(FilterString));
        }