private void Add_new_category(object sender, RoutedEventArgs e) { string category_name = AddCategoryDialogCategoryName.Text; if (DatabaseHandler.Sanitize_string(category_name)) { if (category_name == "Category") { InvalidInputDialog invalid_input_dialog = new InvalidInputDialog(); invalid_input_dialog.Set_msg("Invalid category name"); invalid_input_dialog.ShowDialog(); return; } if (DatabaseHandler.Category_exists(GlobalVariables.temporary_file_path, category_name) != true) { this.category_name = category_name; this.success = true; this.Close(); } } else { InvalidInputDialog invalid_input_dialog = new InvalidInputDialog(); invalid_input_dialog.Set_msg("Are you using any ilegal chars ('!@#$%^&*()_+=,./\";:[]{}\\|)?"); invalid_input_dialog.ShowDialog(); } }
private bool Verify_category() { string category = SearchCategoryButton.Content.ToString(); if (DatabaseHandler.Sanitize_string(category)) { if (DatabaseHandler.Category_exists(GlobalVariables.temporary_file_path, category)) { return(true); } } else { // put here SQL injection detected dialog } return(false); }
private bool Verify_category() { string category = EditRegistryDialogCategoryButton.Content.ToString(); if (DatabaseHandler.Sanitize_string(category)) { if (DatabaseHandler.Category_exists(GlobalVariables.temporary_file_path, category)) { this.Category = category; return true; } } else { // put here SQL injection detected dialog } return false; }