Exemplo n.º 1
0
        public List <Compensation> GetCompensations()
        {
            List <Compensation> compensations = new List <Compensation>();

            foreach (Travel travel in Travel.GetTravelByEmployee(this))
            {
                compensations.Add(travel);
            }

            foreach (Driving driving in Driving.GetDrivingByEmployee(this))
            {
                compensations.Add(driving);
            }

            return(compensations);
        }
Exemplo n.º 2
0
        public bool Activate(SmartMenu smartMenu)
        {
            string  title               = Request.String("Kørsels godtgørelse titel");
            string  numberPlate         = Request.String("Nummerplade");
            Driving drivingCompensation = new Driving(title, accessPoint.Employee, numberPlate);

            SmartMenu sm = new SmartMenu(drivingCompensation.Title, "Anullér");

            sm.Attach(new AddTrip(drivingCompensation));

            sm.Attach(new AddCompensationToDepartment(accessPoint.Department, drivingCompensation));

            sm.Activate();

            return(false);
        }
Exemplo n.º 3
0
 private void Start()
 {
     driving = GetComponent <Driving>();
     if (driving.frontWheels[0] != null)
     {
         LeftWheel = driving.frontWheels[0].wheelScript.rb;
     }
     if (driving.frontWheels.Length > 1)
     {
         if (driving.frontWheels[1] != null)
         {
             RightWheel = driving.frontWheels[1].wheelScript.rb;
         }
     }
     axleWidth = CalcAxleWidth();
     wheelBase = CalcWheelBase();
     SetTurningAngles(turningRadius);
 }
Exemplo n.º 4
0
 public IActionResult Stop()
 {
     Driving.Stop();
     return(new AcceptedResult());
 }
Exemplo n.º 5
0
 public IActionResult Reverse([FromBody] int speed = 10)
 {
     Driving.Reverse(speed);
     return(new AcceptedResult());
 }
Exemplo n.º 6
0
 public IActionResult Left([FromBody] int speed = 10)
 {
     Driving.Left(speed);
     return(new AcceptedResult());
 }
Exemplo n.º 7
0
 public IActionResult Forward([FromBody] int speed = 10)
 {
     Driving.Forward(speed);
     return(new AcceptedResult());
 }
Exemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     driving  = GetComponent <Driving>();
     steering = GetComponent <Steering>();
 }
        public List<Driving> ReadDrivings()
        {
            LocationRepository locationRepository = new LocationRepository();
            UserRepository userRepository = new UserRepository();
            DriverRepository driverRepository = new DriverRepository();
            CommentRepository commentRepository = new CommentRepository();
            if (System.IO.File.Exists(@"C:\Users\Djole\Documents\Visual Studio 2017\Projects\TaxiSluzba_backend\TaxiSluzba_backend\Files\Drivings.txt"))
                {
                string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Djole\Documents\Visual Studio 2017\Projects\TaxiSluzba_backend\TaxiSluzba_backend\Files\Drivings.txt");
                List<Driving> drivings = new List<Driving>();
                foreach (string line in lines)
                {
                    string[] userString = line.Split('|');
                    if (userString.Count() != 11)
                        return null;
                    string[] dateSplit = userString[1].Split(';');
                    Location location = null;
                    Location destination = null;
                    foreach (Location l in locationRepository.ReadLocations())
                    {
                        if (userString[2] != "")
                        {
                            if (l.Id == Int32.Parse(userString[2]))
                            {
                                location = l;
                                continue;
                            }
                        }
                        if (userString[5] != "")
                        {
                            if (l.Id == Int32.Parse(userString[5]))
                            {
                                destination = l;
                            }
                        }
                    }
                    
                    Vehicle vehicle = new Vehicle();

                    User dispatcher = new User();
                    User customer = new User();
                    List<User> listUsers = userRepository.ReadUsers();
                    if (listUsers != null)
                    {

                        foreach (User u in listUsers)
                        {
                            if (userString[4] != "")
                            {
                                if (u.ID == Int32.Parse(userString[4]))
                                {
                                    dispatcher = u;
                                    continue;
                                }
                            }
                            if (userString[6] != "")
                            {
                                if (u.ID == Int32.Parse(userString[6]))
                                {
                                    customer = u;
                                }
                            }
                        }
                    }

                    Driver driver = new Driver();
                    List<Driver> listDrivers = driverRepository.ReadDrivers();
                    if (listDrivers != null && userString[7]!="")
                    {
                        foreach (Driver d in listDrivers)
                        {
                            if (d.ID == Int32.Parse(userString[7]))
                            {
                                driver = d;
                                break;
                            }
                        }
                    }

                    Comment comment = new Comment();
                    List<Comment> comments = commentRepository.ReadComments();
                    if (comments != null && userString[9]!="")
                    {
                        foreach (Comment c in comments)
                        {
                            if (c.Id == Int32.Parse(userString[9]))
                            {
                                comment = c;
                                break;
                            }
                        }
                    }
                    DrivingStatus drivingStatus = (DrivingStatus)Enum.Parse(typeof(DrivingStatus), userString[10]);
                    DateTime Date = new DateTime(Int32.Parse(dateSplit[0]), Int32.Parse(dateSplit[1]), Int32.Parse(dateSplit[2]));
                    Driving driving = new Driving(Int32.Parse(userString[0]), Date, location, vehicle,
                    dispatcher, destination, customer, driver, Double.Parse(userString[8]), comment, drivingStatus);
                    drivings.Add(driving);
                }
                return drivings;
            }
            return null;
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            Console.WriteLine(defineRoomText);

            var roomsize = Console.ReadLine();

            Room room = new Room();

            bool validatorRoom = room.CheckValidAxis(roomsize);

            while (validatorRoom == false)
            {
                Console.WriteLine("Something went wrong. Try again. Example input: 8 6");

                var newTry = Console.ReadLine();

                validatorRoom = room.CheckValidAxis(newTry);
            }

            Console.WriteLine("You have entered a room with the size " + room.XAxis + " " + room.YAxis + ". Please type the starting position of the car with integers, as well " +
                              "as the direction it will be facing with a N (north), S (south), W (west), or E (east) all separated with spaces. For example: 2 3 N");

            var carPosition = Console.ReadLine();

            //Assumption here that if implementing new models (i.e off-road) there should be a prompt asking which model the user wants to use. However, it feels fine for now to just
            //go straight for the monster truck
            MonsterTruck mTruck = new MonsterTruck();

            bool validatorCar = mTruck.CheckValidPosition(carPosition, room);

            while (validatorCar == false)
            {
                Console.WriteLine("Something went wrong. Try again. Example input: 2 3 N");

                var newTry = Console.ReadLine();

                validatorCar = mTruck.CheckValidPosition(newTry, room);
            }

            Console.WriteLine("Your car is positioned " + mTruck.XPosition + " " + mTruck.YPosition + " facing " + mTruck.Direction + ". " +
                              "Use commands in series to drive. F goes forward. L turns 90 degrees left. R turns 90 degrees right. B goes back without turning. Example input: FFFRFFLBB");

            var driveCommand = Console.ReadLine();

            Driving driving = new Driving();

            var validResult = driving.ValidDriving(driveCommand, mTruck);

            while (validResult == false)
            {
                Console.WriteLine("Try again. The only acceptable commands are F L R B");

                var newTry = Console.ReadLine();

                validResult = driving.ValidDriving(newTry, mTruck);
            }

            var drivingResult = driving.DrivingCar(mTruck, room);

            if (drivingResult)
            {
                Console.WriteLine("Simulation successful. Position: " + mTruck.XPosition + " " + mTruck.YPosition + " facing " + mTruck.Direction);
            }
            else
            {
                Console.WriteLine("Simulation failed. Car crashed at " + mTruck.XPosition + " " + mTruck.YPosition + " facing " + mTruck.Direction);
            }

            Console.ReadKey();
        }
Exemplo n.º 11
0
 private void Start()
 {
     rb      = GetComponent <Rigidbody>();
     driving = GetComponent <Driving>();
 }
Exemplo n.º 12
0
 void Start()
 {
     driving   = GameObject.FindGameObjectWithTag("Car").GetComponent <Driving>();
     timeCount = GameObject.Find("Canvas/TimeCount").GetComponent <Text>();
     StartCoroutine("Count");
 }
Exemplo n.º 13
0
 public AddTrip(Driving drivingCompensation)
 {
     DrivingCompensation = drivingCompensation;
 }
Exemplo n.º 14
0
 // Start is called before the first frame update
 void Awake()
 {
     controller = GameObject.Find("GameControllerObject").GetComponent <GameController>();
     inventory  = controller.GetComponent <InventoryMaster>();
     car        = controller.GetCar().GetComponent <Driving>();
 }
Exemplo n.º 15
0
 public Trip(string title, string departureDestination, DateTime departureDate, string arrivalDestination, DateTime arrivalDate, int distance, Driving driving) : base(title)
 {
     DepartureDestination = departureDestination;
     DepartureDate        = departureDate;
     ArrivalDestination   = arrivalDestination;
     ArrivalDate          = arrivalDate;
     Distance             = distance;
     this.driving         = driving;
 }