private void buttonImportParti_Click(object sender, EventArgs e) { FileInfo filePath = FileBrowser.GetFileByBrowser(Application.StartupPath , "les participants de cette course", "csv"); Dictionary <string, List <string> > dico = ImportCsvBrut.ImportCsv(filePath.FullName); ParticipationCSVToDB.Import(dico, CourseRepo.GetAll()[listBoxCourses.SelectedIndex]); ReloadDataGridView(); }
public ActionResult Get() { var course = CourseRepo.GetAll(); return(Ok(course)); }
private void ReloadDataGridView() { dataGridViewCoureurs.Rows.Clear(); loadingBar(0); //select current course from bd Course course = CourseRepo.GetAll()[listBoxCourses.SelectedIndex]; // get participant of this course List <Participation> Participations = ParticipationRepo.GetPartiFromCourse(course); Participations = Participations.OrderBy(e => e.Temps).ToList(); loadingBar(25); for (int i = 0; i < Participations.Count; i++) { Participation parti = Participations[i]; // Coureur associed with Participation Coureur coureur = CoureurRepo.GetCoureurFromParti(parti); // search argument && filter apply string query = textBoxSearch.Text; int indexFilter = comboBoxFilters.SelectedIndex; string filter = comboBoxFilters.Items[indexFilter].ToString(); if ((query == "" || query == "Rechercher..." || Regex.IsMatch(coureur.Nom.ToLower(), $"^{query.ToLower()}") || Regex.IsMatch(coureur.Prenom.ToLower(), $"^{query.ToLower()}") || Regex.IsMatch(parti.NumDossard.ToString().ToLower(), $"^{query.ToLower()}")) && (filter == "Aucun filtre" || (coureur.Age >= (indexFilter - 1) * 10 && coureur.Age <= indexFilter * 10))) { DataGridViewRow row = (DataGridViewRow)dataGridViewCoureurs.Rows[0].Clone(); row.Cells[0].Value = i + 1; //Classement row.Cells[1].Value = coureur.Nom; //Nom row.Cells[2].Value = coureur.Prenom; //PréNom row.Cells[3].Value = parti.NumDossard; //Dossard row.Cells[4].Value = ((parti.Temps != 0) ? Math.Truncate(parti.Course.Kilometrage / (parti.Temps / 3600) * 100) / 100 : 0) + " km/h"; //Vitesse Moy if (parti.Course.Kilometrage != 0) //Allure { double temps = parti.Temps / parti.Course.Kilometrage; int h = Convert.ToInt32(temps) / 3600; temps = temps % 3600; string allure = ((h / 10 > 1) ? h.ToString() : "0" + h.ToString()) + "h "; int mn = Convert.ToInt32(temps) / 60; temps = temps % 60; allure += ((mn / 10 > 1) ? mn.ToString() : "0" + mn.ToString()) + "mn "; temps = Convert.ToInt32(temps); allure += ((temps / 10 > 1) ? temps.ToString() : "0" + temps.ToString()) + "s / km"; row.Cells[5].Value = allure; } else { row.Cells[5].Value = "00h 00mn 00s"; } row.Cells[6].Value = coureur.Age; //Age row.Cells[7].Value = coureur.Sexe; //Sexe row.Cells[8].Value = coureur.Mail; //Mail row.Cells[9].Value = coureur.LicenceFFA; //Licence FFA dataGridViewCoureurs.Rows.Add(row); } loadingBar(25 + 75 * ((i + 1) / Participations.Count)); } }
public async Task <object> get_Course() { return(await reps.GetAll()); // get all list course }