public void PaymentListOK() { //create an istance of the class we want to create clsPaymentCollection AllPayments = new clsPaymentCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsPayment> TestList = new List <clsPayment>(); //add an item to the list //create the item of test data clsPayment TestItem = new clsPayment(); //set its properties TestItem.Active = true; TestItem.PaymentNo = 111344455; TestItem.FirstName = "Ben"; TestItem.Surname = "Stark"; TestItem.CarID = "C12321"; TestItem.EmployeeID = "EM13243"; TestItem.Description = "MOT"; TestItem.DateTime = DateTime.Now.Date; TestItem.Cost = 50.00; //add the item to the test List TestList.Add(TestItem); //assign the data to the property AllPayments.PaymentList = TestList; //test the see that the two values are the same Assert.AreEqual(AllPayments.PaymentList, TestList); }
public void AddMethodOK() { //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 = "Jack Daniel"; TestItem.Amount = 8888.88m; TestItem.CardNumber = "555555555555555"; TestItem.Method = "MasterCard"; 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; //assign the data to the property AllPayments.ThisPayment = TestItem; //test to see that the two values are the same Assert.AreEqual(AllPayments.ThisPayment, TestItem); }
public void DeleteMethodOK() { //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 = 7; 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; //find the record AllPayments.ThisPayment.Find(PrimaryKey); //delete the record AllPayments.Delete(); //now find the record Boolean Found = AllPayments.ThisPayment.Find(PrimaryKey); //test to see that the two values are the same Assert.IsFalse(Found); }
void Add() { //create an instance of the Inventory Collenction clsPaymentCollection AllPayments = new clsPaymentCollection(); //validate the data on the web 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 == "") { //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); //add the record AllPayments.Add(); //all done so redirect back to the main page PaymentManageForm PM = new PaymentManageForm(); this.Hide(); PM.ShowDialog(); this.Close(); } else { //report an error lblError.Text = "Following Errors : " + Error; } }
void Add() { //create an instance of the Payment Collenction clsPaymentCollection AllPayments = new clsPaymentCollection(); //validate the data on the web form string Error = AllPayments.ThisPayment.Valid(txtName.Text, Convert.ToString(DDListMethod.SelectedItem), txtOrderTotal.Text, txtCardNumber.Text, txtDatePurchased.Text, txtEmail.Text); //if the data is OK then add it to the object if (Error == "") { //get the data entered by the user AllPayments.ThisPayment.PayeeName = txtName.Text; AllPayments.ThisPayment.CardNumber = txtCardNumber.Text; AllPayments.ThisPayment.Method = Convert.ToString(DDListMethod.SelectedItem); AllPayments.ThisPayment.Amount = Convert.ToDecimal(txtOrderTotal.Text); AllPayments.ThisPayment.DatePurchased = Convert.ToDateTime(txtDatePurchased.Text); AllPayments.ThisPayment.Email = Convert.ToString(txtEmail.Text); //add the record AllPayments.Add(); } else { //report an error lblError.Text = "There were problems with the data entered : " + Error; } }
public void InstanceOK() { //create an istance of the class we want to create clsPaymentCollection AllPayments = new clsPaymentCollection(); //test to see that is exists Assert.IsNotNull(AllPayments); }
public void TwoRecordsPresent() { //create an istance of the class we want to create clsPaymentCollection AllPayments = new clsPaymentCollection(); //test to see that the two class we want to create Assert.AreEqual(AllPayments.Count, 2); }
public void CountPropertyOK() { //create an istance of the class we want to create clsPaymentCollection AllPayments = new clsPaymentCollection(); //create some test data to assign to the property Int32 SomeCount = 2; //assinn the data to the property AllPayments.Count = SomeCount; //test to see that the two values are the same Assert.AreEqual(AllPayments.Count, SomeCount); }
void DeleteInventory() { //function to delete the selected record //create an instance of the Inventory List clsPaymentCollection AllPayments = new clsPaymentCollection(); //find the record to delete AllPayments.ThisPayment.Find(mPaymentId); //delete the record AllPayments.Delete(); }
Int32 DisplayPayments(string EmailFilter) { clsPaymentCollection AllPayments = new clsPaymentCollection(); AllPayments.ReportByEmail(EmailFilter); //set the data source to the list of Inventories in the collection lstPayments.DataSource = AllPayments.PaymentList; //set the name of the primary Key lstPayments.ValueMember = "PaymentId"; //set the data field to display lstPayments.DisplayMember = "AllDetails"; return(AllPayments.Count); }
public void DisplayPayment() { //create an instance of the Inventory Collection clsPaymentCollection AllPayments = new clsPaymentCollection(); //find the record from the database to UPDATE AllPayments.ThisPayment.Find(mPaymentId); //Display the data for this record txtPaymentId.Text = AllPayments.ThisPayment.PaymentId.ToString(); txtPayeeName.Text = AllPayments.ThisPayment.PayeeName; txtAmount.Text = AllPayments.ThisPayment.Amount.ToString(); txtCardNumber.Text = AllPayments.ThisPayment.CardNumber.ToString(); txtDatePurchased.Text = AllPayments.ThisPayment.DatePurchased.ToString(); txtEmail.Text = AllPayments.ThisPayment.Email; comboBoxMethod.SelectedItem = AllPayments.ThisPayment.Method; }
public void ThisPaymentProperyOK() { //create the instance of the class we want to create clsPaymentCollection AllPayments = new clsPaymentCollection(); //create some test data to assign to the property clsPayment TestPayment = new clsPayment(); //set the properties of the test object TestPayment.PaymentId = 1; TestPayment.PayeeName = "Samsung OLED TV"; TestPayment.Amount = 3999.99m; TestPayment.CardNumber = "111111111111111"; TestPayment.Method = "Debit"; TestPayment.DatePurchased = DateTime.Now.Date; TestPayment.Email = "*****@*****.**"; //assign the data to the property AllPayments.ThisPayment = TestPayment; //test to see that the two values are the same Assert.AreEqual(AllPayments.ThisPayment, TestPayment); }
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 ThisPaymentPropertyOK() { //create an istance of the class we want to create clsPaymentCollection AllPayments = new clsPaymentCollection(); //create some test data to assign to the property //create the item of test data clsPayment TestItem = new clsPayment(); //set its properties of the object TestItem.PaymentNo = 11344455; TestItem.FirstName = "Ben"; TestItem.Surname = "Stark"; TestItem.CarID = "C12321"; TestItem.EmployeeID = "EM13243"; TestItem.Description = "MOT"; TestItem.DateTime = DateTime.Now.Date; TestItem.Cost = 50.00; //assign the data to the property AllPayments.ThisPayment = TestPayment; //test the see that the two values are the same Assert.AreEqual(AllPayments.ThisPayment, TestPayment); }
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; } }
private void btnOK_Click(object sender, EventArgs e) { clsPaymentCollection AllPayments = new clsPaymentCollection(); string Error = AllPayments.ThisPayment.Valid(txtPayeeName.Text, Convert.ToString(comboBoxMethod.SelectedItem), txtAmount.Text, txtCardNumber.Text, txtDatePurchased.Text, txtEmail.Text); string message = "Are you sure to Update the existing Payment details?"; string caption = "User Confirmation!"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; //Displays the MessageBox //if there are no Errors returned if (Error == "") { //show the Message box result = MessageBox.Show(message, caption, buttons); //if "Yes" is pressed if (result == DialogResult.Yes) { //execute the Update method Update(); //All Done so Redirect to the previous Form PaymentManageForm PM = new PaymentManageForm(); this.Hide(); PM.ShowDialog(); this.Close(); } } else { //report an error lblError.Text = "There were problems with the data entered : " + Error; } }