Пример #1
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var index        = MainPivot.SelectedIndex;
            var selectedItem = index == 0 ? ListView.SelectedItem : PlantOrderListView.SelectedItem;

            if (selectedItem is PlantOrderModel plantOrder)
            {
                if (index == 1 && DivisionComboBox.SelectedItem is DivisionModel division)
                {
                    var session = new ProjectPlantOrderSession()
                    {
                        PlantOrder = plantOrder, Division = division
                    };
                    await ProductionCollection.Add(session);

                    Division = division;
                    Result   = plantOrder;
                }
                else if (index == 0)
                {
                    var session = ProductionCollection.Find(plantOrder);
                    if (session != null)
                    {
                        Division = session.Division;
                        Result   = session.PlantOrder;
                    }
                }
            }
            else
            {
                args.Cancel = true;
            }
        }
Пример #2
0
        public Task <bool> Remove(ProjectPlantOrderSession session)
        {
            if (PlantOrderSession.Remove(session))
            {
                return(Save());
            }

            return(Task.FromResult(false));
        }
Пример #3
0
        public Task <bool> Add(ProjectPlantOrderSession session)
        {
            if (!PlantOrderSession.Exists(x => x.PlantOrder.Number == session.PlantOrder.Number))
            {
                PlantOrderSession.Add(session);
                return(Save());
            }

            return(Task.FromResult(false));
        }