public void UpdateMethodOK()
        {
            //create the instance of the class we want to create
            clsPaymentCollection AllPayments = new clsPaymentCollection();
            //create some test data to assign to the property
            clsPayment TestItem = new clsPayment();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set the properties of the test object
            TestItem.PaymentId     = 1;
            TestItem.PayeeName     = "Samsung OLED TV";
            TestItem.Amount        = 3999.99m;
            TestItem.CardNumber    = "111111111111111";
            TestItem.Method        = "Debit";
            TestItem.DatePurchased = DateTime.Now.Date;
            TestItem.Email         = "*****@*****.**";
            //set ThisPayment to the test data
            AllPayments.ThisPayment = TestItem;
            //add the record
            PrimaryKey = AllPayments.Add();
            //set the primary key to the test data
            TestItem.PaymentId = PrimaryKey;
            //modify the test data
            TestItem.PaymentId     = 1;
            TestItem.PayeeName     = "George Milkin";
            TestItem.Amount        = 5555.55m;
            TestItem.CardNumber    = "4444444444444444";
            TestItem.Method        = "MasterCard";
            TestItem.DatePurchased = DateTime.Now.Date;
            TestItem.Email         = "*****@*****.**";
            //assign the new data to the property
            AllPayments.ThisPayment = TestItem;
            //update the record
            AllPayments.Update();
            //find the record
            AllPayments.ThisPayment.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllPayments.ThisPayment, TestItem);
        }
        public void Update()
        {
            //create an instance of the Inventory Collection
            clsPaymentCollection AllPayments = new clsPaymentCollection();
            //validate the data on the Windows Form
            string Error = AllPayments.ThisPayment.Valid(txtPayeeName.Text, Convert.ToString(comboBoxMethod.SelectedItem), txtAmount.Text, txtCardNumber.Text, txtDatePurchased.Text, txtEmail.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //find the record to UPDATE
                AllPayments.ThisPayment.Find(mPaymentId);

                //get the data entered by the user
                AllPayments.ThisPayment.PayeeName     = txtPayeeName.Text;
                AllPayments.ThisPayment.Amount        = Convert.ToDecimal(txtAmount.Text);
                AllPayments.ThisPayment.Method        = Convert.ToString(comboBoxMethod.Text);
                AllPayments.ThisPayment.DatePurchased = Convert.ToDateTime(txtDatePurchased.Text);
                AllPayments.ThisPayment.Email         = txtEmail.Text;
                AllPayments.ThisPayment.CardNumber    = Convert.ToString(txtCardNumber.Text);



                //UPDATE the record
                AllPayments.Update();
                //All Done so Redirect to the previous Form
                PaymentManageForm PM = new PaymentManageForm();
                this.Hide();
                PM.ShowDialog();
                this.Close();
            }
            else
            {
                lblError.Text = "There were problems with the data entered: " + Error;
            }
        }