예제 #1
0
        public void Execute(object parameter)
        {
            PurchaseItem Item = parameter as PurchaseItem;

            CurrentVM.AddPurchase(Item);
            ((App)Application.Current).Currents.CurrentVM = CurrentVM;
        }
예제 #2
0
        public void Execute(object parameter)
        {
            string itemName = parameter as string;

            CurrentVM.UpdateOfferCartList(itemName);
            ((App)Application.Current).Currents.CurrentVM = CurrentVM;
        }
예제 #3
0
        public void Execute(object parameter)
        {
            string itemName = parameter as string;

            CurrentVM.updateGraph(itemName);
            ((App)Application.Current).Currents.CurrentVM = CurrentVM;
        }
예제 #4
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidationManager.Validate(this.LayoutRoot))
            {
                return;
            }
            var floorFacade = new FloorFacade(CPApplication.Current.CurrentPage);

            CurrentVM.FloorMasterSysNo = FloorSectionMaintain.FloorVM.SysNo;

            if (CurrentVM.SysNo.HasValue)
            {
                floorFacade.UpdateFloorSection(CurrentVM, (s, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CurrentWindow.Alert(ResFloorMaintain.Info_EditSuccess);
                    for (int i = 0; i < FloorSectionMaintain.FloorSectionListVM.Count; i++)
                    {
                        if (FloorSectionMaintain.FloorSectionListVM[i].SysNo == CurrentVM.SysNo)
                        {
                            CurrentVM.IsChecked = true;
                            FloorSectionMaintain.FloorSectionListVM[i]        = CurrentVM.DeepCopy();
                            FloorSectionMaintain.SectionTagResult.ItemsSource = FloorSectionMaintain.FloorSectionListVM;
                            break;
                        }
                    }
                });
            }
            else
            {
                floorFacade.CreateFloorSection(CurrentVM, (s, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CurrentVM.SysNo = args.Result;
                    FloorSectionMaintain.FloorSectionListVM.Add(CurrentVM);
                    CurrentWindow.Alert(ResFloorMaintain.Info_CreateSuccess);
                    FloorSectionMaintain.SectionTagResult.ItemsSource = FloorSectionMaintain.FloorSectionListVM;
                });
            }
        }
        public void DeleteItem(IItemViewModel <DataModelType, DataViewModelType> itemVM)
        {
            if (CanDeleteItem())
            {
                ItemsVM.Remove(itemVM);
                var deleteModel  = itemVM.GetItemModel();
                var currentModel = CurrentVM.GetItemModel();

                if (deleteModel.DataModel.Equals(currentModel.DataModel))
                {
                    CurrentVM = null;
                }
                addedAndDelatedItems[deleteModel] = ChangeStatus.Delete;
                Debug.Assert(StateCanChanged != null);
                StateCanChanged(this, new EventArgs());
            }
        }
        public void AddItem()
        {
            if (CanAddItem())
            {
                //создаем IDetailItemViewModel
                var dataItemModel = _itemModelCreator.CreateNewDataModel();
                var itemModel     = _itemModelCreator.CreateItemModel(dataItemModel);

                var detailItemViewModel = _creator.CreateDetailViewModel(itemModel);
                CurrentVM = detailItemViewModel;

                //IItemViewModel
                var itemViewModel = _creator.CreateItemViewModel(itemModel);
                ItemsVM.Add(itemViewModel);

                addedAndDelatedItems[itemModel] = ChangeStatus.Add;

                CurrentVM.Edit();

                Debug.Assert(StateCanChanged != null);
                StateCanChanged(this, new EventArgs());
            }
        }