Example #1
0
        private async void Add_StandList(object sender, RoutedEventArgs e)
        {
            MyCustomStands dial = new MyCustomStands();

            if (dial.Initialize(null, this.party))
            {
                Utilities.ShowDial("Veuillez spécifier les dates et accepter l'event avant de procéder au stand");
            }
            else
            {
                await dial.ShowAsync();

                if (dial.result != null)
                {
                    while (dial.displayEmployees)
                    {
                        using (var db = new PartyContext())
                        {
                            List <Person> employees = db.employees.ToList <Person>();
                            MyCustomContentDialogEmployee dialEmployee = new MyCustomContentDialogEmployee();
                            dialEmployee.Initialize(employees);
                            await dialEmployee.ShowAsync();

                            HashSet <String> toBeAdded        = new HashSet <String>(dialEmployee.Result.Select(u => u.PersonId.ToString()).ToList());
                            HashSet <String> currentEmployees = new HashSet <String>(dial.result.EmployeesIDs);

                            if (currentEmployees != null)
                            {
                                toBeAdded.UnionWith(currentEmployees);
                            }
                            dial.result.EmployeesIDs = toBeAdded.ToList();
                            dial.BlitEmployees();
                            await dial.ShowAsync();
                        }
                    }
                    HashSet <String> currentStands = new HashSet <String>(this.party.StandsIDs);
                    currentStands.Add(dial.result.StandId.ToString());
                    this.party.StandsIDs = currentStands.ToList();

                    listStands.ItemsSource = null;
                    Debug.WriteLine("sss " + dial.result.StandId.ToString());
                    listStands.ItemsSource = DatabaseHelper.GetStandsByID(currentStands.ToList());
                }
            }
        }
Example #2
0
        private async void Item_Stand_Click(object sender, ItemClickEventArgs e)
        {
            Stand item = (Stand)e.ClickedItem;

            if (item != null)
            {
                MyCustomStands dial = new MyCustomStands();
                if (dial.Initialize(item, this.party))
                {
                    Utilities.ShowDial("Veuillez spécifier les dates avant de procéder au stand");
                }
                else
                {
                    await dial.ShowAsync();

                    while (dial.displayEmployees)
                    {
                        using (var db = new PartyContext())
                        {
                            List <Person> employees = db.employees.ToList <Person>();
                            MyCustomContentDialogEmployee dialEmployee = new MyCustomContentDialogEmployee();
                            dialEmployee.Initialize(employees);
                            await dialEmployee.ShowAsync();

                            HashSet <String> toBeAdded        = new HashSet <String>(dialEmployee.Result.Select(u => u.PersonId.ToString()).ToList());
                            HashSet <String> currentEmployees = new HashSet <String>(dial.result.EmployeesIDs);

                            if (currentEmployees != null)
                            {
                                toBeAdded.UnionWith(currentEmployees);
                            }
                            dial.result.EmployeesIDs = toBeAdded.ToList();
                            dial.BlitEmployees();
                            await dial.ShowAsync();
                        }
                    }
                    listStands.ItemsSource = null;
                    listStands.ItemsSource = DatabaseHelper.GetStandsByID(this.party.StandsIDs);
                }
            }
        }