/// <summary> /// Direct the user to the next page (Thank you page). /// @Author Ameet and Karanbir /// Grabs user from mainwindow, adds Drive information and adds service. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void nextPage_Click(object sender, RoutedEventArgs e) { MainWindow mainWindow = Application.Current.MainWindow as MainWindow; User user = mainWindow.getUser(); //Add Drive info to user user.addDrive(myVehicleType, myCapacity, myStartTime, myEndTime, myFilePath); //Add driving service to user Service service = new Service(user.getName(), user.getEmail()); service.setServiceType(ServiceTypes.Drive); service.setDonationRequest(DonationTypes.Goods); service.setDescription("Driving goods."); user.addService(service); UserDatabase.updateDatabase(); ServiceDatabase serviceDatabase = mainWindow.GetServiceDatabase(); serviceDatabase.createService(ServiceTypes.Drive, DonationTypes.Goods, user, service); IInputElement target = NavigationHelper.FindFrame("ListPage1", this); NavigationCommands.GoToPage.Execute("/ThankYou.xaml", target); }
public InformationPage() { /// Set vehicle field options. @Author Karanbir InitializeComponent(); nextPage.IsEnabled = false; List <String> vehicles = new List <String>(); vehicles.Add("Sedan"); vehicles.Add("Truck"); vehicles.Add("SUV"); vehicles.Add("Compact"); vehicleList.ItemsSource = vehicles; vehicleList.SelectedIndex = 0; myVehicleType = string.Empty; myCapacity = string.Empty; myStartTime = string.Empty; myEndTime = string.Empty; myFilePath = string.Empty; UserDatabase.updateDatabase(); MainWindow mainWindow = Application.Current.MainWindow as MainWindow; User user = mainWindow.getUser(); if (user.getLicenseFilePath() != null) { if (!user.getLicenseFilePath().Equals(string.Empty)) { nextPage.IsEnabled = true; textBlock1.Text = user.getLicenseFilePath(); } } }
/// <summary> /// Sets the User's address. /// </summary> /// <param name="street">The User's street.</param> /// <param name="apartment">The User's apartment number.</param> /// <param name="city">The User's city.</param> /// <param name="state">The User's state.</param> /// <param name="zipcode">The User's zipcode.</param> public void setAddress(String street, String apartment, String city, String state, String zipcode) { myStreet = street; myApartment = apartment; myCity = city; myState = state; myZipCode = zipcode; UserDatabase.updateDatabase(); }
/// <summary> /// Adds the User's Drive information. /// </summary> /// <param name="type">The User's vehichle type.</param> /// <param name="capacity">The User's vehicle capacity.</param> /// <param name="start">The User's start time.</param> /// <param name="stop">The User's stop time.</param> /// <param name="filePath">The file path for the User's license photo.</param> public void addDrive(String type, String capacity, String start, String stop, String filePath) { myVehichleType = type; myCapacity = capacity; myTimeStart = start; myTimeStop = stop; myLicenseFilePath = filePath; UserDatabase.updateDatabase(); }
/// <summary> /// Submits imformation to the UserDatabase. /// @Author Charlton & Karanbir /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void signUpSubmit_Click(object sender, EventArgs e) { if (myPassword1.Equals(myPassword2)) { this.Close(); main.Show(); User toAdd = new User(myName, myPassword1, myEmail, myAddress, myAppartment, myCity, myState, myZip); USER_DATABASE.addUser(toAdd); UserDatabase.updateDatabase(); main.setUser(toAdd); } else { errorTextBox.Text = "Passwords don't match!"; } }
/// <summary> /// Author: Karanbir Toor /// Opens the file browser to let the user choose the file to upload. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_Click(object sender, RoutedEventArgs e) { //Process.Start(@"c:\"); @Karan // Create OpenFileDialog Microsoft.Win32.OpenFileDialog dialogue = new Microsoft.Win32.OpenFileDialog(); // Set filter for file extension and default file extension dialogue.DefaultExt = ".jpg"; dialogue.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg"; // Display OpenFileDialog by calling ShowDialog method bool?result = dialogue.ShowDialog(); MainWindow mainWindow = Application.Current.MainWindow as MainWindow; User user = mainWindow.getUser(); // Get the selected file name and display in a TextBox if (result == true) { // Open document string filename = dialogue.FileName; String[] temp = filename.Split('\\'); textBlock1.Text = temp[temp.Length - 1]; myFilePath = filename; user.setLicenseFilePath(filename); UserDatabase.updateDatabase(); } if (user.getLicenseFilePath() != null) { if (!user.getLicenseFilePath().Equals(string.Empty)) { nextPage.IsEnabled = true; } } }
/// <summary> /// Adds the Service object to the list of the User's services. /// </summary> /// <param name="service">The Service object.</param> public void addService(Service service) { myServices.Add(service); UserDatabase.updateDatabase(); }
/// <summary> /// Sets the file path for the User's licence photo. /// </summary> /// <param name="licence">The file path.</param> public void setLicenseFilePath(String licence) { myLicenseFilePath = licence; UserDatabase.updateDatabase(); }
/// <summary> /// Sets the User's stop time. /// </summary> /// <param name="stop">The User's stop time.</param> public void setTimeStop(String stop) { myTimeStop = stop; UserDatabase.updateDatabase(); }
/// <summary> /// Sets the User's start time. /// </summary> /// <param name="start">The User's start time.</param> public void setTimeStart(String start) { myTimeStart = start; UserDatabase.updateDatabase(); }
/// <summary> /// Sets the User's vehicle capacity. /// </summary> /// <param name="capacity">The user's vehicle capacity.</param> public void setCapacity(String capacity) { myCapacity = capacity; UserDatabase.updateDatabase(); }
/// <summary> /// Sets the User's vehicle type. /// </summary> /// <param name="type">The User's vehichle type.</param> public void setVehicleType(String type) { myVehichleType = type; UserDatabase.updateDatabase(); }
/// <summary> /// Sets if user is admin. /// </summary> /// <param name="admin">Boolean value if user is admin or not.</param> public void setAdmin(Boolean admin) { myAdmin = admin; UserDatabase.updateDatabase(); }
/// <summary> /// Sets the User's email address. /// </summary> /// <param name="email">The User's email address.</param> public void setEmail(String email) { myEmail = email; UserDatabase.updateDatabase(); }
/// <summary> /// Sets the User's password. /// </summary> /// <param name="password">The new password.</param> public void setPassword(String password) { myPassword = password; UserDatabase.updateDatabase(); }
/// <summary> /// Sets the User's real name. /// </summary> /// <param name="name">The User's real name</param> public void setName(String name) { myName = name; UserDatabase.updateDatabase(); }