Exemplo n.º 1
0
        public void ChangeCustomerStatus(string i_CarLicence, eVehicleStatus i_NewStatus)
        {
            VehicleInside vehicleToUpdate;

            if (!m_Customers.TryGetValue(i_CarLicence, out vehicleToUpdate))
            {
                throw new ArgumentException("Vehicle doesn't exsists");
            }
            else
            {
                if (i_NewStatus != vehicleToUpdate.VehicleStatus)
                {
                    vehicleToUpdate.VehicleStatus = i_NewStatus;
                }
                else
                {
                    string VehicleName = vehicleToUpdate.Vehicle.GetType().Name;
                    throw new ArgumentException(
                              string.Format(
                                  "The {0}'s status is already {1}.",
                                  VehicleName,
                                  i_NewStatus.ToString()));
                }
            }
        }
Exemplo n.º 2
0
        public virtual Dictionary <string, string> GetDetails()
        {
            Dictionary <string, string> vehicleDetails = new Dictionary <string, string>();

            vehicleDetails.Add("Owner name", OwnerInfo.OwnerOfVehicleName);
            vehicleDetails.Add("Owner phone number", OwnerInfo.OwnerPhoneNumber);
            vehicleDetails.Add("License number", m_LicenseNumber);
            vehicleDetails.Add("Model name", m_ModelName);
            FuelEngine thisFuelEngine = m_VehicleEngine as FuelEngine;

            if (thisFuelEngine != null)
            {
                vehicleDetails.Add("Engine type", "Fuel engine");
                vehicleDetails.Add("Fuel capacity", m_VehicleEngine.MaxEnergyCapacity.ToString("F"));
                vehicleDetails.Add("Current amount of fuel", m_VehicleEngine.CurrentEnergyCapacity.ToString("F"));
                vehicleDetails.Add("Fuel type", thisFuelEngine.GasType.ToString());
            }
            else
            {
                vehicleDetails.Add("Engine type", "Electric engine");
                vehicleDetails.Add("Battery capacity", m_VehicleEngine.MaxEnergyCapacity.ToString("F"));
                vehicleDetails.Add("Current amount of battery", m_VehicleEngine.CurrentEnergyCapacity.ToString("F"));
            }

            vehicleDetails.Add("Vehicle status", m_VehicleStatus.ToString());
            vehicleDetails.Add("Wheels manufacturer", m_WheelsList[0].ManufacturerName);
            vehicleDetails.Add("Number of Wheels", m_WheelsList.Count.ToString());
            vehicleDetails.Add("Maximum PSI", m_WheelsList[0].MaximalPsi.ToString("F"));
            vehicleDetails.Add("Current PSI", m_WheelsList[0].CurrentPsi.ToString("F"));

            return(vehicleDetails);
        }
Exemplo n.º 3
0
 public void GetDetailesOwner(List <string> io_listOfDetailes) // this function add the Owner detailes to the list
 {
     io_listOfDetailes.Add(string.Format("Name:{0}", m_ownerName));
     io_listOfDetailes.Add(string.Format("phone:{0}", m_ownerPhoneNumber));
     io_listOfDetailes.Add(string.Format("Current Vehicle Status:{0}", m_currentVehicleStatus.ToString()));
     m_ownerVehicle.GetDetailesOwnerVehicle(io_listOfDetailes);
 }
Exemplo n.º 4
0
        public static void Main()
        {
            string         i_VehicleStatus           = "Dont";
            eVehicleStatus vehicleStatusParsedToEnum = (eVehicleStatus)Enum.Parse(typeof(eVehicleStatus), i_VehicleStatus);

            Console.WriteLine(vehicleStatusParsedToEnum.ToString());
        }
Exemplo n.º 5
0
 public override string ToString()
 {
     return(string.Format(
                "Owner Name: {0}\nOwner phone: {1}\nStatus: {2}\n{3}",
                m_OwnerName,
                m_OwnerPhone,
                m_Status.ToString(),
                m_Vehicle.ToString()));
 }
Exemplo n.º 6
0
        public override string ToString()
        {
            StringBuilder recordDescription = new StringBuilder();

            recordDescription.AppendLine("--Garage Customer Report--");
            recordDescription.AppendFormat("Owner name:         {0} {1}", m_OwnerName, Environment.NewLine);
            recordDescription.AppendFormat("Owner phone number: {0} {1}", m_OwnerPhoneNumber, Environment.NewLine);
            recordDescription.AppendFormat("Vehicle status:     {0} {1}", m_VehicleStatus.ToString(), Environment.NewLine);
            return(recordDescription + m_Vehicle.ToString());
        }
Exemplo n.º 7
0
 public override string ToString()
 {
     return(string.Format(
                "Owner name: {0}, Owner phone number: {1}, Vehicle status: {2}.{3}{4}",
                m_OwnerName,
                m_OwnerPhoneNumber,
                m_VehicleStatus.ToString(),
                Environment.NewLine,
                m_OwnerVehicle.ToString()));
 }
Exemplo n.º 8
0
        public string VehicleInTheGarageInfo()
        {
            string allInfo;
            string ownerNameInfo    = "Owner Name: " + r_OwnerName.ToString();
            string ownerPhoneNumber = "Owner Phone Number:  " + r_OwnerPhoneNumber.ToString();
            string garageStatusInfo = "Garage Status: " + m_VehicleStatusInTheGarage.ToString();

            allInfo = string.Format("{0}\n{1}\n{2},{3}\n", ownerNameInfo, ownerPhoneNumber, garageStatusInfo, m_Vehicle.VehicleInfo());
            return(allInfo);
        }
Exemplo n.º 9
0
        public string GetFolderDetails()
        {
            StringBuilder folderDetails = new StringBuilder();

            folderDetails.AppendFormat("Vehicle type: {0}{1}", m_Vehicle.GetType().Name, Environment.NewLine);
            folderDetails.AppendFormat("Owner name: {0}{1}", m_VehicleOwnerName, Environment.NewLine);
            folderDetails.AppendFormat("Owner phone number: {0}{1}", m_PhoneNumber.ToString(), Environment.NewLine);
            folderDetails.AppendFormat("Vehicle status: {0}{1}", m_VehicleStatus.ToString(), Environment.NewLine);
            folderDetails.AppendFormat("{0}", m_Vehicle.GetDetails());

            return(folderDetails.ToString());
        }
        public override string ToString()
        {
            StringBuilder infoAsString = new StringBuilder();

            infoAsString.AppendFormat("License number: {0}", m_Vechile.LicenseNumber);
            infoAsString.AppendFormat(", car model: {0} ", m_Vechile.Model);
            infoAsString.AppendFormat(", owner: {0} ", m_Owner.Name);
            infoAsString.AppendFormat(", car status: {0}", m_Status.ToString());
            infoAsString.AppendFormat(", wheels status: {0} ", m_Vechile.GetWheelsInfo());
            /// & more...
            return(infoAsString.ToString());
        }
Exemplo n.º 11
0
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat(
                @"Owner name {0}: 
Owner phone {1}:
Vehicle status {2}: 
{3}:", m_OwnerName, m_OwnerPhone, m_VehicleStatus.ToString(), r_Vehicle.ToString());

            return(stringBuilder.ToString());
        }
Exemplo n.º 12
0
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat(
                @"Owner name : {0} 
Owner phone : {1}
Vehicle status : {2} 
{3}", m_OwnerName, m_OwnerPhone, m_VehicleStatus.ToString(), r_Vehicle.ToString());

            return(stringBuilder.ToString());
        }
Exemplo n.º 13
0
        public override string ToString()
        {
            string strStatus = string.Concat(m_Status.ToString().Select(x => Char.IsUpper(x) ? " " + x : x.ToString())).TrimStart(' ');

            StringBuilder strVehicleInfo = new StringBuilder();

            strVehicleInfo.AppendFormat("Owner Name: {0}", m_VehicleOwnerName).AppendLine();
            strVehicleInfo.AppendFormat("Owner Phone Number: {0}", m_VehicleOwnerPhoneNumber).AppendLine();
            strVehicleInfo.AppendFormat("Vehicle Status: {0}", strStatus).AppendLine();
            strVehicleInfo.AppendFormat(m_Vehicle.ToString()).AppendLine();

            return(strVehicleInfo.ToString());
        }
Exemplo n.º 14
0
            public static string GetStatusStr(eVehicleStatus i_StatusToPrint)
            {
                string statusStrToReturn;

                if (i_StatusToPrint == eVehicleStatus.InRepair)
                {
                    statusStrToReturn = "In Repair";
                }
                else
                {
                    statusStrToReturn = i_StatusToPrint.ToString();
                }

                return(statusStrToReturn);
            }
Exemplo n.º 15
0
     public override string ToString()
     {
         return(string.Format(
                    @"    
 License Number: {0}
 Owner Name: {1}
 Vehicle Owner Phone: {2}
 Status in the Grage: {3}
 {4}",
                    m_Vehicle.LicenseNumber,
                    m_VehicleOwner,
                    m_VehicleOwnerPhone,
                    m_VehicleStatus.ToString(),
                    m_Vehicle.ToString()));
     }
        public override string ToString()
        {
            string stringOfVehicleCard;

            stringOfVehicleCard = m_VehicleInGarage.ToString() + "\nStatus in garage: ";
            if (m_VehicleStatus == eVehicleStatus.InFixingProccess)
            {
                stringOfVehicleCard += "In fixing proccess";
            }
            else
            {
                stringOfVehicleCard += m_VehicleStatus.ToString();
            }

            return(stringOfVehicleCard);
        }
Exemplo n.º 17
0
        public override string ToString()
        {
            return(string.Format(
                       @"License number: {0}
Model name: {1}
Owner name: {2}
Vehicle status: {3}{4}
{5}
{6}
",
                       r_LicenseNumber,
                       r_ModelName,
                       r_RegistrationDetails.OwnerName,
                       m_VehicleStatus.ToString(),
                       Printwheels(),
                       ResourceInformationString(),
                       UniquePropertiesString()));
        }
        public override string ToString()
        {
            string message;

            message = string.Format("Owner name: {0}" + Environment.NewLine + "Owner phone number: {1}" + Environment.NewLine + "vehicle status: {2}" + Environment.NewLine + "{3}", m_OwnerName, m_OwnerPhoneNumber, m_VehicleStatus.ToString(), m_NewVehicle.ToString());

            return(message.ToString());
        }
Exemplo n.º 19
0
        private void showVehicleInGarageByStatus()
        {
            StringBuilder listToPrint = new StringBuilder();

            try
            {
                int            status = getRequestedStatus();
                List <string>  filteredVehicleList = m_GarageManager.GetVehiclesInGarageByStatus(status);
                eVehicleStatus vehicleStatus       = m_GarageManager.CheckIfValidStatusParam(status);

                if (filteredVehicleList.Count != 0)
                {
                    listToPrint.AppendLine(string.Format("Vehicles' License number with status {0}", vehicleStatus.ToString()));
                    foreach (string vehicleLicenseNum in filteredVehicleList)
                    {
                        listToPrint.AppendLine(vehicleLicenseNum);
                    }
                }
                else
                {
                    listToPrint.AppendLine(string.Format("There are no vehicle with status {0} in the garage.", vehicleStatus.ToString()));
                }

                Console.WriteLine(listToPrint);
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(string.Format("{0}, Please Try Again.", ae.Message));
                showVehicleInGarageByStatus();
            }
        }
Exemplo n.º 20
0
        public override string ToString()
        {
            string infoOnCarInGarage = string.Format("\n\nOwner Information:\n------------------\nName: {0}\nPhone number: {1}\n\nVehicle information:\n------------------\nVehicle garage repair status: {2}\n{3}\n", m_OwnerName, m_OwnerPhoneNum, m_VehicleStatus.ToString(), m_Vechile.ToString());

            return(infoOnCarInGarage);
        }