private void AddKey_Click(object sender, EventArgs e) { if ((cBKeyword.SelectedIndex == -1) && (newKeyword.Text == "")) { return; } Keywords kw = null; if (!String.IsNullOrEmpty(newKeyword.Text)) { kw = new Keywords { Keyword = newKeyword.Text }; List <Keywords> lk = md.Keywords.ToList(); if (!lk.Contains(kw)) { md.Keywords.Add(kw); } } else if (cBKeyword.SelectedIndex != -1) { kw = (Keywords)cBKeyword.Items[cBKeyword.SelectedIndex]; } currentScene.AddKeywordToScene(kw); newKeyword.Text = ""; md.SaveChanges(); SceneInfoChanged?.Invoke(this, new SceneSelectedArgs { scene = currentScene }); }
private void Valid_Click(object sender, EventArgs e) { GetPlace(); currentScene.Titre = SceneTitle.Text; currentScene.Commentaire = comment.Text; SceneInfoChanged?.Invoke(this, new SceneSelectedArgs { scene = currentScene }); GetData(); md.SaveChanges(); }
private void AddPerson_Click(object sender, EventArgs e) { Personne p = null; if (!String.IsNullOrEmpty(NouvFamille.Text)) { if (!String.IsNullOrEmpty(Prenom.Text)) { p = new Personne { Nom = NouvFamille.Text, Prénom = Prenom.Text }; md.Personne.Add(p); } } else if ((Famille.SelectedItem != null) && (!String.IsNullOrEmpty(Prenom.Text))) { p = new Personne { Nom = Famille.Text, Prénom = Prenom.Text }; md.Personne.Add(p); } else if (cBPersonnes.SelectedItem != null) { p = (Personne)cBPersonnes.SelectedItem; } if (p != null) { AddPersonToListView(p); currentScene.AddPersonToScene(p); md.SaveChanges(); GetData(); SceneInfoChanged?.Invoke(this, new SceneSelectedArgs { scene = currentScene }); } }