Beispiel #1
0
        public LaptopSearchVM()
        {
            ViewDetails   = Visibility.Hidden;
            ListPhoto     = new List <Photo>();
            ListPhotoView = (CollectionView)CollectionViewSource.GetDefaultView(ListPhoto);

            this.HardisksView   = (CollectionView)CollectionViewSource.GetDefaultView(dal.Hardisks);
            this.RamsView       = (CollectionView)CollectionViewSource.GetDefaultView(dal.Rams);
            this.ProccesorsView = (CollectionView)CollectionViewSource.GetDefaultView(dal.Proccessors);
            this.LcdsView       = (CollectionView)CollectionViewSource.GetDefaultView(dal.Lcds);

            IDataCollection <producent> pr = new ProducentCollections();

            this.ProducentView = (CollectionView)CollectionViewSource.GetDefaultView(pr.GetData());

            SearchCommand = new CommandHandler {
                CanExecuteAction = SearchValiation, ExecuteAction = SearchAction
            };



            //data
            this.Source     = new ObservableCollection <computer>();
            this.SourceView = (CollectionView)CollectionViewSource.GetDefaultView(this.Source);
            this.Clear();
        }
Beispiel #2
0
        public AddHandphoneVM(ChangeStatus status, ObservableCollection <handphone> source, CollectionView sourceView, handphone selectedItem)
        {
            var        date = DateTime.Now.Year;
            List <int> list = new List <int>();

            for (var i = date; i > date - 10; i--)
            {
                list.Add(i);
            }

            Tahuns = (CollectionView)CollectionViewSource.GetDefaultView(list);


            this.status       = status;
            this.source       = source;
            this.sourceView   = sourceView;
            this.selectedItem = selectedItem;


            this.StoregeView         = (CollectionView)CollectionViewSource.GetDefaultView(dal.Storages);
            this.StoregeExternalView = (CollectionView)CollectionViewSource.GetDefaultView(dal.Storages);
            this.MemoryView          = (CollectionView)CollectionViewSource.GetDefaultView(dal.Rams);
            this.CameraBackView      = (CollectionView)CollectionViewSource.GetDefaultView(dal.CamBacks);
            this.CameraFrontView     = (CollectionView)CollectionViewSource.GetDefaultView(dal.CamFronts);
            this.OsView = (CollectionView)CollectionViewSource.GetDefaultView(dal.OSs);


            IDataCollection <producent> pr = new ProducentCollections();

            this.ProducentView = (CollectionView)CollectionViewSource.GetDefaultView(pr.GetData());

            SaveCommand = new CommandHandler {
                CanExecuteAction = SaveValidation, ExecuteAction = SaveAction
            };


            if (status == ChangeStatus.Edit)
            {
                this.Id            = selectedItem.Id;
                this.Memory        = selectedItem.Memory;
                this.Name          = selectedItem.Name;
                this.Price         = selectedItem.Price;
                this.ProducentId   = selectedItem.ProducentId;
                this.CameraBack    = selectedItem.CameraBack;
                this.CameraFront   = selectedItem.CameraFront;
                this.Os            = selectedItem.Os;
                this.ProducentId   = selectedItem.ProducentId;
                this.ProducentName = selectedItem.ProducentName;
                this.Storage       = selectedItem.Storage;
            }
        }
Beispiel #3
0
        public AddComputerVM(ChangeStatus status, ObservableCollection <computer> source, CollectionView sourceView, computer selectedItem)
        {
            var dal = new DataLayer();

            var        date = DateTime.Now.Year;
            List <int> list = new List <int>();

            for (var i = date; i > date - 10; i--)
            {
                list.Add(i);
            }

            Tahuns = (CollectionView)CollectionViewSource.GetDefaultView(list);



            this.HardisksView   = (CollectionView)CollectionViewSource.GetDefaultView(dal.Hardisks);
            this.RamsView       = (CollectionView)CollectionViewSource.GetDefaultView(dal.Rams);
            this.ProccesorsView = (CollectionView)CollectionViewSource.GetDefaultView(dal.Proccessors);
            this.LcdsView       = (CollectionView)CollectionViewSource.GetDefaultView(dal.Lcds);

            IDataCollection <producent> pr = new ProducentCollections();

            this.ProducentView = (CollectionView)CollectionViewSource.GetDefaultView(pr.GetData());
            this.source        = source;
            this.sourceView    = sourceView;
            this.selectedItem  = selectedItem;
            this.status        = status;

            SaveCommand = new CommandHandler {
                CanExecuteAction = SaveValidation, ExecuteAction = SaveAction
            };

            if (status == ChangeStatus.Edit)
            {
                this.Hardisk       = selectedItem.Hardisk;
                this.Id            = selectedItem.Id;
                this.LCD           = selectedItem.LCD;
                this.Memory        = selectedItem.Memory;
                this.Name          = selectedItem.Name;
                this.Price         = selectedItem.Price;
                this.Proccesor     = selectedItem.Proccesor;
                this.ProducentId   = selectedItem.ProducentId;
                this.ProducentName = this.ProducentName;
                this.Series        = this.Series;
            }
        }