public static void InsertAcc(List <string> insertFileList, InsertConfig config, List <InsertDatum> insertDatumList) { foreach (var filePath in insertFileList) //Parallel.For(0, insertFileList.Count, i => { string[] word = filePath.Split('\\'); // ACCファイルでない場合はcontinue if (System.Text.RegularExpressions.Regex.IsMatch(word[word.Length - 1], @"\d{14}Unsent16HzAccel.csv")) { var datum = new InsertDatum() { DriverId = DriverNames.GetDriverId(word[DriverIndex]), CarId = CarNames.GetCarId(word[CarIndex]), SensorId = SensorNames.GetSensorId(word[SensorIndex]), StartTime = config.StartDate, EndTime = config.EndDate, EstimatedCarModel = EstimatedCarModel.GetModel(config.CarModel) }; InsertDatum.AddDatumToList(insertDatumList, datum); InsertAccRaw(filePath, datum); } //}); } }
static void Main() { Console.WriteLine("------| Our Awesome Car List |------"); Console.WriteLine(); Console.WriteLine("Please enter a number between 1 to 5: "); string numberString = Console.ReadLine(); int carNumber = Convert.ToInt32(numberString); // check if entry input is valid if (carNumber > 0 && carNumber <= 5) { CarNames _carName = (CarNames)carNumber; // explicit convert from number Console.WriteLine($"You chose number {numberString} and the car is: {_carName}"); } else { // if incorrect input, restart Console.WriteLine("You did not enter a valid number, please enter a number between 1 and 5."); Console.WriteLine("Press enter to restart..."); Console.ReadKey(); Console.Clear(); Program.Main(); } Console.ReadKey(); }
public static Task InsertGps(List <string> insertFileList, InsertConfig config, int correctionIndex, List <InsertDatum> insertDatumList) { var tasks = new List <Task>(); foreach (string filePath in insertFileList) { Console.WriteLine("GPSinserting:" + filePath); string[] word = filePath.Split('\\'); // GPSファイルでない場合はcontinue if (!System.Text.RegularExpressions.Regex.IsMatch(word[word.Length - 1], @"\d{14}UnsentGPS.csv")) { continue; } var datum = new InsertDatum() { DriverId = DriverNames.GetDriverId(word[DriverIndex]), CarId = CarNames.GetCarId(word[CarIndex]), SensorId = SensorNames.GetSensorId(word[SensorIndex]), StartTime = config.StartDate, EndTime = config.EndDate, EstimatedCarModel = EstimatedCarModel.GetModel(config.CarModel) }; InsertDatum.AddDatumToList(insertDatumList, datum); LogWritter.WriteLog(LogWritter.LogMode.Gps, $"インサートデータ, FilePath: {filePath}, DriverId: {datum.DriverId}, CarId: {datum.CarId}, SensorId: {datum.SensorId}"); // ファイルごとの処理なので主キー違反があっても挿入されないだけ var gpsRawTable = InsertGpsRaw(filePath, datum, config.Correction[correctionIndex]); if (config.Correction[correctionIndex] == InsertConfig.GpsCorrection.SpeedLPFMapMatching || config.Correction[correctionIndex] == InsertConfig.GpsCorrection.MapMatching) { gpsRawTable = MapMatching.getResultMapMatching(gpsRawTable, datum); } else if (config.Correction[correctionIndex] == InsertConfig.GpsCorrection.DopplerSpeed) { gpsRawTable = MapMatching.getResultMapMatchingDoppler(gpsRawTable, datum); } if (gpsRawTable.Rows.Count != 0) { var task = Task.Run(() => { InsertCorrectedGps(gpsRawTable, config.Correction[correctionIndex]); }); tasks.Add(task); TripInserter.InsertTripRaw(gpsRawTable, config.Correction[correctionIndex]); //TripInserter.InsertTrip(datum, config.Correction[correctionIndex]); } else { LogWritter.WriteLog(LogWritter.LogMode.Gps, $"ファイルの行数が0行のためインサートを行いませんでした: {filePath}"); } } return(Task.WhenAll(tasks)); }
protected override void SetCarNamesList() { CarNames.Add("BELAZ 75710"); CarNames.Add("Caterpillar 797F"); CarNames.Add("Liebherr T 282"); CarNames.Add("Komatsu 980E"); CarNames.Add("Terex 33-19 Titan"); }
protected override void SetCarNamesList() { CarNames.Add("Buggy"); CarNames.Add("Panoz GF09"); CarNames.Add("Caterham CT03"); CarNames.Add("FIA GT1"); CarNames.Add("Audi R18"); }
private void BtnSave_Click(object sender, EventArgs e) { int CarId = 0; if (!string.IsNullOrEmpty(TxtCarName.Text) && !string.IsNullOrEmpty(TxtCarModel.Text) && NumEngine.Value > 0 && !string.IsNullOrEmpty(TxtRegNum.Text) && NumPrice.Value > 0 && NumYear.Value > 1900) { if (CbCarBrand.Text != "Choose" && TxtCarName.Text == CbCarBrand.Text) { if (db.CarNames.FirstOrDefault(c => c.Name == CbCarBrand.Text) != null) { CarId = db.CarNames.FirstOrDefault(c => c.Name == CbCarBrand.Text).Id; } CarNames carBrand = db.CarNames.Find(CarId); AvailableCars car = db.AvailableCars.Find(CarId); carBrand.Id = CarId; car.Model = TxtCarModel.Text; car.Engine = Convert.ToDecimal(NumEngine.Value); car.Year = Convert.ToInt32(NumYear.Value); car.RegNumber = TxtRegNum.Text; car.Price = Convert.ToDecimal(NumPrice.Value); car.CarNameId = CarId; car.EditedAddedBy = this.AdminId; db.AvailableCars.Add(car); } else { if (db.CarNames.FirstOrDefault(c => c.Name == TxtCarName.Text) != null) { CarId = db.CarNames.FirstOrDefault(c => c.Name == TxtCarName.Text).Id; } AvailableCars car = new AvailableCars(); CarNames carBrand = new CarNames(); carBrand.Name = TxtCarName.Text; car.Model = TxtCarModel.Text; car.Engine = Convert.ToDecimal(NumEngine.Value); car.Year = Convert.ToInt32(NumYear.Value); car.RegNumber = TxtRegNum.Text; car.Price = Convert.ToDecimal(NumPrice.Value); car.CarNameId = CarId; car.EditedAddedBy = this.AdminId; db.CarNames.Add(carBrand); db.AvailableCars.Add(car); } db.SaveChanges(); MessageBox.Show("You Have Added New Car!"); FillDGV(); FillCbCarBrand(); } else { LblWarning.Text = "Please Enter all (*) details!"; } }
protected override void SetCarNamesList() { CarNames.Add("MAN TGS 6x6"); CarNames.Add("Foton AumanH5 4x2"); CarNames.Add("DAF LF 55"); CarNames.Add("Volvo FL 7"); CarNames.Add("DAF XF 95 FAR"); CarNames.Add("MAN TGX"); }
protected override void SetCarNamesList() { CarNames.Add("UAZ Patriot"); CarNames.Add("Jeep Wrangler"); CarNames.Add("Suzuki Jimny"); CarNames.Add("Jeep Grand Cherokee"); CarNames.Add("Range Rover Velar"); CarNames.Add("Chevrolet Tahoe"); }
protected override void SetCarNamesList() { CarNames.Add("Toyota Tundra"); CarNames.Add("VW Amarok"); CarNames.Add("Toyota Tacoma"); CarNames.Add("Dodge Ram"); CarNames.Add("Ford F250"); CarNames.Add("Nissan Navara"); }
private static string ConvertFromEnum(CarNames name) { switch (name) { case CarNames.Audi: return("Audi"); case CarNames.BMW: return("BMW"); case CarNames.Chevrolet: return("Chevrolet"); case CarNames.Citroen: return("Citroen"); case CarNames.Ford: return("Ford"); case CarNames.Honda: return("Honda"); case CarNames.Hyinday: return("Hyinday"); case CarNames.Kia: return("Kia"); case CarNames.LADA: return("LADA"); case CarNames.Lexus: return("Lexus"); case CarNames.Mazda: return("Mazda"); case CarNames.Mercedes: return("Mercedes"); case CarNames.Mitsubishi: return("Mitsubishi"); case CarNames.Nissan: return("Nissan"); case CarNames.Opel: return("Opel"); case CarNames.Renault: return("Renault"); case CarNames.Skoda: return("Skoda"); case CarNames.Subaru: return("Subaru"); case CarNames.Toyota: return("Toyota"); case CarNames.Volkswagen: return("Volkswagen"); case CarNames.Volvo: return("Volvo"); default: throw new Exception("vot tak"); } }
private void BtnUpdate_Click(object sender, EventArgs e) { string oldName = TxtCarName.Text; CarNames carBrand = db.CarNames.Find(this._selectedId); AvailableCars car = db.AvailableCars.Find(this._selectedId); carBrand.Name = TxtCarName.Text; car.Model = TxtCarModel.Text; car.Engine = NumEngine.Value; car.Year = Convert.ToInt32(NumYear.Value); car.RegNumber = TxtRegNum.Text; car.Price = Convert.ToInt32(NumPrice.Value); car.EditedAddedBy = this.AdminId; db.SaveChanges(); LblWarning.Text = ""; MessageBox.Show("You Have Updated " + oldName + " to " + carBrand.Name); FillDGV(); FillCbCarBrand(); }
protected override void SetCarNamesList() { CarNames.Add("Lohr"); CarNames.Add("Rolfo"); CarNames.Add("Kassbohrer"); }
protected override void SetCarNamesList() { CarNames.Add("MX - 450"); CarNames.Add("Dulevo sweeper"); }
public Wagon() { CarNames.Add("Lada Granta"); CarNames.Add("Audi RS4 V Avant"); }
protected override void SetCarNamesList() { CarNames.Add("Snowplug ZLST551Q"); CarNames.Add("Petrol 11 HP snowplug STG1101QE-02"); }
protected override void SetCarNamesList() { CarNames.Add("Ursus 11054"); CarNames.Add("Fendt 820"); CarNames.Add("MTZ 122"); }
protected Snowplug() { CarNames.Add("Snowplug ZLST551Q"); CarNames.Add("Petrol 11 HP snowplug STG1101QE-02"); }
public PrimeMover() { CarNames.Add("Offroad prime mover MAN TGS 6x6"); CarNames.Add("Foton AumanH5 4x2"); }
protected override void SetCarNamesList() { CarNames.Add("Emergency 911 Ambulance"); CarNames.Add("Regular Ambulance"); }
protected override void SetCarNamesList() { CarNames.Add("Lada Granta"); CarNames.Add("Audi RS4 V Avant"); }
protected Racecar() { CarNames.Add("Buggy"); }