예제 #1
0
        private async void LoadForm(string transaction, TaxonGenus genus = null)
        {
            GenusForm form = new GenusForm()
            {
                TransactionForm   = transaction,
                GenusData         = (genus == null) ? new TaxonGenus() : genus,
                PrimaryButtonText = (transaction == "Add Genus") ? "Save" : "Update"
            };
            var result = await form.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                string message = "";

                switch (form.TransactionResult)
                {
                case 0:
                    message = (form.TransactionForm == "Add Genus") ? "Genus Inserted to the Database" : "Genus 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()
        {
            msgFamilyName.Visibility = Visibility.Collapsed;
            msgGenusName.Visibility  = Visibility.Collapsed;

            GenusData                 = new TaxonGenus();
            VerifiedGenera            = new TaxonGenus().GetVerifiedGenera();
            cbxFamilyName.ItemsSource = new TaxonFamily().GetFamilyList();

            TransactionForm   = "Add Genus";
            PrimaryButtonText = "Save";
        }