public OpenBDDWindow(Teacher teacher) { InitializeComponent(); BDDAccess bddAccess = new BDDAccess(); if (bddAccess.Connect()) { activities = bddAccess.GetActivities(teacher); if (!string.IsNullOrEmpty(bddAccess.Information)) { MessageBox.Show(bddAccess.Information, new AssemblyInformations(Assembly.GetExecutingAssembly().GetName().Name).Product, MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK); return; } foreach (Activity activite in activities) { ActivitesListBox.Items.Add(activite.ActivityName); } } else { MessageBox.Show(bddAccess.Information, new AssemblyInformations(Assembly.GetExecutingAssembly().GetName().Name).Product, MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK); } }
public ActivitiesWindow(Teacher teacher) { InitializeComponent(); this.teacher = teacher; BDDAccess bddAccess = new BDDAccess(); if (bddAccess.Connect()) { activities = bddAccess.GetActivities(teacher); ActivitiesListView.ItemsSource = activities; CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(ActivitiesListView.ItemsSource); view.Filter = ActivityFilter; } else { MessageBox.Show(bddAccess.Information, new AssemblyInformations(Assembly.GetExecutingAssembly().GetName().Name).Product, MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK); isClosed = true; Close(); } }
public OpenBDD() { InitializeComponent(); BDDAccess bddAccess = new BDDAccess(); if (bddAccess.Connect()) { activities = bddAccess.GetActivities(new Teacher() { FirstName = "Vincent", LastName = "RAPIN" }); if (!string.IsNullOrEmpty(bddAccess.Information)) { MessageBox.Show(bddAccess.Information, "Studio des Langues", MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK); return; } foreach (Activity activite in activities) { ActivitesListBox.Items.Add(activite.ActivityName); } } else { MessageBox.Show(bddAccess.Information, "Studio des Langues", MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK); } }
private void RefreshButton_Click(object sender, RoutedEventArgs e) { BDDAccess bddAccess = new BDDAccess(); if (bddAccess.Connect()) { activities = bddAccess.GetActivities(teacher); ActivitiesListView.ItemsSource = activities; CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(ActivitiesListView.ItemsSource); view.Filter = ActivityFilter; } }
public ActionResult NewActivities() { BDDAccess bddAccess = new BDDAccess(); List <Activity> activities = new List <Activity>(); if (bddAccess.Connect(Path.Combine(Server.MapPath("~").ToString(), "bdd.bin"))) { if (bddAccess.Information != null && bddAccess.Information != "") { ViewBag.Erreur = bddAccess.Information; return(View("Error")); } if (Session["User"] == null) { Users users = Users.Load(Path.Combine(Server.MapPath("~"), "credential", User.Identity.GetUserName() + ".credential")); Session["User"] = users[0]; } 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]) } }; activities = bddAccess.GetActivities(student, ActivitiesVisibility.Visible); } else { ViewBag.Error = bddAccess.Information; return(View("Error")); } return(View(activities)); }