Exemplo n.º 1
0
        } // LoyaltyAccountSearch_Button_Click

        private void SaveLoyaltyAccount_Button_Click(object sender, EventArgs e)
        {
            // Get the text entered into the text boxes.
            try
            {
                // Buffer to store text
                string AccountName  = AddAccountName_Textbox.Text.ToString();
                string EmailAddress = AddEmailAddress_Textbox.Text.ToString();

                if (String.IsNullOrWhiteSpace(AccountName) || String.IsNullOrWhiteSpace(EmailAddress))
                {
                    MessageBox.Show("Not All Fields Filled In!", "Save Loyalty Account", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    // connect to DB if it is not connected
                    if (!nsadb.Connected())
                    {
                        nsadb.OpenConnection();
                    }

                    // Get the loyalty account data from the database
                    nsadb.ManagerSaveLoyaltyAccount(AccountName, EmailAddress);

                    // Inform User that Account was successfully Created.
                    MessageBox.Show("Loyalty Account Created - " + EmailAddress + ".", "Save Loyalty Account", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Save Loyalty Account", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        } // SaveLoyaltyAccount_Button_Click