/// <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++; } }
public void D_TestInsertOffre() { Offre expected = new Offre { Poste = new Poste { Id = 1, Type = "Développeur/Développeuse informatique" }, Contrat = new Contrat { Id = 1, Type = "CDI" }, Region = new Region { Id = 1, Nom = "Auvergne-Rhône-Alpes" }, Titre = "", Description = "", Lien = "", Creation = new DateTime(DateTime.Now.Ticks, DateTimeKind.Utc) }; testControler.InsertOffre(expected); List <Offre> actual = new List <Offre>(); actual.AddRange(testControler.GetOffres()); CollectionAssert.Contains(actual, expected); }
public async Task <IEnumerable <OffreM> > getOffrebyRegion(RegionM region = null, bool favori = false) { List <OffreM> offres = new List <OffreM>(); List <Offre> response = new List <Offre>(); List <int> favorites = getFavorites(); if (region != null) { FiltersOffreRequest filter = new FiltersOffreRequest(); filter.region = new Region(region.Id, region.Nom); response = await controleur.GetOffres(filter); } else { response = controleur.GetOffres(); } // Lambda Fonction response.ForEach(o => { OffreM om = new OffreM(o); om.isFavorite = favorites.Contains(o.Id.Value); if (favori && om.isFavorite) { offres.Add(om); } else if (!favori) { offres.Add(om); } }); return(offres); }
public async void RefreshOffreSelectioned() { Region region = (Region)comboBoxRegion.SelectedItem; Contrat contrat = (Contrat)comboBoxContrat.SelectedItem; Poste poste = (Poste)comboBoxPoste.SelectedItem; Intervalle intervalle = new Intervalle(dateTimePickerCreationStart.NullableValue(), dateTimePickerCreationEnd.NullableValue()); // Fix Bug out of Range exception offreSource.DataSource = null; try { var t = controller.GetOffres(new FiltersOffreRequest(region, contrat, poste, intervalle)); await t; offreSource.DataSource = t.Result; } catch { } if (dataGridViewOffre.RowCount > 0) { this.dataGridViewOffre.Columns["Id"].Visible = false; } compteur.Text = dataGridViewOffre.RowCount.ToString(); }