public void ExecuteThisCommand(string[] commandParameters)
        {
            coreValidator.ExactParameterLength(commandParameters, 4);

            var clientUniqueName    = commandParameters[1];
            var clientAddress       = commandParameters[2];
            var clientUniquieNumber = commandParameters[3];

            coreValidator.CounterpartyAlreadyRegistered(this.database.Clients, clientUniqueName, "client");

            var client = (IClient)autoServiceFactory.CreateClient(clientUniqueName, clientAddress, clientUniquieNumber, modelValidator);

            IVehicle vehicle = autoServiceFactory.CreateVehicle("default", "default", "AA0000AA", "2000", Models.Vehicles.Enums.EngineType.Petrol, 5, modelValidator);

            this.coreValidator.CheckNullObject(vehicle);

            //add Vehicle to Client's vehicles
            client.Vehicles.Add(vehicle);

            //add Client to database
            database.Clients.Add(client);

            writer.Write(client.ToString());
            writer.Write($"Client {clientUniqueName} added successfully with unique number {clientUniquieNumber}");
            writer.Write($"Default Vehicle added to client {client.Name}");
        }
Пример #2
0
        //Methods
        public void ExecuteThisCommand(string[] commandParameters)
        {
            coreValidator.ExactParameterLength(commandParameters, 3);

            var clientUniqueName = commandParameters[1];

            coreValidator.CounterpartyNotRegistered(database.Clients, clientUniqueName, "client");
            var clientNewUniqueName = commandParameters[2];
            var client = database.Clients.FirstOrDefault(x => x.Name == clientUniqueName);

            client.Name = clientNewUniqueName;
            writer.Write($"Client{clientUniqueName} name changed sucessfully to {clientNewUniqueName}");
        }
Пример #3
0
        public void ExecuteThisCommand(string[] commandParameters)
        {
            coreValidator.ExactParameterLength(commandParameters, 3);

            this.coreValidator.EmployeeCount(database.Employees.Count);

            var employeeId = this.coreValidator.IntFromString(commandParameters[1], "employeeId");

            var employee = this.coreValidator.EmployeeById(database.Employees, employeeId);

            employee.RatePerMinute = this.coreValidator.DecimalFromString(commandParameters[2], "ratePerMinute");

            writer.Write($"Rate per minute of employee {employee.FirstName} {employee.LastName} was successfully set to {employee.RatePerMinute} $");
        }