private int intParse(FuelTypes fuelChoices)
        {
            int integer;

            int.TryParse(fuelChoices.ToString(), out integer);
            return(integer);
        }
Ejemplo n.º 2
0
 public FuelSystemClass(int techLevel, double efficiency, string name, string description,
                        double maxCapacity, FuelTypes fuel)
     : base(techLevel, efficiency, name, description)
 {
     MaxCapacity = maxCapacity;
     Fuel        = fuel;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessAbridged" /> class.
        /// </summary>
        /// <param name="watts">A number for the process load power in Watts. (required).</param>
        /// <param name="schedule">Identifier of the schedule for the use of the process over the course of the year. The type of this schedule should be Fractional and the fractional values will get multiplied by the watts to yield a complete equipment profile. (required).</param>
        /// <param name="fuelType">Text to denote the type of fuel consumed by the process. Using the \&quot;None\&quot; type indicates that no end uses will be associated with the process, only the zone gains. (required).</param>
        /// <param name="endUseCategory">Text to indicate the end-use subcategory, which will identify the process load in the end use output. For example, “Cooking”, “Clothes Drying”, etc. A new meter for reporting is created for each unique subcategory. (default to &quot;Process&quot;).</param>
        /// <param name="radiantFraction">Number for the amount of long-wave radiation heat given off by the process load. Default value is 0. (default to 0D).</param>
        /// <param name="latentFraction">Number for the amount of latent heat given off by the process load. Default value is 0. (default to 0D).</param>
        /// <param name="lostFraction">Number for the amount of “lost” heat being given off by the process load. The default value is 0. (default to 0D).</param>
        /// <param name="identifier">Text string for a unique object ID. This identifier remains constant as the object is mutated, copied, and serialized to different formats (eg. dict, idf, osm). This identifier is also used to reference the object across a Model. It must be &lt; 100 characters, use only ASCII characters and exclude (, ; ! \\n \\t). (required).</param>
        /// <param name="displayName">Display name of the object with no character restrictions..</param>
        /// <param name="userData">Optional dictionary of user data associated with the object.All keys and values of this dictionary should be of a standard data type to ensure correct serialization of the object (eg. str, float, int, list)..</param>
        public ProcessAbridged
        (
            string identifier, double watts, string schedule, FuelTypes fuelType,                                                                                                         // Required parameters
            string displayName = default, Object userData = default, string endUseCategory = "Process", double radiantFraction = 0D, double latentFraction = 0D, double lostFraction = 0D // Optional parameters
        ) : base(identifier: identifier, displayName: displayName, userData: userData)                                                                                                    // BaseClass
        {
            this.Watts = watts;
            // to ensure "schedule" is required (not null)
            this.Schedule = schedule ?? throw new ArgumentNullException("schedule is a required property for ProcessAbridged and cannot be null");
            this.FuelType = fuelType;
            // use default value if no "endUseCategory" provided
            this.EndUseCategory  = endUseCategory ?? "Process";
            this.RadiantFraction = radiantFraction;
            this.LatentFraction  = latentFraction;
            this.LostFraction    = lostFraction;

            // Set non-required readonly properties with defaultValue
            this.Type = "ProcessAbridged";

            // check if object is valid, only check for inherited class
            if (this.GetType() == typeof(ProcessAbridged))
            {
                this.IsValid(throwException: true);
            }
        }
 public Car(Guid Id, string Name, bool IsElectric, FuelTypes FuelType)
 {
     _Id         = Id;
     _Name       = Name;
     _IsElectric = IsElectric;
     _FuelType   = FuelType;
 }
Ejemplo n.º 5
0
        public void AddFuel(float amount, FuelTypes type)
        {
            CurentFuelType = (int)CurentFuelType > (int)type ? type : CurentFuelType;

            CurentFuelValue += amount;

            CurentFuelValue = CurentFuelValue > _description.Capacity ? _description.Capacity : CurentFuelValue;
        }
Ejemplo n.º 6
0
 private void InitializeFuelTypes()
 {
     FuelTypes.CollectionChanged -= _CollectionChanged;
     FuelTypes.Clear();
     foreach (FuelType fuelType in context.FuelTypes)
     {
         FuelTypes.Add(fuelType);
     }
     FuelTypes.CollectionChanged += _CollectionChanged;
 }
Ejemplo n.º 7
0
        /**
         * Class constructor specifying name of make (manufacturer), model and year
         * of make.
         * @param manufacturer
         * @param model
         * @param makeYear
         */


        public Vehicle(int id, string manufacturer, string model, int makeYear, string rego, FuelTypes fuel, int tank)
        {
            Id                 = id;
            Manufacturer       = manufacturer;
            Model              = model;
            MakeYear           = makeYear;
            RegistrationNumber = rego;
            FuelChoices        = fuel;
            TankCapacity       = tank;
        }
Ejemplo n.º 8
0
        public async Task <DictionaryLimits> GetDictionaryLimits()
        {
            Answer           answer           = new Answer();
            List <Provider>  ProvidersList    = new List <Provider>();
            List <FuelTypes> FuelTypesList    = new List <FuelTypes>();
            DictionaryLimits dictionaryLimits = new DictionaryLimits();
            Dictionary <string, List <string> > ProvidersDictionary;
            Dictionary <string, List <string> > FuelTypesDictionary;

            try
            {
                answer = await networkservice.NetworkRequest(NetworkService.TaskType.DictionaryLimits, authmanager.GetAuthData(), null);

                if (answer != null && answer.ResData is JObject jData)
                {
                    dictionaryLimits = JsonConvert.DeserializeObject <DictionaryLimits>(jData.ToString());
                    if (jData.TryGetValue("providers", out JToken jToken))
                    {
                        ProvidersDictionary = JsonConvert.DeserializeObject <Dictionary <string, List <string> > >(jToken.ToString());
                        if (ProvidersDictionary != null && ProvidersDictionary.Count > 0)
                        {
                            foreach (KeyValuePair <string, List <string> > entry in ProvidersDictionary)
                            {
                                Provider provider = new Provider();
                                provider.Title         = entry.Key;
                                provider.ListProviders = entry.Value;
                                ProvidersList.Add(provider);
                            }
                        }
                    }
                    if (jData.TryGetValue("fuel_type", out JToken jTokenFuel))
                    {
                        FuelTypesDictionary = JsonConvert.DeserializeObject <Dictionary <string, List <string> > >(jTokenFuel.ToString());
                        if (FuelTypesDictionary != null && FuelTypesDictionary.Count > 0)
                        {
                            foreach (KeyValuePair <string, List <string> > entry in FuelTypesDictionary)
                            {
                                FuelTypes fuelType = new FuelTypes();
                                fuelType.Title         = entry.Key;
                                fuelType.ListFuelTypes = entry.Value;
                                FuelTypesList.Add(fuelType);
                            }
                        }
                    }

                    dictionaryLimits.ProvidersList = ProvidersList;
                    dictionaryLimits.FuelTypesList = FuelTypesList;
                }
            } catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
            }

            return(dictionaryLimits);
        }
Ejemplo n.º 9
0
 public Auto(string _brand, string _model, Colors _color, FuelTypes _fuel, uint _max_speed, double _horsepowers, double _engineCapacity)
 {
     this.Brand          = _brand;
     this.Model          = _model;
     this.Color          = _color;
     this.Vin            = Guid.NewGuid();
     this.Fuel           = _fuel;
     this.MaxSpeed       = _max_speed;
     this.Horsepowers    = _horsepowers;
     this.EngineCapacity = _engineCapacity;
 }
Ejemplo n.º 10
0
 public Car(
     string _brand,
     string _model,
     Colors _color,
     FuelTypes _fuel,
     uint _maxSpeed,
     double _horsepowers,
     double _engineCapacity,
     bool _hasRailsOnRoof)
     : base(_brand, _model, _color, _fuel, _maxSpeed, _horsepowers, _engineCapacity)
 {
     this.hasRailsOnRoof = _hasRailsOnRoof;
 }
Ejemplo n.º 11
0
 public Car(
     string _brand,
     string _model,
     Colors _color,
     FuelTypes _fuel,
     uint _max_speed,
     double _horsepowers,
     double _motor_capacity,
     Motor_brand _motor_brand)
     : base(_brand, _model, _color, _fuel, _max_speed, _horsepowers, _motor_capacity)
 {
     this.motor_brand = _motor_brand;
 }
Ejemplo n.º 12
0
 public Truck(
     string _brand,
     string _model,
     Colors _color,
     FuelTypes _fuel,
     uint _max_speed,
     double _horsepowers,
     double _motor_capacity,
     Transmission_brand transmission_brand)
     : base(_brand, _model, _color, _fuel, _max_speed, _horsepowers, _motor_capacity)
 {
     this.transmission_brand = transmission_brand;
 }
Ejemplo n.º 13
0
        private async Task LoadFuelTypesLookupAsync()
        {
            FuelTypes.Clear();
            FuelTypes.Add(new NullLookupItem {
                DisplayMember = "-"
            });
            var lookup = await this.fuelTypeLookupDataService.GetFuelTypeLookupAsync();

            foreach (var lookupItem in lookup)
            {
                FuelTypes.Add(lookupItem);
            }
        }
Ejemplo n.º 14
0
 public Truck(
     string _brand,
     string _model,
     Colors _color,
     FuelTypes _fuel,
     uint _maxSpeed,
     double _horsepowers,
     double _engineCapacity,
     TrailerWeightTypes _trailerWeightType)
     : base(_brand, _model, _color, _fuel, _maxSpeed, _horsepowers, _engineCapacity)
 {
     this.trailerWeightType = _trailerWeightType;
 }
 public SportCar(
     string _brand,
     string _model,
     Colors _color,
     FuelTypes _fuel,
     uint _maxSpeed,
     double _horsepowers,
     double _engineCapacity,
     ExhaustSystemsBrands _exhaustSystemBrand)
     : base(_brand, _model, _color, _fuel, _maxSpeed, _horsepowers, _engineCapacity)
 {
     this.exhaustSystemBrand = _exhaustSystemBrand;
 }
Ejemplo n.º 16
0
 public Car(
     string _brand,
     string _model,
     Colors _color,
     FuelTypes _fuel,
     uint _maxSpeed,
     double _horsepowers,
     double _engineCapacity,
     RoofTypes _roofType)
     : base(_brand, _model, _color, _fuel, _maxSpeed, _horsepowers, _engineCapacity)
 {
     this.roofType = _roofType;
 }
Ejemplo n.º 17
0
        public void Refueling(FuelTypes i_FuelType, float i_AddFuel)
        {
            float newFuelQuantity = m_CurrentFuelQuantity + i_AddFuel;

            if (m_FuelType == i_FuelType && newFuelQuantity <= m_MaximumFuelQuantity)
            {
                m_CurrentFuelQuantity = newFuelQuantity;
            }
            else
            {
                ValueOutOfRangeException value = new ValueOutOfRangeException(0, m_MaximumFuelQuantity);
                throw value;
            }
        }
Ejemplo n.º 18
0
        public void FuelingVehicle(string i_LicenseNumber, FuelTypes i_FuelType, float i_AddFuel)
        {
            string         licenseNumber;
            EnrgeyVehicles enrgey;

            foreach (VehiclesGarage vehiclesGarage in m_VehiclesGarage)
            {
                licenseNumber = vehiclesGarage.GetLicenseNumber();
                if (licenseNumber == i_LicenseNumber)
                {
                    enrgey = vehiclesGarage.GetEnrgeyType();
                    ((FuelVehicles)enrgey).Refueling(i_FuelType, i_AddFuel);
                    break;
                }
            }
        }
Ejemplo n.º 19
0
        public float GetFuel(float amount, out FuelTypes type)
        {
            type = CurentFuelType;

            if (CurentFuelValue > amount)
            {
                CurentFuelValue -= amount;

                return amount;
            }

            var valueToReturn = CurentFuelValue;

            CurentFuelValue = 0f;

            return valueToReturn;
        }
Ejemplo n.º 20
0
        public static double GetEceByFuelType(FuelTypes fuelType)
        {
            switch (fuelType)
            {
            case FuelTypes.Diesel:
            {
                return(eceForDiesel);
            }

            case FuelTypes.petrol:
            {
                return(eceForPetrol);
            }
            }

            return(0);
        }
Ejemplo n.º 21
0
        public float GetFuel(float amount, out FuelTypes type)
        {
            if (_descriptionIsNull)
            {
                type = FuelTypes.Empty;
                return(0f);
            }

            type = CurentFuelType;

            if (CurentFuelValue > amount)
            {
                CurentFuelValue -= amount;

                return(amount);
            }

            var valueToReturn = CurentFuelValue;

            CurentFuelValue = 0f;

            return(valueToReturn);
        }
Ejemplo n.º 22
0
 public OwnVehicle(uint model, Position position, Rotation rotation, FuelTypes fueltype = FuelTypes.None) : base(model, position, rotation)
 {
     FuelType            = fueltype;
     Fuel                = 0;
     ManualEngineControl = true;
 }
Ejemplo n.º 23
0
 public BenzinEngine(int enginePower, FuelTypes fuelType = FuelTypes.BenzinA95, string serialNumber = "0000000")
 {
     SerialNumber = serialNumber;
     FuelType     = fuelType;
     EnginePower  = enginePower;
 }
Ejemplo n.º 24
0
 public Sportcar(string _brand, string _model, Colors _color, FuelTypes _fuel, uint _max_speed, double _horsepowers, double _motor_capacity, bool _nytro)
     : base(_brand, _model, _color, _fuel, _max_speed, _horsepowers, _motor_capacity)
 {
     this.nytro = _nytro;
 }
Ejemplo n.º 25
0
        public static void AddVehicle(string manufacturer, string model, int makeYear, string rego, FuelTypes fuel, int tank)//id,make,model,year,rego,fueltype,tank
        {
            List <Vehicle> vehicleList = _vehicleList;
            var            id          = (vehicleList.Count > 0 ? vehicleList.Last().Id + 1 : 1);

            //var id = _vehicleList.Max(x => x.Id + 1);
            vehicleList.Add(new Vehicle(id, manufacturer, model, makeYear, rego, fuel, tank));
        }