public bool AddCar(String id, String vin, int repairingsCount, int driveWeight, bool searched, DateTime stkEndDate, DateTime ekEndDate) { Vehicle vehicle = new Vehicle(id, vin, repairingsCount, driveWeight, searched, stkEndDate, ekEndDate ); int address = CarHeapFile.Add(vehicle); bool result = IDCarTree.Add(new AddressedID(vehicle.ID, vehicle.VINMaxLength, address)); result &= VINCarTree.Add(new AddressedID(vehicle.VIN, vehicle.VINMaxLength, address)); return(result); }
public void GenerateData(int addCount) { Random random = new Random(); for (int i = 0; i < addCount; i++) { int randomNumber = random.Next(1, addCount * 100); Vehicle vehicle = new Vehicle("ID" + i, "VIN" + (addCount - i), randomNumber % 4, randomNumber, false, DateTime.Now.AddDays(randomNumber), DateTime.Now.AddDays(randomNumber) ); int address = CarHeapFile.Add(vehicle); IDCarTree.Add(new AddressedID(vehicle.ID, vehicle.VINMaxLength, address)); VINCarTree.Add(new AddressedID(vehicle.VIN, vehicle.VINMaxLength, address)); } File.WriteAllText("C:/Users/User/source/repos/CarDrivingDataManagementTest/idCarTreeLevelOrder.txt", IDCarTree.TraceLevelOrder()); File.WriteAllText("C:/Users/User/source/repos/CarDrivingDataManagementTest/vinCarTreeLevelOrder.txt", VINCarTree.TraceLevelOrder()); }