Example #1
0
        public void ListAndCountOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestCustomer = new clsCustomer();
            Int32 PK = 0;

            List <clsCustomer> TestList = new List <clsCustomer>();

            TestCustomer.HouseNo     = 1;
            TestCustomer.HouseCounty = "Leicestershire";
            TestCustomer.PostCode    = "ABCDE";
            TestCustomer.HouseStreet = "1 main street";
            TestCustomer.EMail       = "*****@*****.**";
            TestCustomer.FirstName   = "John";
            TestCustomer.LastName    = "Smith";
            TestCustomer.PhoneNo     = "1234567";
            TestCustomer.Password    = "******";

            AllCustomers.ThisCustomer = TestCustomer;

            PK = AllCustomers.Add();

            AllCustomers.CustomerList = TestList;

            Assert.AreEqual(AllCustomers.Count, TestList.Count);
        }
Example #2
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.Name        = "Wallace Breen";
            TestItem.DateOfBirth = new DateTime(1955, 2, 20);
            TestItem.Address     = "8 Citadel Road";
            TestItem.Email       = "*****@*****.**";
            TestItem.IsMember    = true;

            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey          = AllCustomers.Add();
            TestItem.CustomerId = PrimaryKey;

            TestItem.Name        = "Wallace Breen";
            TestItem.DateOfBirth = new DateTime(1955, 2, 20);
            TestItem.Address     = "17 City Street";
            TestItem.Email       = "*****@*****.**";
            TestItem.IsMember    = false;

            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Example #3
0
        public void AddMethodOK()
        {
            //create an instance of the class
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.FirstName   = "Komal";
            TestItem.HouseNumber = "20";
            TestItem.DOB         = DateTime.Now.Date;
            TestItem.PhoneNo     = "07867543762";
            TestItem.PostCode    = "LE5 6HY";
            TestItem.StreetName  = "Star City";
            TestItem.Surname     = "Mukesh";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key
            TestItem.CustomerID = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection Allcustomers = new clsCustomerCollection();
            //create the items of the test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.ActiveOK           = true;
            TestItem.CustomerID         = 1;
            TestItem.CustomerFirstName  = "Zad";
            TestItem.CustomerLastName   = "Ali";
            TestItem.CustomerNumber     = "123456789";
            TestItem.CustomerAddress    = "20 Austen Avenue";
            TestItem.CustomerPostCodeOK = "Ng7 6PE";
            TestItem.CustomerEmail      = "*****@*****.**";
            TestItem.DateAddedOK        = DateTime.Now.Date;
            //set ThisCustomer to the test data
            Allcustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = Allcustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerID = PrimaryKey;
            //find the record
            Allcustomers.ThisCustomer.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(Allcustomers.ThisCustomer, TestItem);
        }
Example #5
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create a the item of the test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Active       = true;
            TestItem.CustomerID   = 1;
            TestItem.DOB          = DateTime.Now.AddYears(-19);
            TestItem.EmailAddress = "*****@*****.**";
            TestItem.FirstName    = "John";
            TestItem.LastName     = "James";
            TestItem.PhoneNo      = "01234567891";
            TestItem.PostCode     = "LO8 18H";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerID = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Example #6
0
        public void DeleteMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.Username          = "******";
            TestItem.CustomerFirstName = "John";
            TestItem.CustomerLastName  = "Smith";
            TestItem.CustomerEmail     = "";
            TestItem.CustomerAddress   = "123 Some Street";
            TestItem.CustomerTelephone = "01163480420";
            AllCustomers.ThisCustomer  = TestItem;
            PrimaryKey = AllCustomers.Add();
            //assign the data to the property
            TestItem.CustomerID = PrimaryKey;
            //
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //
            AllCustomers.Delete();
            //test to see that the two values are the same
            bool Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            //
            Assert.IsFalse(Found);
        }
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.CurrentOrder            = true;
            TestItem.CustomerNo              = 1;
            TestItem.CustomerName            = "Jeff";
            TestItem.CustomerEmail           = "*****@*****.**";
            TestItem.CustomerShippingAddress = "23 Doe Zone";
            TestItem.CustomerBillingAddress  = "23 Doe Zone";
            TestItem.DateWhenJoined          = DateTime.Now.Date;
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerNo = PrimaryKey;
            //modify the test data
            TestItem.CurrentOrder            = false;
            TestItem.CustomerNo              = 6;
            TestItem.CustomerName            = "Jeffyy";
            TestItem.CustomerEmail           = "*****@*****.**";
            TestItem.CustomerShippingAddress = "32 Doe Zone";
            TestItem.CustomerBillingAddress  = "32 Doe Zone";
            AllCustomers.ThisCustomer        = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Example #8
0
        public void UpdateMethodOK()
        {
            //create instance of class
            clsCustomerCollection collection = new clsCustomerCollection();
            //create item
            clsCustomer testCustomer = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set properties
            testCustomer.cusAccountStatus = true;
            testCustomer.cusDateRegister  = DateTime.Now;
            testCustomer.cusEmail         = "*****@*****.**";
            testCustomer.cusName          = "Name McNotChanged";
            testCustomer.cusPassword      = "******";
            //set thisCustomer to the test data
            collection.ThisCustomer = testCustomer;
            //add the record
            PrimaryKey = collection.Add();
            //set the primary key of the test data
            testCustomer.cusId = PrimaryKey;
            //modify the test data
            testCustomer.cusEmail         = "*****@*****.**";
            testCustomer.cusName          = "Name McChanged";
            testCustomer.cusPassword      = "******";
            testCustomer.cusAccountStatus = false;
            //set the record based on the new test data
            collection.ThisCustomer = testCustomer;
            //update the record
            collection.Update();
            //find the record
            collection.ThisCustomer.Find(PrimaryKey);
            //test compare
            Assert.AreEqual(collection.ThisCustomer, testCustomer);
        }
Example #9
0
        public void addMethodOK()
        {
            //create an instance of the class
            clsCustomerCollection collection = new clsCustomerCollection();

            //clear the collection (as collection will contain database records in construction as suggested)
            collection.clear();
            //create item of test data
            clsCustomer customer = new clsCustomer();
            //var to store the customer's ID (primary key from database)
            Int32 PrimaryKey = 0;

            //set its properties
            customer.cusId            = 1000;
            customer.cusName          = "Rodney Dangerfield";
            customer.cusEmail         = "*****@*****.**";
            customer.cusPassword      = "******";
            customer.cusAccountStatus = true;
            customer.cusDateRegister  = DateTime.Now.Date;
            //set ThisCustomer to test data
            collection.ThisCustomer = customer;
            //add the data
            PrimaryKey = collection.Add();
            //set the primary key of the test data
            customer.cusId = PrimaryKey;
            //compare
            Assert.AreEqual(collection.ThisCustomer, customer);
        }
Example #10
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomer = new clsCustomerCollection("Fbloggs");
            //create an instance of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store primary key
            Int32 PK = 0;

            //set the properties
            //TestItem.CustomerID = 3;
            TestItem.FirstName     = "fred";
            TestItem.Surname       = "bloggs";
            TestItem.dateOfBirth   = DateTime.Now.Date.AddYears(-19);
            TestItem.Gender        = "male";
            TestItem.ContactNumber = "01167";
            TestItem.EMail         = "*****@*****.**";
            TestItem.HouseNo       = "2";
            TestItem.PostCode      = "LE5 6HP";
            TestItem.Title         = "Mr";
            //TestItem.UserName = "******";
            //set ThisCustomer to validate test data
            AllCustomer.ThisCustomer = TestItem;
            //add the record
            PK = AllCustomer.Add();
            //set primary key of test data
            TestItem.Id = PK;
            //find the record
            AllCustomer.ThisCustomer.Find(PK);
            //test to see that it exists
            Assert.AreEqual(AllCustomer.ThisCustomer, TestItem);
        }
    protected void btnOK_Click1(object sender, EventArgs e)
    {
        clsCustomer AnCustomer             = new clsCustomer();
        string      CustomerName           = txtCustomerName.Text;
        string      CustomerEmail          = txtCustomerEmail.Text;
        string      CustomerBillingAdress  = txtCustomerBillingAddress.Text;
        string      CustomerShippingAdress = txtCustomerShippingAddress.Text;
        string      DateWhenJoined         = txtDateWhenJoined.Text;
        string      Error = "";

        Error = AnCustomer.Valid(CustomerName, CustomerEmail, CustomerShippingAdress, CustomerBillingAdress, DateWhenJoined);
        if (Error == "")
        {
            AnCustomer.CustomerName            = CustomerName;
            AnCustomer.CustomerEmail           = CustomerEmail;
            AnCustomer.CustomerShippingAddress = CustomerShippingAdress;
            AnCustomer.CustomerBillingAddress  = CustomerBillingAdress;
            AnCustomer.DateWhenJoined          = Convert.ToDateTime(DateWhenJoined);
            clsCustomerCollection CustomerList = new clsCustomerCollection();
            AnCustomer.CurrentOrder   = chkAnyCurrentOrders.Checked;
            CustomerList.ThisCustomer = AnCustomer;
            CustomerList.Add();
            Response.Redirect("CustomerList.aspx");
        }
        else
        {
            lblError.Text = Error;
        }
    }
        public void AddMethodOK()
        {
            //create instance of clsCustomerCollection
            clsCustomerCollection AllCustomers = new clsCustomerCollection();

            //create test data
            clsCustomer TestItem = new clsCustomer();

            //var to store primary key
            Int32 PrimaryKey = 0;

            //set properties of TestCustomer
            TestItem.CustomerId            = 7;
            TestItem.CustomerName          = "Seventh Person";
            TestItem.CustomerEmail         = "*****@*****.**";
            TestItem.CustomerPassword      = "******";
            TestItem.CustomerCardNumber    = "3249751097492094";
            TestItem.CustomerCreationDate  = DateTime.Now.Date;
            TestItem.CustomerAccountStatus = true;

            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;

            //add the record
            PrimaryKey = AllCustomers.Add();

            //set the primary key of the test data
            TestItem.CustomerId = PrimaryKey;

            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);

            //test to see if the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomer = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 Primarykey = 0;

            //set its properties
            TestItem.Membership   = true;
            TestItem.CustomerID   = 9;
            TestItem.FirstName    = "Maitri";
            TestItem.LastName     = "Sanjiu";
            TestItem.Address      = "10 Gipsy Lane Leicester LE3 ^HG";
            TestItem.MobileNumber = 91168542625;
            TestItem.Date         = Convert.ToDateTime("15/06/1990");
            //set ThisCustomer to the test ata
            AllCustomer.ThisCustomer = TestItem;
            //add the record
            Primarykey = AllCustomer.Add();
            //set the primary key of the test data
            TestItem.CustomerID = Primarykey;
            //find the record
            AllCustomer.ThisCustomer.Find(Primarykey);
            //test to set that the two vaues are the same
            Assert.AreEqual(AllCustomer.ThisCustomer, TestItem);
        }
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomer = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 Primarykey = 0;

            //set its properties
            TestItem.Membership   = true;
            TestItem.CustomerID   = 7;
            TestItem.FirstName    = "Roshni";
            TestItem.LastName     = "Tandel";
            TestItem.Address      = "34 Belper Street Leicester LE6 7HG";
            TestItem.MobileNumber = 074586456;
            TestItem.Date         = Convert.ToDateTime("17/02/1993");
            //set ThisCustomer to the test data
            AllCustomer.ThisCustomer = TestItem;
            //add the record
            Primarykey = AllCustomer.Add();
            //set the primary key of the test data
            TestItem.CustomerID = Primarykey;
            //find the record
            AllCustomer.Delete();
            //noe find the record
            Boolean Found = AllCustomer.ThisCustomer.Find(Primarykey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomer = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Active     = true;
            TestItem.CustomerID = 4;
            TestItem.CountyNo   = 4;
            TestItem.PhoneNo    = 122222784;
            TestItem.PostCode   = "LE3 72C";
            TestItem.Street     = "Charles Street";
            TestItem.FirstName  = "Mila";
            TestItem.SurName    = "Nod";
            TestItem.HouseNo    = "4";
            TestItem.Email      = "*****@*****.**";
            //set ThisCustomer to the test data
            AllCustomer.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomer.Add();
            //set the primary key of the test data
            TestItem.CustomerID = PrimaryKey;
            //find the record
            AllCustomer.ThisCustomer.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomer.ThisCustomer, TestItem);
        }
Example #16
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection collection = new clsCustomerCollection();
            //create list item
            clsCustomer customer = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set properties
            customer.cusName     = "Rodney Dangerfield";
            customer.cusEmail    = "*****@*****.**";
            customer.cusPassword = "******";
            //set ThisCustomer to the test data
            collection.ThisCustomer = customer;
            //add record
            PrimaryKey = collection.Add();
            //find the record
            collection.ThisCustomer.Find(PrimaryKey);
            //delete the record via PrimaryKey
            collection.ThisCustomer.Delete(PrimaryKey);
            //find the record (should return false)
            Boolean Found = collection.ThisCustomer.Find(PrimaryKey);

            //compare
            Assert.IsFalse(Found);
        }
Example #17
0
        public void AddMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.ActiveAcc        = true;
            TestItem.CustomerID       = 1;
            TestItem.CustomerPwd      = "eRRor!2";
            TestItem.FirstName        = "Bruno";
            TestItem.LastName         = "Ribeiro";
            TestItem.DateOfBirth      = DateTime.Now.Date.AddYears(-18);
            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey                = AllCustomers.Add();
            TestItem.CustomerID       = PrimaryKey;
            TestItem.ActiveAcc        = false;
            TestItem.CustomerID       = 2;
            TestItem.CustomerPwd      = "eRRor!3";
            TestItem.FirstName        = "Andre";
            TestItem.LastName         = "Silva";
            TestItem.DateOfBirth      = DateTime.Now.Date.AddYears(-18);
            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Registration = true;
            TestItem.CustomerID   = 1;
            TestItem.Email        = "some email";
            TestItem.Password     = "******";
            TestItem.FirstName    = "some name";
            TestItem.SurName      = "some surname";
            TestItem.Gender       = "Male";
            TestItem.DateOfBirth  = DateTime.Now.Date;
            TestItem.PhoneNumber  = "07953641257";
            TestItem.Address      = "some address";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerID = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Example #19
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.Username          = "******";
            TestItem.CustomerFirstName = "John";
            TestItem.CustomerLastName  = "Smith";
            TestItem.CustomerEmail     = "";
            TestItem.CustomerAddress   = "123 Some Street";
            TestItem.CustomerTelephone = "01163480420";
            AllCustomers.ThisCustomer  = TestItem;
            PrimaryKey = AllCustomers.Add();
            //assign the data to the property
            TestItem.CustomerID = PrimaryKey;
            //
            TestItem.Username          = "******";
            TestItem.CustomerFirstName = "Stephen";
            TestItem.CustomerLastName  = "Coulade";
            TestItem.CustomerEmail     = "*****@*****.**";
            TestItem.CustomerAddress   = "456 Different Street";
            TestItem.CustomerTelephone = "01557347020";
            //
            AllCustomers.ThisCustomer = TestItem;
            //
            AllCustomers.Update();
            //test to see that the two values are the same
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Example #20
0
    //function for Adding records
    void Add()
    {
        //create an instance of the booking list
        clsCustomerCollection CList = new clsCustomerCollection(User.Identity.Name);
        //validate the data on the web form
        //string foreName, string surname, string dateOfBirth, string gender, string contactNumber, string eMail, string flatNo, string houseNo, string postCode
        String Error = CList.ThisCustomer.Valid(txtForename.Text, txtSurname.Text, txtDateOfBirth.Text, txtGender.Text, txtContactNumber.Text, txtEmail.Text, txtFlatNo.Text, txtHouseNumber.Text, txtPostCode.Text);

        //if the data is OK then add it to the object
        if (Error == "")
        {
            //get the data entered by the user
            CList.ThisCustomer.Surname       = txtSurname.Text;
            CList.ThisCustomer.ForeName      = txtForename.Text;
            CList.ThisCustomer.dateOfBirth   = Convert.ToDateTime(txtDateOfBirth.Text);
            CList.ThisCustomer.HouseNo       = txtHouseNumber.Text;
            CList.ThisCustomer.FlatNo        = txtFlatNo.Text;
            CList.ThisCustomer.PostCode      = txtPostCode.Text;
            CList.ThisCustomer.Gender        = txtGender.Text;
            CList.ThisCustomer.ContactNumber = txtContactNumber.Text;
            CList.ThisCustomer.EMail         = txtEmail.Text;
            //CList.ThisCustomer.UserName = User.Identity.Name;
            //update the record
            CList.Add();
            //all done so redirect back to the main page
            Response.Redirect("AdminHomepage.aspx");
        }
        else
        {
            //report an error
            lblError.Text = "There were problems with the data entered " + Error;
        }
    }
        public void AddMethodOK()
        {
            //create instance of the class we want to create
            clsCustomerCollection AllCustomer = new clsCustomerCollection();
            //create the item of the test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.CurrentOrder            = true;
            TestItem.CustomerNo              = 1;
            TestItem.CustomerName            = "Jeff";
            TestItem.CustomerEmail           = "*****@*****.**";
            TestItem.CustomerShippingAddress = "23 Doe Zoo";
            TestItem.CustomerBillingAddress  = "23 Doe Zoo";
            TestItem.DateWhenJoined          = DateTime.Now.Date;
            //set ThisCustomer to the test data
            AllCustomer.ThisCustomer = TestItem;
            //Add the record
            PrimaryKey = AllCustomer.Add();
            //set the primary key of the test data
            TestItem.CustomerNo = PrimaryKey;
            //find the record
            AllCustomer.ThisCustomer.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomer.ThisCustomer, TestItem);
        }
Example #22
0
    //function for adding new records
    void Add()
    {
        //create an instance of the address book
        clsCustomerCollection Customers = new clsCustomerCollection();
        //validate the data on the web form
        Boolean OK = Customers.ThisCustomer.Valid(TxtFirstName.Text, TxtSurname.Text, TxtAddress1.Text, TxtAddress2.Text, TxtPostcode.Text, TxtPhoneNumber.Text, TxtEmail.Text);

        //if the data is OK then add it to the object
        if (OK == true)
        {
            //get the data entered by the user
            Customers.ThisCustomer.FirstName   = TxtFirstName.Text;
            Customers.ThisCustomer.Surname     = TxtSurname.Text;
            Customers.ThisCustomer.Address1    = TxtAddress1.Text;
            Customers.ThisCustomer.Address2    = TxtAddress2.Text;
            Customers.ThisCustomer.Postcode    = TxtPostcode.Text;
            Customers.ThisCustomer.PhoneNumber = TxtPhoneNumber.Text;
            Customers.ThisCustomer.Email       = TxtEmail.Text;
            //add the record
            Customers.Add();
        }
        else
        {
            //report an error
            LblError.Text = "There were problems with the data entered";
        }
    }
        public void DeleteMethodOK()
        {
            //Create an instance of the class
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //Var to store the primary key
            Int32 PrimaryKey = 0;

            //Set its properties
            TestItem.CustomerID         = 1;
            TestItem.CustomerAddress    = "20 Austen Avenue";
            TestItem.CustomerEmail      = "*****@*****.**";
            TestItem.CustomerFirstName  = "zad";
            TestItem.CustomerLastName   = "ali";
            TestItem.CustomerPostCodeOK = "NG7 6PE";
            TestItem.CustomerNumber     = "123456789";
            TestItem.ActiveOK           = true;
            TestItem.DateAddedOK        = DateTime.Now.Date;
            //set this repair to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerID = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //Delete the record
            AllCustomers.Delete();
            //Now find the record
            Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            //Test to see if the two values are the same
            Assert.IsFalse(Found);
        }
Example #24
0
 public void AddMethodOK()
 {
     //create an instanceof the clas we watn to create
     clsCustomerCollection AllCustomers = new clsCustomerCollection();
     //create the item of test data
     clsCustomer TestItem = new clsCustomer();
     //var to streo the primary key
     Int32 PrimaryKey = 0;
     //set its properties
     TestItem.Active = true;
     TestItem.CustomerID = 1;
     TestItem.CustomerFirstName = "First";
     TestItem.CustomerLastName = "Last";
     TestItem.CustomerEmail = "*****@*****.**";
     TestItem.CustomerTeleNo = "XXXXXXXXXX";
     //set thiscustomer to thetest data
     AllCustomers.ThisCustomer = TestItem;
     //add the record
     PrimaryKey = AllCustomers.Add();
     //find the record
     TestItem.CustomerID = PrimaryKey;
     //find the record
     AllCustomers.ThisCustomer.Find(PrimaryKey);
     //test to see that the teo valies are the same
     Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
 }
Example #25
0
        public void AddMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();

            clsCustomers TestItem = new clsCustomers();

            Int32 PrimaryKey = 0;

            TestItem.active      = true;
            TestItem.customer_id = 1;
            TestItem.first_name  = "Bilbo";
            TestItem.last_name   = "Baggins";
            TestItem.email       = "*****@*****.**";
            TestItem.create_date = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;

            PrimaryKey = AllCustomers.Add();

            TestItem.customer_id = PrimaryKey;

            AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
Example #26
0
 public void DeleteMethodOK()
 {
     //create an instanceof the clas we watn to create
     clsCustomerCollection AllCustomers = new clsCustomerCollection();
     //create the item of test data
     clsCustomer TestItem = new clsCustomer();
     //var to streo the primary key
     Int32 PrimaryKey = 0;
     //set its properties
     TestItem.Active = true;
     TestItem.CustomerID = 1;
     TestItem.CustomerFirstName = "First";
     TestItem.CustomerLastName = "Last";
     TestItem.CustomerEmail = "*****@*****.**";
     TestItem.CustomerTeleNo = "XXXXXXXXXX";
     //set thiscustomer to thetest data
     AllCustomers.ThisCustomer = TestItem;
     //add the record
     PrimaryKey = AllCustomers.Add();
     //find the record
     TestItem.CustomerID = PrimaryKey;
     AllCustomers.ThisCustomer.Find(PrimaryKey);
     //delete the record
     AllCustomers.Delete();
     //now find the record
     Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);
     //test to see that the record was not found
     Assert.IsFalse(Found);
 }
Example #27
0
        public void DeleteMethod()
        {
            //create and instance of the class
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.CustomerID  = 1;
            TestItem.Name        = "Tommy";
            TestItem.Phone       = "0734642344";
            TestItem.Email       = "*****@*****.**";
            TestItem.Username    = "******";
            TestItem.Password    = "******";
            TestItem.PaymentType = "Debit Card";
            TestItem.SecurityMsg = "ball";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerID = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //delete the record
            AllCustomers.Delete();
            //now find the record
            Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Example #28
0
        public void AddMethodOk()
        {
            //create an instance of the class we want to create
            clsCustomerCollection ACustomer = new clsCustomerCollection();
            //create the item of test data
            clsCustomerDetails TestItem = new clsCustomerDetails();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.customerid   = 5;
            TestItem.username     = "******";
            TestItem.password     = "******";
            TestItem.firstname    = "Upesh";
            TestItem.lastname     = "Chavda";
            TestItem.emailaddress = "*****@*****.**";
            TestItem.mobilenumber = "07754885553";
            TestItem.cardnumber   = "02365153439";
            TestItem.secruitycode = "454";
            TestItem.expirydate   = DateTime.Now.Date;
            TestItem.addressName  = "44A";
            TestItem.streetname   = "Newarke Close";
            TestItem.cityname     = "Leicester";
            TestItem.postcode     = "LE2 7GZ";
            //set this ThisCustomer to the test data
            ACustomer.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = ACustomer.Add();
            //set the primary key of the test data
            TestItem.customerid = PrimaryKey;
            //find the record
            ACustomer.ThisCustomer.Find(PrimaryKey);
            //test to see if the two values are the same
            Assert.AreEqual(ACustomer.ThisCustomer, TestItem);
        }
Example #29
0
        public void DeleteMethodOK()
        {
            //create an instance of the class
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.FirstName   = "Komal";
            TestItem.HouseNumber = "20";
            TestItem.DOB         = DateTime.Now.Date;
            TestItem.PhoneNo     = "07867543762";
            TestItem.PostCode    = "LE5 6HY";
            TestItem.StreetName  = "Star City";
            TestItem.Surname     = "Mukesh";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key
            TestItem.CustomerID = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //delete the record
            AllCustomers.Delete();
            //now find tyhe record
            Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Example #30
0
        public void DeleteMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();

            //TestItem.Active = true;
            TestItem.ProductNo   = 1;
            TestItem.PhoneNumber = "100000000000";
            TestItem.FullName    = "Bob Smith";
            TestItem.Email       = "*****@*****.**";
            TestItem.CustomerID  = 1;
            TestItem.Date        = DateTime.Now.Date;
            TestItem.Address     = "9 Hamilton Road LE5 J3D";
            TestItem.OrderNo     = 1;
            Int32 PrimaryKey = 1;

            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey         = AllCustomers.Add();
            TestItem.ProductNo = PrimaryKey;
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            AllCustomers.Delete();
            Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }