/// <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++;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Rafraichi la source des Postes
        /// </summary>
        private void RefreshSourcePoste()
        {
            List <Poste> poste = new List <Poste>();

            poste.Add(new Poste()
            {
                Id = null, Type = "ALL - Poste"
            });
            poste.AddRange(controller.GetPoste());
            posteSource.DataSource = poste;
        }
        public void B_TestGetPoste()
        {
            List <Poste> expected = new List <Poste>();

            expected.Add(new Poste {
                Type = "Développeur/Développeuse informatique"
            });
            expected.Add(new Poste {
                Type = "Technicien réseaux"
            });
            expected.Add(new Poste {
                Type = "Administrateur de base de données"
            });
            expected.Add(new Poste {
                Type = "Architecte réseau"
            });
            expected.Add(new Poste {
                Type = "Hot liner"
            });
            expected.Add(new Poste {
                Type = "Testeur/Testeuse"
            });
            expected.Add(new Poste {
                Type = "Ingénieur/Ingénieure système"
            });
            expected.Add(new Poste {
                Type = "Technicien/Technicienne de maintenance en informatique"
            });
            expected.Add(new Poste {
                Type = "Administrateur/Administratrice de réseau"
            });
            expected.Add(new Poste {
                Type = "Chef/Cheffe de projet informatique"
            });

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

            actual.AddRange(testControler.GetPoste());

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

            CollectionAssert.AreEqual(expected, actual);
        }