private async void LoadForm(string transaction, TaxonOrder order = null) { OrderForm form = new OrderForm() { TransactionForm = transaction, OrderData = (order == null) ? new TaxonOrder() : order, PrimaryButtonText = (transaction == "Add Order") ? "Save" : "Update" }; var result = await form.ShowAsync(); if (result == ContentDialogResult.Primary) { string message = ""; switch (form.TransactionResult) { case 0: message = (form.TransactionForm == "Add Order") ? "Order Inserted to the Database" : "Order Updated in the Database"; break; case 1: message = "The System had run to an Error"; break; case 2: message = "Information is Already Exists in the Database"; break; } MessageDialog dialog = new MessageDialog(message); await dialog.ShowAsync(); this.InitializePage(); } }
private void ClearForm() { msgClassName.Visibility = Visibility.Collapsed; msgOrderName.Visibility = Visibility.Collapsed; OrderData = new TaxonOrder(); VerifiedOrders = new TaxonOrder().GetVerifiedOrders(); cbxClassName.ItemsSource = new TaxonClass().GetClassList(); TransactionForm = "Add Order"; PrimaryButtonText = "Save"; }