Ejemplo n.º 1
0
        /// <summary>
        /// Affiche et type les colonnes de données
        /// </summary>
        private void InitializeForm()
        {
            List <string> Labels = new List <string>()
            {
                "Titre", "Description", "Région", "Type de Contrat", "Type de Poste", "Date Publication", "Lien"
            };
            int i = 0;

            foreach (string label in Labels)
            {
                Label label_UI = new Label()
                {
                    Text = label + " :"
                };
                label_UI.Dock = DockStyle.Top;

                Control control = new TextBox();
                if (label == "Date Publication")
                {
                    control = new DateTimePicker();
                }
                else if (label == "Type de Poste" || label == "Type de Contrat" || label == "Région")
                {
                    BindingSource bs = new BindingSource();

                    control = new ComboBox();
                    ((ComboBox)control).DataSource    = bs;
                    ((ComboBox)control).DisplayMember = "Name";
                    ((ComboBox)control).ValueMember   = "Id";
                    if (label == "Type de Poste")
                    {
                        bs.DataSource = controller.GetPoste();
                    }
                    else if (label == "Type de Contrat")
                    {
                        bs.DataSource = controller.GetContrat();
                    }
                    else if (label == "Région")
                    {
                        bs.DataSource = controller.GetRegion();
                    }
                    else
                    {
                        bs.DataSource = controller.GetOffres();
                    }

                    //((ComboBox)control).SelectedText = null;
                    //((ComboBox)control).SelectionLength = 0;
                    //((ComboBox)control).
                }

                formControls.Add(label, control);
                control.Dock = DockStyle.Fill;
                layout.Controls.Add(label_UI, 0, i);
                layout.Controls.Add(control, 1, i);
                i++;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Rafraichi la source des Régions
        /// </summary>
        private void RefreshSourceRegion()
        {
            List <Region> region = new List <Region>();

            region.Add(new Region()
            {
                Id = null, Nom = "ALL - Regions"
            });
            region.AddRange(controller.GetRegion());
            regionSource.DataSource = region;
        }
Ejemplo n.º 3
0
        public List <RegionM> getRegion()
        {
            List <RegionM> regions  = new List <RegionM>();
            List <Region>  response = new List <Region>();


            response = controleur.GetRegion();

            // Lambda Fonction
            response.ForEach(r => {
                RegionM rm = new RegionM(r);

                regions.Add(rm);
            });

            return(regions);
        }
Ejemplo n.º 4
0
        public void C_TestGetRegion()
        {
            List <Region> expected = new List <Region>();

            expected.Add(new Region {
                Nom = "Auvergne-Rhône-Alpes"
            });
            expected.Add(new Region {
                Nom = "Bourgogne-Franche-Comté"
            });
            expected.Add(new Region {
                Nom = "Bretagne"
            });
            expected.Add(new Region {
                Nom = "Centre-Val de Loire"
            });
            expected.Add(new Region {
                Nom = "Corse"
            });
            expected.Add(new Region {
                Nom = "Grand Est"
            });
            expected.Add(new Region {
                Nom = "Guadeloupe"
            });
            expected.Add(new Region {
                Nom = "Guyane"
            });
            expected.Add(new Region {
                Nom = "Hauts-de-France"
            });
            expected.Add(new Region {
                Nom = "Île-de-France"
            });
            expected.Add(new Region {
                Nom = "Martinique"
            });
            expected.Add(new Region {
                Nom = "Mayotte"
            });
            expected.Add(new Region {
                Nom = "Normandie"
            });
            expected.Add(new Region {
                Nom = "Nouvelle-Aquitaine"
            });
            expected.Add(new Region {
                Nom = "Occitanie"
            });
            expected.Add(new Region {
                Nom = "Pays de la Loire"
            });
            expected.Add(new Region {
                Nom = "Provence-Alpes-Côte d'Azur"
            });
            expected.Add(new Region {
                Nom = "La Réunion"
            });


            List <Region> actual = new List <Region>();

            actual.AddRange(testControler.GetRegion());

            Assert.AreSame(expected.ToString(), actual.ToString());

            CollectionAssert.AreEqual(expected, actual);
        }