Ejemplo n.º 1
0
        public void Save(string Fieldedcar_Make, string Fieldedcar_Model, string Fieldedcar_Owner, int Fieldedcar_Year)
        {
            bool isnew = _fieldedCar.CarID == 0;

            DataAccess.UpdateCar(_fieldedCar);
            if (isnew)
            {
                _sortedCars.CommitNew();
                _sortedCars.MoveCurrentTo(_fieldedCar);
            }
            else
            {
                _sortedCars.CommitEdit();
            }
            _carList.Sort();
            _sortedCars.Refresh();
            ScreenEditingMode = false;
        }
        private void RefreshFilter()
        {
            if (this.ItemsSource != null)
            {
                ICollectionView view = CollectionViewSource.GetDefaultView(this.ItemsSource);
                if (view is BindingListCollectionView)
                {
                    BindingListCollectionView blcv = (BindingListCollectionView)view;
                    if (blcv.CanCustomFilter)
                    {
                        if (string.IsNullOrEmpty(FilterPrefix))
                        {
                            blcv.CustomFilter = string.Empty;
                        }
                        else
                        {
                            // Keep the currently selected item in the combobox.
                            object currItem = this.SelectedItem;

                            // Change the filter on the view (which is a RepositoryView)
                            blcv.CustomFilter = "//" + FilterPrefix;

                            // If we have a selected item in the combobox, select it in the view too.
                            if (currItem != null)
                            {
                                // Reselect the previous item
                                blcv.MoveCurrentTo(currItem);
                            }
                        }
                    }
                }
                else
                {
                    view.Refresh();
                }

                //this.IsDropDownOpen = true;
            }
        }
Ejemplo n.º 3
0
        public void Save(bool fieldedService_IsValidState, bool screenEditingMode)
        {
            bool isnew = _fieldedService.ServiceID == 0;

            _fieldedService.ServiceLineList.RemoveAll(SL => SL.Delete != 0);


            DataAccess.UpdateService(_fieldedService);
            if (isnew)
            {
                _sortedServices.CommitNew();
                _sortedServices.MoveCurrentTo(_fieldedService);
            }
            else
            {
                _sortedServices.CommitEdit();
            }
            _serviceList.Sort();
            _sortedServices.Refresh();
            ServiceLines.Refresh();
            NotifyOfPropertyChange(() => CanDelete);
            ScreenEditingMode = false;
        }