private void Checkout() { //Update the status of the selected laptop if (LaptopToEdit != null) { Laptop updatedLaptop = new Laptop(); updatedLaptop = LaptopToEdit; // Clone all the unchanging fields (the new loan dates are included) updatedLaptop.PL_User_SOEID = SelectedUser.SOEID; updatedLaptop.PL_Checked_IN = LaptopStatus.CheckedOut; //The PL_Checked_IN field is how the Ardvarc DB stores laptop status updatedLaptop.PL_Updated_By = Environment.UserName; repository.UpdateLaptop(LaptopToEdit.Hostname, updatedLaptop); //create a new Transaction and add it to the Audit table Transaction newTransaction = new Transaction(); newTransaction.Hostname = laptopToEdit.Hostname; newTransaction.Date_Time = DateTime.Now; newTransaction.Status = TransactionStatus.LoanedOut; newTransaction.CheckedOutTo = SelectedUser.SOEID; newTransaction.Serial = laptopToEdit.Serial; newTransaction.Updated_By = Environment.UserName; repository.AddTransaction(newTransaction); //Publish a message that the status bar is listening for eventAggregator.GetEvent <LaptopUpdatedEvent>().Publish(String.Format("Laptop {0} checked Out.", laptopToEdit.Hostname)); //Navigate back to Pool Laptops View var uri = new Uri(typeof(PoolLaptopsView).FullName, UriKind.Relative); regionManager.RequestNavigate(RegionNames.ContentRegion, uri); } }
private void UpdateLaptop() { repository.UpdateLaptop(this.LaptopToEdit.Hostname, LaptopToEdit); LaptopToEdit = null; var uri = new Uri(AllLaptopsViewKey, UriKind.Relative); this.regionManager.RequestNavigate(RegionNames.ContentRegion, uri); }