Exemple #1
0
        internal StringBuilder GetDetails()
        {
            StringBuilder toDisplay = new StringBuilder();

            foreach (FieldInfo field in GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic))
            {
                string memberName = field.Name;
                memberName = GarageData.FixNameToPrint(memberName.ToString());
                toDisplay.Append("\r\n " + memberName + " = " + field.GetValue(this));
            }

            return(toDisplay);
        }
Exemple #2
0
        public string GetListLicensePlateByStatus(VehicleInfo.eVehicleStatus i_EVehicleStatus)
        {
            string listByStatus = null;
            int    countVehicle = 0;

            foreach (VehicleInfo currVale in r_VehicleList.Values)
            {
                if (currVale.Status.Equals(i_EVehicleStatus))
                {
                    if (countVehicle == 0)
                    {
                        string fixName = GarageData.FixNameToPrint(i_EVehicleStatus.ToString());
                        listByStatus += string.Format("{0} Vehicles List: \n", fixName);
                    }
                    countVehicle++;
                    listByStatus += string.Format("{0}. {1}\n", countVehicle, currVale.Vehicle.LicensePlate);
                }
            }


            return(listByStatus);
        }
Exemple #3
0
        internal StringBuilder GetDetails()
        {
            StringBuilder toDisplay   = new StringBuilder();
            Type          vehicleType = GetType();

            foreach (FieldInfo f in typeof(Vehicle).GetFields(BindingFlags.Instance | BindingFlags.NonPublic))
            {
                if (f.FieldType == typeof(Engine))
                {
                    toDisplay.Append(m_Engine.GetDetails());
                }
                else if (f.FieldType == r_WheelsList.GetType())
                {
                    toDisplay.Append("\r\nWheels Information:");
                    int wheelNum = 1;

                    foreach (Wheel wheel in r_WheelsList)
                    {
                        toDisplay.Append("\r\nWheel " + wheelNum + " :");
                        toDisplay.Append(wheel.GetDetails());
                        wheelNum++;
                    }
                }
                else
                {
                    string memberName = GarageData.FixNameToPrint(f.ToString());
                    toDisplay.Append("\r\n " + memberName + " = " + f.GetValue(this));
                }
            }

            foreach (FieldInfo f in vehicleType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic))
            {
                string memberName = GarageData.FixNameToPrint(f.ToString());
                toDisplay.Append("\r\n " + memberName + " = " + f.GetValue(this));
            }

            return(toDisplay);
        }