Beispiel #1
0
        private void NomEntComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            CourseComboBox.Items.Clear();
            int    hip       = 0;
            string hipSelect = HippodromeComboBox.Text;
            List <PPEV2BO.Hippodrome> listeHippodrome = new List <PPEV2BO.Hippodrome>();

            listeHippodrome = GestionHippodrome.GetHippodrome();
            foreach (PPEV2BO.Hippodrome Hip in listeHippodrome)
            {
                if (Hip.Nom == hipSelect)
                {
                    hip = Hip.Id;
                }
            }


            List <PPEV2BO.Course> listeCou = new List <PPEV2BO.Course>();

            listeCou = GestionCourses.GetCourseDunHip(hip);

            foreach (PPEV2BO.Course Cou in listeCou)
            {
                CourseComboBox.Items.Add(Cou.Nom);
                CourseComboBox.MaxDropDownItems = listeCou.Count();
            }
        }
Beispiel #2
0
        public listeResultats()
        {
            InitializeComponent();
            List <PPEV2BO.Hippodrome> listeHippodrome = new List <PPEV2BO.Hippodrome>();

            listeHippodrome            = GestionHippodrome.GetHippodrome();
            comboBoxHipp.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBoxch1.DropDownStyle  = ComboBoxStyle.DropDownList;
            comboBoxch2.DropDownStyle  = ComboBoxStyle.DropDownList;
            comboBoxch3.DropDownStyle  = ComboBoxStyle.DropDownList;
            comboBoxch4.DropDownStyle  = ComboBoxStyle.DropDownList;
            comboBoxch5.DropDownStyle  = ComboBoxStyle.DropDownList;
            comboBoxCou.DropDownStyle  = ComboBoxStyle.DropDownList;
            foreach (PPEV2BO.Hippodrome Hip in listeHippodrome)
            {
                comboBoxHipp.Items.Add(Hip.Nom);
                comboBoxHipp.MaxDropDownItems = listeHippodrome.Count();
            }
            // empecher la modification du datagridview
            dataGridViewResultat.ReadOnly = true;
        }
        public listeCourses()
        {
            InitializeComponent();
            // Création de la liste course
            List <PPEV2BO.Course> uneListe = new List <PPEV2BO.Course>();

            uneListe = GestionCourses.GetCourses();

            HippodromeComboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            // on définit le dataGridView comme étant une liste
            dataGridView1.DataSource = uneListe;


            this.dataGridView1.Columns[0].Visible  = false;
            this.dataGridView1.Columns[3].Visible  = false;
            this.dataGridView1.Columns[4].Visible  = false;
            this.dataGridView1.Columns[5].Visible  = false;
            this.dataGridView1.Columns[6].Visible  = false;
            this.dataGridView1.Columns[7].Visible  = false;
            this.dataGridView1.Columns[8].Visible  = false;
            this.dataGridView1.Columns[9].Visible  = false;
            this.dataGridView1.Columns[10].Visible = false;
            this.dataGridView1.Columns[11].Visible = false;
            this.dataGridView1.Columns[12].Visible = false;
            this.dataGridView1.Columns[13].Visible = false;

            List <PPEV2BO.Hippodrome> listeHip = new List <PPEV2BO.Hippodrome>();

            listeHip = GestionHippodrome.GetHippodrome();
            foreach (PPEV2BO.Hippodrome Hip in listeHip)
            {
                HippodromeComboBox.Items.Add(Hip.Nom);
                HippodromeComboBox.MaxDropDownItems = listeHip.Count();
            }
            // empecher la modification du datagridview
            dataGridView1.ReadOnly = true;
        }
Beispiel #4
0
        public gestioncourses()
        {
            InitializeComponent();

            HippodromeComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            CourseComboBox.DropDownStyle     = ComboBoxStyle.DropDownList;
            comboBox1.DropDownStyle          = ComboBoxStyle.DropDownList;
            comboBox2.DropDownStyle          = ComboBoxStyle.DropDownList;

            List <PPEV2BO.Hippodrome> listeHip = new List <PPEV2BO.Hippodrome>();

            listeHip = GestionHippodrome.GetHippodrome();
            foreach (PPEV2BO.Hippodrome Hip in listeHip)
            {
                HippodromeComboBox.Items.Add(Hip.Nom);
                HippodromeComboBox.MaxDropDownItems = listeHip.Count();
            }

            List <PPEV2BO.Cheval> uneListeDeChevaux = new List <PPEV2BO.Cheval>();

            uneListeDeChevaux = GestionChevaux.GetChevaux();
            foreach (PPEV2BO.Cheval Che in uneListeDeChevaux)
            {
                comboBox1.Items.Add(Che.Nom);
                comboBox1.MaxDropDownItems = uneListeDeChevaux.Count();
            }

            List <PPEV2BO.Jockey> uneListeJockey = new List <PPEV2BO.Jockey>();

            uneListeJockey = GestionJockeys.GetJockeys();
            foreach (PPEV2BO.Jockey Jck in uneListeJockey)
            {
                comboBox2.Items.Add(Jck.Nom);
                comboBox2.MaxDropDownItems = uneListeJockey.Count();
            }
            dataGridView1.ReadOnly = true;
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.SelectedCells.Count > 0)
            {
                int             selectedrowindex = dataGridView1.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow      = dataGridView1.Rows[selectedrowindex];
                int             idSelected       = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
                string          nomSelected      = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value);
                string          lieuSelected     = Convert.ToString(dataGridView1.CurrentRow.Cells[2].Value);
                string          crsNbrMax        = Convert.ToString(dataGridView1.CurrentRow.Cells[3].Value);
                string          crsPrice         = Convert.ToString(dataGridView1.CurrentRow.Cells[4].Value);
                string          crsFirst         = Convert.ToString(dataGridView1.CurrentRow.Cells[5].Value);
                string          crsSecond        = Convert.ToString(dataGridView1.CurrentRow.Cells[6].Value);
                string          crsThird         = Convert.ToString(dataGridView1.CurrentRow.Cells[7].Value);
                string          crsFourth        = Convert.ToString(dataGridView1.CurrentRow.Cells[8].Value);
                string          crsFifth         = Convert.ToString(dataGridView1.CurrentRow.Cells[9].Value);
                int             crsHipId         = Convert.ToInt32(dataGridView1.CurrentRow.Cells[10].Value);
                string          crsAgeMin        = Convert.ToString(dataGridView1.CurrentRow.Cells[11].Value);
                string          crsAgeMax        = Convert.ToString(dataGridView1.CurrentRow.Cells[12].Value);
                string          crsSexe          = Convert.ToString(dataGridView1.CurrentRow.Cells[13].Value);
                string          crsDate          = Convert.ToString(dataGridView1.CurrentRow.Cells[14].Value);

                DateTime uneDate = Convert.ToDateTime(crsDate);


                NOMTextBox.Text           = nomSelected;
                NbrChevauxMaxListBox.Text = crsNbrMax;
                textBox2.Text             = crsFirst;
                textBox3.Text             = crsSecond;
                textBox4.Text             = crsThird;
                textBox5.Text             = crsFourth;
                textBox6.Text             = crsFifth;
                AGEMINTextBox.Text        = crsAgeMin;
                AGEMAXtextboc.Text        = crsAgeMax;
                AllocationLabel.Text      = crsPrice;
                monthCalendar1.SetDate(uneDate);


                if (crsSexe == "M")
                {
                    HOMMEradio.Checked   = true;
                    FEMMERadio.Checked   = false;
                    radioButton1.Checked = false;
                }
                else if (crsSexe == "F")
                {
                    HOMMEradio.Checked   = false;
                    FEMMERadio.Checked   = true;
                    radioButton1.Checked = false;
                }
                else
                {
                    HOMMEradio.Checked   = false;
                    FEMMERadio.Checked   = false;
                    radioButton1.Checked = true;
                }

                PPEV2BO.Hippodrome unHip = new PPEV2BO.Hippodrome();
                unHip = GestionHippodrome.GetUnHippodrome(crsHipId);
                HippodromeComboBox.Text = unHip.Nom;
            }
        }
        private void btnajout_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("êtes vous sur de vouloir ajouter la course selectionné ?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                int idSelected = 0;
                idSelected = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);

                string sexe = "X";

                if (HOMMEradio.Checked == true)
                {
                    sexe = "M";
                }
                else if (FEMMERadio.Checked == true)
                {
                    sexe = "F";
                }
                else if (radioButton1.Checked == true)
                {
                    sexe = "X";
                }

                int NbrChevauxMax = 0;
                Int32.TryParse(NbrChevauxMaxListBox.Text, out NbrChevauxMax);
                int AllocationComp = 0;
                Int32.TryParse(AllocationLabel.Text, out AllocationComp);
                int CrsFirst = 0;
                Int32.TryParse(textBox2.Text, out CrsFirst);
                int CrsSecond = 0;
                Int32.TryParse(textBox3.Text, out CrsSecond);
                int CrsThird = 0;
                Int32.TryParse(textBox4.Text, out CrsThird);
                int CrsFourth = 0;
                Int32.TryParse(textBox5.Text, out CrsFourth);
                int CrsFifth = 0;
                Int32.TryParse(textBox6.Text, out CrsFifth);
                int AgeMin = 0;
                Int32.TryParse(AGEMINTextBox.Text, out AgeMin);
                int AgeMax = 0;
                Int32.TryParse(AGEMAXtextboc.Text, out AgeMax);
                string uneDate = monthCalendar1.SelectionRange.Start.ToShortDateString();

                int totalPrix = 0;
                totalPrix = CrsFirst + CrsSecond + CrsThird + CrsFourth + CrsFifth;


                // CHOPER ID DE HIPPODROME DEPUIS COURSE
                int    hip       = 0;
                string hipSelect = HippodromeComboBox.Text;
                List <PPEV2BO.Hippodrome> listeHippodrome = new List <PPEV2BO.Hippodrome>();
                listeHippodrome = GestionHippodrome.GetHippodrome();
                foreach (PPEV2BO.Hippodrome Hip in listeHippodrome)
                {
                    if (Hip.Nom == hipSelect)
                    {
                        hip = Hip.Id;
                    }
                }


                GestionCourses.CreerCourse(NOMTextBox.Text, HippodromeComboBox.Text, NbrChevauxMax, totalPrix, CrsFirst, CrsSecond, CrsThird, CrsFourth, CrsFifth, hip, AgeMin, AgeMax, sexe, uneDate);
                MessageBox.Show("La Course" + NOMTextBox.Text + " a bien été crée", "Modification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                dataGridView1.Update();
                dataGridView1.Refresh();
                // Création de la liste course
                List <PPEV2BO.Course> uneListe = new List <PPEV2BO.Course>();
                uneListe = GestionCourses.GetCourses();
                // on définit le dataGridView comme étant une liste
                dataGridView1.DataSource = uneListe;
                AllocationLabel.Text     = Convert.ToString(totalPrix);
                this.dataGridView1.Columns[0].Visible  = false;
                this.dataGridView1.Columns[3].Visible  = false;
                this.dataGridView1.Columns[4].Visible  = false;
                this.dataGridView1.Columns[5].Visible  = false;
                this.dataGridView1.Columns[6].Visible  = false;
                this.dataGridView1.Columns[7].Visible  = false;
                this.dataGridView1.Columns[8].Visible  = false;
                this.dataGridView1.Columns[9].Visible  = false;
                this.dataGridView1.Columns[10].Visible = false;
                this.dataGridView1.Columns[11].Visible = false;
                this.dataGridView1.Columns[12].Visible = false;
                this.dataGridView1.Columns[13].Visible = false;
            }
        }