public MainViewModel(IBikingService bikingService) { LoadUsers = ReactiveCommand.CreateFromTask(bikingService.GetUsers); users = LoadUsers.ToProperty(this, model => model.Users); bikes = this.WhenAnyValue(model => model.SelectedUser) .SelectMany(u => bikingService.GetBikes(u.Id)) .ToProperty(this, model => model.Bikes); }
public UsersViewModel(IBikingService bikingService) { LoadUsers = ReactiveCommand.CreateFromTask(bikingService.GetUsers); users = LoadUsers .Select(us => us.Select(user => new UserViewModel(user, bikingService)).ToList()).ToProperty(this, model => model.Users); isBusy = LoadUsers.IsExecuting.ToProperty(this, vm => vm.IsBusy); selectedBike = MessageBus.Current.Listen <Bike>() .Select(bike => new BikeViewModel(bike, bikingService)) .ToProperty(this, model => model.SelectedBike); }
/// <summary> /// Form Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Pharmacist_Load(object sender, EventArgs e) { DateExpiry.MinDate = DateTime.Now.Date; //Set Minimum Expiry Date to Todays Date foreach (Users LoadUsers in ParentListHolder.UserList) //For Every User in the User List { if (LoadUsers.GetUserStatus() == ListHolder.Usertype.Pharmacist) //If User is a Pharmacist /""/ { PharmaCombo.Items.Add(LoadUsers.GetUsername()); //If your a pharmacist } } ReadToDoPrescriptionsFile(); //Read In Prescriptions to Process ReadPrescriptionsFile(); //Read In Prescription to Collect #region Check if more than 24 hours have gone by foreach (Prescription prescript in ParentListHolder.FinalPrescriptionList) //For Every Prescription that needs collecting { string dateissued = prescript.GetDateIssued(); //Get Date Issued DateTime date = Convert.ToDateTime(dateissued); //Convert to Date Format if (date.Add(TimeSpan.FromDays(1)) < DateTime.Today.Date && prescript.GetCompleted() == "Not Completed") //If It Has Not Been Collected { MessageBox.Show(prescript.GetPatientName() + ": " + prescript.GetDateIssued() + " Prescription has not been collected please return items to stock"); //Show Message int ItemCount = 0; //Counter foreach (string itemname in prescript.ItemName) //For every Item in Prescription { DodgyBobStockControl.StockControl.DO("'" + itemname + "' restock " + prescript.Quantity[ItemCount] + " please"); //Return items to stock ItemCount++; //Next Item } if (DodgyBobStockControl.StockControl.SAVE() == true) //Save stock update { ParentListHolder.FinalPrescriptionList.Remove(prescript); //Delete Prescription WritePrescription(); //this should remove any prescriptions that are out of date } } #endregion UpdatePrescriptionsToCollect(); //Update Prescription to Collect XML file } }
public MainViewModel(IBikingService bikingService) { LoadUsers = ReactiveCommand.CreateFromTask(() => bikingService.GetUsers()); users = LoadUsers.ToProperty(this, model => model.Users); }
public void ClearState() { Workflows = new ObservableCollection <QueryWorkflowVM>(); Usernames = new ObservableCollection <string>(); LoadUsers.Execute(this); }