Exemplo n.º 1
0
        private void Delete_stand(object sender, RoutedEventArgs e)
        {
            Stand        item      = (sender as Button).Tag as Stand;
            List <Stand> standsTmp = DatabaseHelper.GetStandsByID(this.party.StandsIDs);

            standsTmp.Remove(standsTmp.Find(u => u.StandId == item.StandId));
            this.party.StandsIDs = standsTmp.Select(u => u.StandId.ToString()).ToList();
            int indexRemove = listStands.Items.IndexOf(item);

            listStands.ItemsSource = null;

            listStands.ItemsSource = DatabaseHelper.GetStandsByID(this.party.StandsIDs);
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 3
0
        public bool Initialize(Stand stand, Party party)
        {
            if (stand == null)
            {
                this.result = new Stand();
                isModified  = false;
            }
            else
            {
                this.result = stand;
                isModified  = true;
            }
            this.party = party;
            listEmployee.ItemsSource = DatabaseHelper.GetEmployeesByID(result.EmployeesIDs);
            Main_Grid.DataContext    = this.result;
            if (this.result.ToolIDs.Count() > 0)
            {
                listTools.ItemsSource = DatabaseHelper.GetToolsByID(this.result.ToolIDs);
            }

            return(party.Date.Equals(new DateTime()) || party.ToDate.Equals(new DateTime()) || !party.Accepted);
        }
Exemplo n.º 4
0
 private void Cancel_Click(object sender, RoutedEventArgs e)
 {
     this.result = null;
     dialog.Hide();
 }