public MainWindow(string activityInformations, ref Teacher teacher) : this() { activity = ActivityPathParser.Parser(activityInformations); this.teacher = teacher; if (activity.IDActivity != -2) { BDDAccess bddAccess = new BDDAccess(); if (bddAccess.Connect()) { activity = bddAccess.GetActivity(activity.IDActivity); activity.ProvidedWords = activity.ProvidedWords.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList(); TexteTextBox.DataContext = activity; ProvidedWordsListBox.ItemsSource = activity.ProvidedWords; if (!string.IsNullOrEmpty(bddAccess.Information)) { MessageBox.Show(bddAccess.Information, new AssemblyInformations(Assembly.GetExecutingAssembly().GetName().Name).Product, MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK); } } } }
public ActionResult Work(int id, string tag) { Activity model = new Activity(); BDDAccess bddAccess = new BDDAccess(); if (bddAccess.Connect(Path.Combine(Server.MapPath("~").ToString(), "bdd.bin"))) { if (bddAccess.Information != null && bddAccess.Information != "") { ViewBag.Erreur = bddAccess.Information; return(View("Error")); } Student student = new Student() { FirstName = (Session["User"] as User).FirstName, LastName = (Session["User"] as User).LastName, Class = new Class() { ClassName = Student.GetClass((Session["User"] as User).Groups[0]) } }; if (tag == "saved") { model = bddAccess.GetSavedActivity(id, student); } else { model = bddAccess.GetActivity(id); } model.GetTextToDisplay(""); model.CountWords(); Session["Activity"] = model; } else { ViewBag.Error = bddAccess.Information; return(View("Error")); } return(View(model)); }
private void OpenCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { if (!Ldap.IsAuthificated) { new AuthentificationWindow(ref teacher).ShowDialog(this); } if (Ldap.IsAuthificated) { OpenBDDWindow openBDD = new OpenBDDWindow(teacher); openBDD.ShowDialog(this); if (openBDD.ActivityInformations != "" && openBDD.ActivityInformations != null) { activity = ActivityPathParser.Parser(openBDD.ActivityInformations); if (activity.IDActivity != -2) { BDDAccess bddAccess = new BDDAccess(); if (bddAccess.Connect()) { activity = bddAccess.GetActivity(activity.IDActivity); activity.ProvidedWords = activity.ProvidedWords.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList(); TexteTextBox.DataContext = activity; ProvidedWordsListBox.ItemsSource = activity.ProvidedWords; if (!string.IsNullOrEmpty(bddAccess.Information)) { MessageBox.Show(bddAccess.Information, new AssemblyInformations(Assembly.GetExecutingAssembly().GetName().Name).Product, MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK); } } } } } }