public WebsiteHost() { InitializeComponent(); Window = this; if (Properties.Settings.Default.User_AdvancedLogging) { Log.Commit("[WebsiteHost] Loaded."); } }
/// <summary> /// Delete the selected review /// </summary> /// <param name="sender">The button sending the data</param> /// <param name="e">The click</param> private void Delete_Click(object sender, RoutedEventArgs e) { //Check if the user is sure. if (MessageBox.Show("Are you sure you want to delete this review?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { //Do the delete Database.ExQuery("DELETE FROM REVIEWS WHERE ID = '" + ReviewID.Text + "'"); if (Properties.Settings.Default.User_AdvancedLogging) { Log.Commit("[ReviewSingle] Review with ID " + ReviewID.Text + " Deleted."); } MessageBox.Show("Review Deleted!", "Success", MessageBoxButton.OK, MessageBoxImage.Information); string Content = "Reviews"; WebsiteHost.SetContent(Content); } }
/// <summary> /// Sets the content of the main content section of the window. /// </summary> /// <param name="Content">The usercontrol that is to be loaded.</param> public static void SetContent(string Content) { switch (Content) { case "Reviews": //Set the content Window.MainContent.Content = new WebsiteHost(); //Set the toolbar Window.ToolbarContent.Content = new WebsiteToolbar(); //Set the specific content on the host control. WebsiteHost.SetContent(Content); break; case "Costs": Window.MainContent.Content = new FinancesHost(); Window.ToolbarContent.Content = new FinancesToolbar(); FinancesHost.SetContent(Content); break; case "Prices": Window.MainContent.Content = new FinancesHost(); Window.ToolbarContent.Content = new FinancesToolbar(); FinancesHost.SetContent(Content); break; case "Bookings": Window.MainContent.Content = new BookingsHost(); Window.ToolbarContent.Content = new BookingsToolbar(); BookingsHost.SetContent(Content); break; case "ViewCustomers": Window.MainContent.Content = new CustomersHost(); Window.ToolbarContent.Content = new CustomersToolbar(); CustomersHost.SetContent(Content); break; case "Tasks": Window.MainContent.Content = new TasksHost(); Window.ToolbarContent.Content = new TasksToolbar(); TasksHost.SetContent(Content); break; } }
/// <summary> /// For the Add Review box, this uploads the review to the database. /// </summary> /// <param name="sender">The button sending data</param> /// <param name="e">The data being sent, a click</param> private void Add_Click(object sender, RoutedEventArgs e) { //Validate Input if (ReviewField.Text == null || RatingField.Text == null) { MessageBox.Show("Please enter required information.", "ALERT", MessageBoxButton.OK, MessageBoxImage.Information); } else { //Upload Database.ExQuery("INSERT INTO REVIEWS (Review, Rating) VALUES ('" + ReviewField.Text + "', '" + RatingField.Text + "')"); if (Properties.Settings.Default.User_AdvancedLogging) { Log.Commit("[ReviewList:Add] new review inserted."); } var result = MessageBox.Show("Review Added!", "Success", MessageBoxButton.OK, MessageBoxImage.Information); string Content = "Reviews"; WebsiteHost.SetContent(Content); } }
private void Reviews_Click(object sender, RoutedEventArgs e) { string Content = "Reviews"; WebsiteHost.SetContent(Content); }