public void InstanceOK() { // Create an instance of the class we want to create ClassLibrary.clsCustomerCollection AllCustomers = new ClassLibrary.clsCustomerCollection(); // Test to see that it exists Assert.IsNotNull(AllCustomers); }
public void ListAndCountOK() { // Create an instance of the class we want to create ClassLibrary.clsCustomerCollection AllCustomers = new ClassLibrary.clsCustomerCollection(); // Create some test data to assign to the property // In this case the data needs to be a list of objects List <clsCustomer> TestList = new List <clsCustomer>(); // Add an item to the list // Create the item of test data clsCustomer TestItem = new clsCustomer(); // Set its properties TestItem.AddressNo = 12; TestItem.Address = "Jeff Street"; TestItem.PostCode = "LE40RT"; TestItem.FirstName = "Jeff"; TestItem.Surname = "Jefferson"; TestItem.Email = "*****@*****.**"; TestItem.AccountCreationDate = DateTime.Now.Date; TestItem.IsCustomer = true; TestItem.TotalSpent = 4000; // Add the item to the test list TestList.Add(TestItem); // Assign the data to the property AllCustomers.CustomerList = TestList; // Test to see that the two values are the same Assert.AreEqual(AllCustomers.Count, TestList.Count); }
protected void btnYes_Click(object sender, EventArgs e) { ClassLibrary.clsCustomerCollection Customer = new ClassLibrary.clsCustomerCollection(); Customer.ThisCustomer.Find(CustomerNo); Customer.Delete(); Response.Redirect("CustomerList.aspx"); }
protected void BtnConfirm_Click(object sender, EventArgs e) { ClassLibrary.clsCustomerCollection custcollect = new ClassLibrary.clsCustomerCollection(); lblError.Text = "HELP"; //store data in varaibales string UserName = TxtLogin.Text; string Password = txtPassword.Text; try { bool logintrue = custcollect.login(UserName, Password); if (logintrue == true) { Response.Redirect("CustomerHome.aspx"); } else { lblError.Text = "Login Failed"; } } catch { lblError.Text = "Your login was unsuccessful. Try again."; } }
void DisplayCustomers() { ClassLibrary.clsCustomerCollection AllCustomers = new ClassLibrary.clsCustomerCollection(); lstCustomerList.DataSource = AllCustomers.CustomerList; lstCustomerList.DataValueField = "ProductNo"; lstCustomerList.DataTextField = "Address"; lstCustomerList.DataBind(); }
void DisplayCustomers() { ClassLibrary.clsCustomerCollection AllCustomers = new ClassLibrary.clsCustomerCollection(); lstCustomerList.DataSource = AllCustomers.CustomerList; lstCustomerList.DataValueField = "CustomerID"; lstCustomerList.DataTextField = "FullName"; lstCustomerList.DataBind(); }
void DisplayCustomers() { //create an instance of the address collection ClassLibrary.clsCustomerCollection Customers = new ClassLibrary.clsCustomerCollection(); //set the data source to the list of addresses in the collection lstCustomerList.DataSource = Customers.CustomerList; //set the name of the primary key lstCustomerList.DataValueField = "CustomerId"; //set the data field to display lstCustomerList.DataTextField = "Username"; //bind the data to the list lstCustomerList.DataBind(); }
bool login(string UserName, string Password) { ClassLibrary.clsCustomerCollection custcollection = new ClassLibrary.clsCustomerCollection(); bool logintrue = custcollection.login(UserName, Password); if (logintrue == true) { return(true); } else { return(false); } }
string add() { ClassLibrary.clsCustomerCollection Acustomer = new ClassLibrary.clsCustomerCollection(); Acustomer.ThisCustomer.firstname = txtFirstName.Text; Acustomer.ThisCustomer.lastname = txtLastName.Text; Acustomer.ThisCustomer.emailaddress = txtEmailAddress.Text; Acustomer.ThisCustomer.mobilenumber = txtContactMobileNumber.Text; Acustomer.ThisCustomer.addressName = txtHouseDoorNumber.Text; Acustomer.ThisCustomer.streetname = txtStreetName.Text; Acustomer.ThisCustomer.cityname = txtCityName.Text; Acustomer.ThisCustomer.postcode = txtPostCode.Text; Acustomer.ThisCustomer.cardnumber = txtCardNumber.Text; Acustomer.ThisCustomer.expirydate = Convert.ToDateTime(txtExpiryDate.Text).Date; Acustomer.ThisCustomer.secruitycode = txtSecurityCode.Text; Acustomer.ThisCustomer.username = txtUserName.Text; Acustomer.ThisCustomer.password = txtPassword.Text; string customerid = Acustomer.Add().ToString(); return(customerid); }
public void ThisCustomerPropertyOK() { // Create an instance of the class we want to create ClassLibrary.clsCustomerCollection AllCustomers = new ClassLibrary.clsCustomerCollection(); // Create some test data to assign to the property clsCustomer TestCustomer = new clsCustomer(); // Set the properties of the test object TestCustomer.AddressNo = 12; TestCustomer.Address = "Jeff Street"; TestCustomer.PostCode = "LE40RT"; TestCustomer.FirstName = "Jeff"; TestCustomer.Surname = "Jefferson"; TestCustomer.Email = "*****@*****.**"; TestCustomer.AccountCreationDate = DateTime.Now.Date; TestCustomer.IsCustomer = true; TestCustomer.TotalSpent = 4000; // Assign the data to the property AllCustomers.ThisCustomer = TestCustomer; // Test to see that the two values are the same Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer); }