Exemple #1
0
        /// <summary>
        /// returns a List of all transmission nodes in the metadataStructure
        /// </summary>
        /// <param name="metadatastrutcureId"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public IEnumerable <string> GetAllTransmissionInformationFromMetadataStructure(long metadataStructureId, TransmissionType type,
                                                                                       AttributeNames returnType = AttributeNames.value)
        {
            MetadataStructure metadataStructure = this.GetUnitOfWork().GetReadOnlyRepository <MetadataStructure>().Get(metadataStructureId);

            List <string> tmpList = new List <string>();

            try
            {
                XDocument xDoc = XmlUtility.ToXDocument((XmlDocument)metadataStructure.Extra);
                IEnumerable <XElement> temp = XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), AttributeNames.type.ToString(),
                                                                                 type.ToString(), xDoc);

                foreach (var element in temp)
                {
                    tmpList.Add(element.Attribute(returnType.ToString()).Value);
                }
            }
            catch (Exception)
            {
                return(new List <string>());
            }

            return(tmpList);
        }
Exemple #2
0
        public bool HasTransmission(long datasetid, TransmissionType type)
        {
            Dataset        dataset = this.GetUnitOfWork().GetReadOnlyRepository <Dataset>().Get(datasetid);
            DatasetManager dm      = new DatasetManager();

            try
            {
                DatasetVersion datasetVersion = dm.GetDatasetLatestVersion(dataset);

                // get MetadataStructure
                if (datasetVersion != null && datasetVersion.Dataset != null &&
                    datasetVersion.Dataset.MetadataStructure != null &&
                    datasetVersion.Dataset.MetadataStructure.Extra != null &&
                    datasetVersion.Metadata != null)
                {
                    MetadataStructure      metadataStructure = datasetVersion.Dataset.MetadataStructure;
                    XDocument              xDoc = XmlUtility.ToXDocument((XmlDocument)datasetVersion.Dataset.MetadataStructure.Extra);
                    IEnumerable <XElement> temp = XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), AttributeNames.type.ToString(),
                                                                                     type.ToString(), xDoc);

                    if (temp != null && temp.Any())
                    {
                        return(true);
                    }
                }
                return(false);
            }
            finally
            {
                dm.Dispose();
            }
        }
        public static string GetMappingFileName(long id, TransmissionType transmissionType, string name)
        {
            using (MetadataStructureManager msm = new MetadataStructureManager())
            {
                MetadataStructure metadataStructure = msm.Repo.Get(id);

                // get MetadataStructure
                XDocument xDoc = XmlUtility.ToXDocument((XmlDocument)metadataStructure.Extra);



                List <XElement> tmpList =
                    XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), new Dictionary <string, string>()
                {
                    { AttributeNames.name.ToString(), name },
                    { AttributeNames.type.ToString(), transmissionType.ToString() }
                }, xDoc).ToList();

                if (tmpList.Count >= 1)
                {
                    return(tmpList.FirstOrDefault().Attribute("value").Value.ToString());
                }

                return(null);
            }
        }
Exemple #4
0
        public string GetTransmissionInformation(long datasetVersionId, TransmissionType type, string name,
                                                 AttributeNames returnType = AttributeNames.value)
        {
            DatasetVersion    datasetVersion    = this.GetUnitOfWork().GetReadOnlyRepository <DatasetVersion>().Get(datasetVersionId);
            Dataset           dataset           = this.GetUnitOfWork().GetReadOnlyRepository <Dataset>().Get(datasetVersion.Dataset.Id);
            MetadataStructure metadataStructure = this.GetUnitOfWork().GetReadOnlyRepository <MetadataStructure>().Get(dataset.MetadataStructure.Id);

            // get MetadataStructure
            if (datasetVersion != null && dataset != null &&
                metadataStructure != null && datasetVersion.Metadata != null && metadataStructure.Extra != null)
            {
                XDocument xDoc = XmlUtility.ToXDocument((XmlDocument)datasetVersion.Dataset.MetadataStructure.Extra);

                Dictionary <string, string> queryDic = new Dictionary <string, string>();
                queryDic.Add(AttributeNames.name.ToString(), name);
                queryDic.Add(AttributeNames.type.ToString(), type.ToString());

                IEnumerable <XElement> temp = XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), queryDic, xDoc);

                string value = temp?.First().Attribute(returnType.ToString()).Value;

                return(value);
            }
            return(string.Empty);
        }
 private void TransmissionAcquired(TransmissionType type)
 {
     gun.SetActive(true);
     isWeaponAcquired         = true;
     transmissionDict[type]   = true;
     selectedTransmissionType = type;
     ChangeGunColor();
     Debug.Log("Transmission " + type + " " + transmissionDict[type]);
     weaponType.text = type.ToString();
 }
Exemple #6
0
        public static string GetName(this TransmissionType transmission)
        {
            switch (transmission)
            {
            case TransmissionType.AutomatedManual:
                return("Automated Manual");

            case TransmissionType.ContinuouslyVariable:
                return("Continuously Variable");

            default:
                return(transmission.ToString());
            }
        }
Exemple #7
0
        public List <string> GetAttributeList()
        {
            bool _GPS     = true;
            bool _sunRoof = true;
            //Create new list of vehicle attributes
            List <string> VehicleAttributes = new List <string>();

            string regoAttr         = _vehicleRego.ToString();
            string makeAttr         = _make.ToString();
            string modelAttr        = _model.ToString();
            string yearAttr         = _year.ToString();
            string vehicleClassAttr = _vehicleClass.ToString();
            string numSeatsAttr     = _numSeats.ToString() + "-Seater";
            string transmissionAttr = _transmissionType.ToString();
            string fuelAttr         = _fuelType.ToString();
            string gpsAttr          = "GPS";
            string sunroofAttr      = "Sunroof";
            string dailyRateAttr    = _dailyRate.ToString();
            string colourAttr       = _colour.ToString();

            //Add strings to list
            VehicleAttributes.Add(regoAttr);
            VehicleAttributes.Add(makeAttr);
            VehicleAttributes.Add(modelAttr);
            VehicleAttributes.Add(yearAttr);
            VehicleAttributes.Add(vehicleClassAttr);
            VehicleAttributes.Add(numSeatsAttr);
            VehicleAttributes.Add(transmissionAttr);
            VehicleAttributes.Add(fuelAttr);
            VehicleAttributes.Add(dailyRateAttr);
            VehicleAttributes.Add(colourAttr);

            //Only Add GPS and Sunroof if true
            if (_GPSat)
            {
                VehicleAttributes.Add(gpsAttr);
            }
            if (_sunRoofat)
            {
                VehicleAttributes.Add(sunroofAttr);
            }

            for (int i = 0; i < VehicleAttributes.Count; i++)
            {
                Console.WriteLine(VehicleAttributes[i]);
            }
            return(VehicleAttributes);
        }
Exemple #8
0
        public bool HasMetadataStructureTransmission(long metadataStructureId, TransmissionType type)
        {
            MetadataStructure metadataStructure = this.GetUnitOfWork().GetReadOnlyRepository <MetadataStructure>().Get(metadataStructureId);

            // get MetadataStructure
            if (metadataStructure != null && metadataStructure.Extra != null)
            {
                XDocument xDoc = XmlUtility.ToXDocument((XmlDocument)metadataStructure.Extra);
                IEnumerable <XElement> temp = XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), AttributeNames.type.ToString(),
                                                                                 type.ToString(), xDoc);

                if (temp != null && temp.Any())
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #9
0
        public string ToCSVString()
        {
            paramters.Add(vehicleRego);
            paramters.Add(make);
            paramters.Add(model);
            paramters.Add(year.ToString());
            paramters.Add(vehicleClass.ToString());
            paramters.Add(numSeats.ToString());
            paramters.Add(transmission.ToString());
            paramters.Add(fuelType.ToString());
            paramters.Add(GPS.ToString());
            paramters.Add(sunRoof.ToString());
            paramters.Add(colour);
            paramters.Add(dailyRate.ToString());
            string CSV = String.Join(",", paramters);

            return(CSV);
        }
        public static string GetMappingFileName(long id, TransmissionType transmissionType, string name)
        {
            MetadataStructureManager msm = new MetadataStructureManager();
            MetadataStructure metadataStructure = msm.Repo.Get(id);

            // get MetadataStructure
            XDocument xDoc = XmlUtility.ToXDocument((XmlDocument)metadataStructure.Extra);

            List<XElement> tmpList =
                XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), new Dictionary<string, string>()
                {
                    {AttributeNames.name.ToString(), name},
                    {AttributeNames.type.ToString(), transmissionType.ToString()}

                }, xDoc).ToList();

            if (tmpList.Count >= 1)
            {
                return tmpList.FirstOrDefault().Attribute("value").Value.ToString();
            }

            return null;
        }
Exemple #11
0
 public override string ToString()
 {
     return("\nEconomy Class Car Details:" +
            "\nVehicle Rego: " + vehicleRego.ToString() + "\nVehicle Class: " + vehicleClass.ToString()
            + "\nMake: " + make.ToString() + "\nModel: " + model.ToString() + "\nYear: " + year.ToString()
            + "\nNumber of seats: " + numSeats.ToString() + "\nTransmission Type: " + transmissionType.ToString()
            + "\nFuel Type: " + fuelType.ToString() + "\nGPS: " + gps.ToString() + "\nsunRoof: " + sunRoof.ToString()
            + "\nDaily Rate: " + dailyRate.ToString("C2") + "\nColour: " + colour.ToString() + "\n\n");
 }
Exemple #12
0
 //Coverts a vehicle into a string which each attribute separated by a space
 public override string ToString()
 {
     return(vehicleRego + " " + make + " " + model + " " + year.ToString() + " " + vehicleClass.ToString() +
            " " + numSeats.ToString() + " " + transmission.ToString() + " " + fuel.ToString() + " " +
            GPS.ToString() + " " + sunRoof.ToString() + " " + colour + " " + dailyRate.ToString());
 }
    private void ChangeTransmission()
    {
        if (Input.GetAxis("Mouse ScrollWheel") > 0 && isWeaponAcquired)
        {
            if ((int)selectedTransmissionType < transmissionTypes.Length - 1)
            {
                for (int i = (int)selectedTransmissionType + 1; i <= transmissionTypes.Length - 1; i++)
                {
                    TransmissionType type = (TransmissionType)transmissionTypes.GetValue(i);
                    Debug.Log(type + " " + transmissionDict[type]);

                    if (transmissionDict[type] == true)
                    {
                        selectedTransmissionType = type;
                        weaponType.text          = type.ToString();
                        ChangeGunColor();
                        break;
                    }
                    else
                    {
                        if (i >= transmissionDict.Count - 1)
                        {
                            for (int j = 1; j < transmissionTypes.Length - 1; j++)
                            {
                                TransmissionType type2 = (TransmissionType)transmissionTypes.GetValue(j);
                                if (transmissionDict[type2] == true)
                                {
                                    selectedTransmissionType = type2;
                                    weaponType.text          = type2.ToString();
                                    ChangeGunColor();
                                    break;
                                }
                                else
                                {
                                    selectedTransmissionType++;
                                }
                            }
                        }
                        else
                        {
                            selectedTransmissionType++;
                        }
                    }
                }
            }
            else
            {
                for (int j = 1; j < transmissionTypes.Length - 1; j++)
                {
                    TransmissionType type2 = (TransmissionType)transmissionTypes.GetValue(j);
                    if (transmissionDict[type2] == true)
                    {
                        selectedTransmissionType = type2;
                        weaponType.text          = type2.ToString();
                        ChangeGunColor();
                        break;
                    }
                    else
                    {
                        selectedTransmissionType++;
                    }
                }
            }
        }
        else if (Input.GetAxis("Mouse ScrollWheel") < 0 && isWeaponAcquired)
        {
            if ((int)selectedTransmissionType > 1)
            {
                for (int i = (int)selectedTransmissionType - 1; i >= 1; i--)
                {
                    TransmissionType type = (TransmissionType)transmissionTypes.GetValue(i);
                    Debug.Log(type + " " + transmissionDict[type]);

                    if (transmissionDict[type] == true)
                    {
                        selectedTransmissionType = type;
                        weaponType.text          = type.ToString();
                        ChangeGunColor();
                        break;
                    }
                    else
                    {
                        if (i <= 1)
                        {
                            for (int j = transmissionTypes.Length - 1; j > 0; j--)
                            {
                                TransmissionType type2 = (TransmissionType)transmissionTypes.GetValue(j);
                                if (transmissionDict[type2] == true)
                                {
                                    selectedTransmissionType = type2;
                                    weaponType.text          = type2.ToString();
                                    ChangeGunColor();
                                    break;
                                }
                                else
                                {
                                    selectedTransmissionType--;
                                }
                            }
                        }
                        else
                        {
                            selectedTransmissionType--;
                        }
                    }
                }
            }
            else
            {
                selectedTransmissionType = (TransmissionType)transmissionTypes.Length - 1;

                for (int j = transmissionTypes.Length - 1; j < 0; j--)
                {
                    TransmissionType type2 = (TransmissionType)transmissionTypes.GetValue(j);
                    if (transmissionDict[type2] == true)
                    {
                        selectedTransmissionType = type2;
                        weaponType.text          = type2.ToString();
                        ChangeGunColor();
                        break;
                    }
                    else
                    {
                        selectedTransmissionType--;
                    }
                }
            }
        }
    }