示例#1
0
        private void PreFillVendingMachines()
        {
            VendingMachineTableRecord vmRecord1 = new VendingMachineTableRecord()
            {
                Id            = 1,
                BalanceText   = Balance.TwentyDollar.Encode(),
                Frequency     = 60,
                GrandBalance  = Balance.TwentyDollar.ToString(),
                LastMaintDate = DateTime.Now,
                Manufacturer  = "GE",
                Model         = "VM-x-1",
                StartDate     = DateTime.Now,
                State         = VendingMachineStateEnum.Operational.DisplayName,
            };

            VendingMachineTableRecord vmRecord2 = new VendingMachineTableRecord()
            {
                Id            = 2,
                BalanceText   = Balance.TenDollar.Encode(),
                Frequency     = 45,
                GrandBalance  = Balance.TenDollar.ToString(),
                LastMaintDate = DateTime.Today,
                Manufacturer  = "BH",
                Model         = "VM-x-2",
                StartDate     = DateTime.Today,
                State         = VendingMachineStateEnum.Defect.DisplayName,
            };

            VendingMachineTableRecord vmRecord3 = new VendingMachineTableRecord()
            {
                Id            = 3,
                BalanceText   = Balance.FiveDollar.Encode(),
                Frequency     = 50,
                GrandBalance  = Balance.FiveDollar.ToString(),
                LastMaintDate = DateTime.Today,
                Manufacturer  = "Siemens",
                Model         = "VM-x-3",
                StartDate     = DateTime.Today,
                State         = VendingMachineStateEnum.Operational.DisplayName,
            };

            VendingMachineTableRecord vmRecord4 = new VendingMachineTableRecord()
            {
                Id            = 10,
                BalanceText   = Balance.Cent.Encode(),
                Frequency     = 90,
                GrandBalance  = Balance.Cent.ToString(),
                LastMaintDate = DateTime.Today,
                Manufacturer  = "HMI",
                Model         = "VM-x-100",
                StartDate     = DateTime.Today,
                State         = VendingMachineStateEnum.OnMaintenance.DisplayName,
            };

            VendingMachineRepository vmRepo = new VendingMachineRepository();
            //vmRepo.AddModel(vmRecord1);
            //vmRepo.AddModel(vmRecord2);
            //vmRepo.AddModel(vmRecord3);
            //vmRepo.AddModel(vmRecord4, true);
        }
示例#2
0
 public ViewAViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
     : base(regionManager)
 {
     LoadMoneyCommand = new DelegateCommand(LoadMoney);
     _eventAggregator = eventAggregator;
     Message          = "View A from your Prism Module";
     _repository      = new VendingMachineRepository();
     _vendingMachine  = _repository.GetById(1);
     MoneyInMachine   = _vendingMachine.MoneyInMachine;
 }
示例#3
0
        public ViewSellViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) :
            base(regionManager)
        {
            InsertTenCommand         = new DelegateCommand(() => InsertMoney(Money.TenRupee));
            InsertTwentyCommand      = new DelegateCommand(() => InsertMoney(Money.TwentyRupee));
            InsertFiftyCommand       = new DelegateCommand(() => InsertMoney(Money.FiftyRupee));
            InsertHundredCommand     = new DelegateCommand(() => InsertMoney(Money.HundredRupee));
            InsertFiveHundredCommand = new DelegateCommand(() => InsertMoney(Money.FiveHundredRupee));
            InsertThousandCommand    = new DelegateCommand(() => InsertMoney(Money.ThousandRupee));
            ReturnMoneyCommand       = new DelegateCommand(() => ReturnMoney());
            BuyWineCommand           = new DelegateCommand <string>(BuyWine, WineAvailable);
            eventAggregator.GetEvent <MoneyLoadedEvent>().Subscribe(OnMoneyLoaded);

            _repository     = new VendingMachineRepository();
            _vendingMachine = _repository.GetById(1);
            MoneyInMachine  = _vendingMachine.MoneyInMachine;
        }