private void EntrepriseMenu_Click(object sender, RoutedEventArgs e) { ListerEntreprisesVue listerentreprise = new ListerEntreprisesVue(User); listerentreprise.Show(); this.Close(); }
//Menu Entreprise private void EntrepriseMenu_Click(object sender, RoutedEventArgs e) { this.Visibility = System.Windows.Visibility.Hidden; ListerEntreprisesVue listerentreprise = new ListerEntreprisesVue(User); listerentreprise.Show(); this.Close(); }
//ajouter une entreprise private void BtnValiderAjouter_Click(object sender, RoutedEventArgs e) { bool peutAjouter = true; if (ChoixNomVue.Text.Length > 0) { MonEntreprise.Nom = ChoixNomVue.Text; } else { peutAjouter = false; } if (ChoixCourrielVue.Text.Length > 0) { MonEntreprise.Email = ChoixCourrielVue.Text; } else { peutAjouter = false; } if (ChoixTel1Vue.Text != null || !ChoixTel1Vue.Text.Equals("")) { MonEntreprise.Telephone1 = ChoixTel1Vue.Text; } else { MonEntreprise.Telephone1 = null; } if (ChoixTel2Vue.Text != null || !ChoixTel2Vue.Text.Equals("")) { MonEntreprise.Telephone2 = ChoixTel2Vue.Text; } else { MonEntreprise.Telephone1 = null; } if (ChoixTel3Vue.Text != null || !ChoixTel3Vue.Text.Equals("")) { MonEntreprise.Telephone3 = ChoixTel3Vue.Text; } else { MonEntreprise.Telephone3 = null; } if (ChoixAdresseVue.Text != null || !ChoixAdresseVue.Text.Equals("")) { MonEntreprise.Adresse = ChoixAdresseVue.Text; } else { MonEntreprise.Adresse = null; } if (ChoixVilleVue.Text != null || !ChoixVilleVue.Text.Equals("")) { MonEntreprise.Ville = ChoixVilleVue.Text; } else { MonEntreprise.Ville = null; } if (ChoixSecteurVue.Text != null || !ChoixSecteurVue.Text.Equals("")) { MonEntreprise.Secteur = ChoixSecteurVue.Text; } else { MonEntreprise.Secteur = null; } if (ChoixLangueVue.SelectedItem != null) { MonEntreprise.Langue = ListeDescription.recupererIdLangue(ChoixLangueVue.SelectedValue.ToString()); } else { MonEntreprise.Langue = null; } if (ChoixCommentaireVue.Text != null || !ChoixCommentaireVue.Text.Equals("")) { MonEntreprise.Commentaire = ChoixCommentaireVue.Text; } else { MonEntreprise.Commentaire = null; } List <int> listFormationRechercher = null; if (ChoixFromationVue.SelectedItem != null) { // pour ajoute dans bdd listFormationRechercher = new List <int>(); MonEntreprise.FormationsRecherchees = new List <IdDescription>(); foreach (var item in ChoixFromationVue.SelectedItems) { if (item != null) { IdDescription formation = new IdDescription(); formation.Id = ListeDescription.recupererIdFormation(item.ToString()); listFormationRechercher.Add(formation.Id); formation.Description = item.ToString(); MonEntreprise.FormationsRecherchees.Add(formation); } } } else { MonEntreprise.FormationsRecherchees = null; } List <int> listTechnologieRecherche = null; if (ChoixTechnologieVue.SelectedItem != null) { listTechnologieRecherche = new List <int>(); MonEntreprise.TechnologiesRecherchees = new List <IdDescription>(); foreach (var item in ChoixTechnologieVue.SelectedItems) { if (item != null) { IdDescription technologie = new IdDescription(); technologie.Id = ListeDescription.recupererIdDescription(item.ToString(), ListeDescription.listTechnologie); listTechnologieRecherche.Add(technologie.Id); technologie.Description = item.ToString(); MonEntreprise.TechnologiesRecherchees.Add(technologie); } } } else { MonEntreprise.TechnologiesRecherchees = null; } List <int> listInteretRecherche = null; if (ChoixInteretVue.SelectedItem != null) { listInteretRecherche = new List <int>(); MonEntreprise.InteretsRecherches = new List <IdDescription>(); foreach (var item in ChoixInteretVue.SelectedItems) { if (item != null) { IdDescription interet = new IdDescription(); interet.Id = ListeDescription.recupererIdDescription(item.ToString(), ListeDescription.listInterets); listInteretRecherche.Add(interet.Id); interet.Description = item.ToString(); MonEntreprise.InteretsRecherches.Add(interet); } } } else { MonEntreprise.InteretsRecherches = null; } if (MonEntreprise.ImageLogo == null) { MonEntreprise.ImageLogo = "images\\ProfilImageVide.png"; } MonEntreprise.DateSaisie = DateTime.Now; MonEntreprise.Modification = new Modification(); MonEntreprise.Modification.UtilisateurId = User.Id; MonEntreprise.Modification.DateModification = DateTime.Now; if (peutAjouter) { // atente pas d inner join dans la requete if (ManagerEntreprise.ajouterEntreprise(MonEntreprise, listFormationRechercher, listInteretRecherche, listTechnologieRecherche) && peutAjouter) { ListerEntreprisesVue listerentreprise = new ListerEntreprisesVue(User); listerentreprise.Show(); this.Close(); } } else { MessageBox.Show("Veuillez saisir les champs obligatoires", "Ajout d'un étudiant", MessageBoxButton.OK, MessageBoxImage.Information); } }