//Adds the customer to the database given the information
        private void CreateButton_Click(object sender, EventArgs e)
        {
            //The database needs a first and last name, so the function will not continue
            if (!first || !last)
            {
                MessageBox.Show("Please Enter a First and Last name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Create a customer object with a new transaction history
            Customer nCust = new Customer();
            nCust.history = new List<Transaction>();

            //Create a first time transaction
            Transaction initTrans = new Transaction();

            //Sets the customer's name
            nCust.first = FirstText.Text;
            nCust.last = LastText.Text;

            //Adds optional information
            if (middle)
                nCust.middle = MiddleText.Text;
            if (DCI)
                nCust.DCINum = DCIText.Text;
            else
                nCust.DCINum = "N/A";

            //Gets the starting credit and current time
            Decimal.TryParse(InitText.Text.Remove(0, 1), out nCust.credit);
            Decimal.TryParse(pText.Text.Remove(0, 1), out nCust.promo);
            initTrans.date = DateTime.Now;

            //Sets the reason for the intial transaction
            initTrans.reason = "Created Account - C: " + nCust.credit.ToString("C") + " P: " + nCust.promo.ToString("C");
            initTrans.type = Transaction.Seperation.newCustomer;
            initTrans.amount = "";

            //Adds the transaction to the customer's history
            nCust.history.Add(initTrans);

            //Loads the database
            List<Customer> custList = MainWin.load();

            //Adds the customer to the database
            custList.Add(nCust);

            //Sorts the database to be alphabetical
            custList.Sort(delegate(Customer c1, Customer c2) { return c1.last.CompareTo(c2.last); });

            //Saves the database
            MainWin.save(custList);

            //Process was okay
            DialogResult = DialogResult.OK;

            //Close the window
            this.Close();
        }
 //Gets and Sets for customer
 public void setCustomer(Customer customer)
 {
     cust = customer;
 }
 public History(Customer customer)
 {
     InitializeComponent();
     cust = customer;
 }