コード例 #1
0
        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));
            }
        }
コード例 #2
0
        public ActionResult Get()
        {
            var course = CourseRepo.GetAll();

            return(Ok(course));
        }
コード例 #3
0
 public PgCourse()
 {
     InitializeComponent();
     _repo = new CourseRepo();
 }
コード例 #4
0
        public IActionResult Get(int id)
        {
            var faculty = CourseRepo.GetById(id);

            return(Ok(faculty));
        }
コード例 #5
0
ファイル: CourseBUS.cs プロジェクト: trannhutcuong/QLTTNN
 public CourseBUS()
 {
     reps = CourseRepo.CourseIns;
 }
コード例 #6
0
 public CoursesList()
 {
     InitializeComponent();
     _courseRepo = new CourseRepo();
     DropdownControls.BindDepartments(ref drpdownDept, true);
 }
コード例 #7
0
ファイル: CourseManager.cs プロジェクト: kidalv1/Webshop
 public CourseManager()
 {
     repo = new CourseRepo();
 }