Exemplo n.º 1
0
        // evenement au click des boutons
        private void afficherDetailsEntreprise(object sender, RoutedEventArgs e)
        {
            int id = (int)(((Button)sender).DataContext);


            ProfileEntrepriseVue entreprise = new ProfileEntrepriseVue(User, id);

            entreprise.Show();
            this.Close();
        }
Exemplo n.º 2
0
        //ajouter une entreprise
        private void BtnValiderModifier_Click(object sender, RoutedEventArgs e)
        {
            bool peutAjouter = true;

            if (ChoixNomVue.Text != null || !ChoixNomVue.Text.Equals(""))
            {
                MonEntreprise.Nom = ChoixNomVue.Text;
            }
            else
            {
                peutAjouter = false;
            }


            if (ChoixCourrielVue.Text != null || !ChoixCourrielVue.Text.Equals(""))
            {
                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.SelectedItems != null)
            {
                // pour ajoute dans bdd
                listFormationRechercher = new List <int>();
                foreach (ListBoxItem item in ChoixFromationVue.SelectedItems)
                {
                    if (item != null)
                    {
                        listFormationRechercher.Add(ListeDescription.recupererIdFormation(item.Content.ToString()));
                    }
                }
            }



            List <int> listTechnologieRecherche = null;

            if (ChoixTechnologieVue.SelectedItems != null)
            {
                listTechnologieRecherche = new List <int>();
                foreach (ListBoxItem item in ChoixTechnologieVue.SelectedItems)
                {
                    if (item != null)
                    {
                        listTechnologieRecherche.Add(ListeDescription.recupererIdDescription(item.Content.ToString(), ListeDescription.listTechnologie));
                    }
                }
            }


            List <int> listInteretRecherche = null;

            if (ChoixInteretVue.SelectedItems != null)
            {
                listInteretRecherche = new List <int>();
                foreach (ListBoxItem item in ChoixInteretVue.SelectedItems)
                {
                    if (item != null)
                    {
                        listInteretRecherche.Add(ListeDescription.recupererIdDescription(item.Content.ToString(), ListeDescription.listInterets));
                    }
                }
            }

            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;



            // atente pas d inner join dans la requete
            //if(ManagerEntreprise.modifierEntreprise(MonEntreprise, listFormationRechercher, listInteretRecherche, listTechnologieRecherche) && peutAjouter)

            if (peutAjouter)
            {
                ManagerEntreprise.modifierEntreprise(MonEntreprise, listFormationRechercher, listInteretRecherche, listTechnologieRecherche);
                MessageBox.Show("Entreprise modifiée.", "Modification d'une entreprise", MessageBoxButton.OK, MessageBoxImage.Information);
                ProfileEntrepriseVue vue = new ProfileEntrepriseVue(User, MonEntreprise.Id);
                vue.Show();
                this.Close();
            }

            else
            {
                MessageBox.Show("Veuillez remplir tous les champs obligatoires", "Modification d'une entreprise", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }