예제 #1
0
    //function for adding new record
    void Update()
    {
        //create an instance of the customer log
        clsCustomerCollection CustomerLog = new clsCustomerCollection();
        //validate the data on the web form
        string Error = CustomerLog.ThisCustomer.Valid(txtFirstName.Text, txtSurname.Text, txtEmail.Text, txtStreet.Text, txtPostCode.Text, txtHouseNo.Text, txtPhoneNo.Text, txtDateSold.Text);

        //if the data is OK then add it to the object
        if (Error == "")
        {
            //find the record to update
            CustomerLog.ThisCustomer.Find(CustomerNo);
            //get the data entered by the user
            CustomerLog.ThisCustomer.FirstName = txtFirstName.Text;
            CustomerLog.ThisCustomer.Surname   = txtSurname.Text;
            CustomerLog.ThisCustomer.Email     = txtEmail.Text;
            CustomerLog.ThisCustomer.Street    = txtStreet.Text;
            CustomerLog.ThisCustomer.PostCode  = txtPostCode.Text;
            CustomerLog.ThisCustomer.Town      = ddlTown.Text;
            CustomerLog.ThisCustomer.HouseNo   = txtHouseNo.Text;
            CustomerLog.ThisCustomer.PhoneNo   = txtPhoneNo.Text;
            CustomerLog.ThisCustomer.DateSold  = Convert.ToDateTime(txtDateSold.Text);
            CustomerLog.ThisCustomer.Active    = chkActive.Checked;
            //update the record
            CustomerLog.Update();
            //all done so redirect to main page
            Response.Redirect("DefaultCustomer.aspx");
        }
        else
        {
            //report an error
            lblError.Text = "There were problems with the data you entered" + Error;
        }
    }
예제 #2
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);
        }
예제 #3
0
        public void UpdateMethodOK()
        {
            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;

            TestItem.active      = false;
            TestItem.customer_id = 3;
            TestItem.first_name  = "abc";
            TestItem.last_name   = "efg";
            TestItem.email       = "*****@*****.**";
            TestItem.create_date = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;

            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #4
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);
        }
예제 #5
0
    //function for updateing records
    void Update()
    {
        //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)
        {
            //Customers.ThisCustomer.Find(CustomerNo);
            //get the data entered by the user
            Customers.ThisCustomer.CustomerNo  = CustomerNo;
            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.Update();
            //redirect
        }
        else
        {
            //report an error
            LblError.Text = "There were problems with the data entered";
        }
    }
    private void Update()
    {
        clsCustomerCollection ACustomer = new clsCustomerCollection();
        Boolean Ok = ACustomer.ThisCustomer.Valid(1, txtCityName.Text, txtHouseDoorNumber.Text, txtPostCode.Text, txtStreetName.Text, txtCardNumber.Text, txtEmailAddress.Text, Convert.ToDateTime(txtExpiryDate), txtFirstName.Text, txtLastName.Text, txtContactMobileNumber.Text, txtSecurityCode.Text, txtUserName.Text, txtPassword.Text);

        if (Ok == true)
        {
            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);
            ACustomer.ThisCustomer.secruitycode = txtSecurityCode.Text;
            ACustomer.Update();
        }
        else
        {
            lblError.Text = "there were problems with the data entered";
        }
    }
예제 #7
0
    void Update()
    {
        //create an instance ofthe collection class
        clsCustomerCollection CustomerCollection = new clsCustomerCollection();
        clsDataConnection     DB = new clsDataConnection();
        //validate the data on the web form
        String Error = CustomerCollection.ThisCustomer.Valid(txtFirstName.Text, txtLAstName.Text, txtDateOfBirth.Text, txtEmail.Text, txtPassword.Text, txtHouseNo.Text, txtStreet.Text, txtTown.Text, txtPostCode.Text);

        //if the data is ok the add it to the object
        if (Error == "")
        {
            //find the record to update
            CustomerCollection.ThisCustomer.Find(CustomerID);
            //get the data entered by the user
            CustomerCollection.ThisCustomer.FirstName   = txtFirstName.Text;
            CustomerCollection.ThisCustomer.LastName    = txtLAstName.Text;
            CustomerCollection.ThisCustomer.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text);
            CustomerCollection.ThisCustomer.Email       = txtEmail.Text;
            CustomerCollection.ThisCustomer.Password    = txtPassword.Text;
            CustomerCollection.ThisCustomer.HouseNo     = txtHouseNo.Text;
            CustomerCollection.ThisCustomer.Street      = txtStreet.Text;
            CustomerCollection.ThisCustomer.Town        = txtTown.Text;
            CustomerCollection.ThisCustomer.PostCode    = txtPostCode.Text;
            //updatethe record
            CustomerCollection.Update();
            ClearTextBoxes();
            lblError.Text = "Your account has been updated.";
        }
        else
        {
            //report an error
            lblError.Text = "There were problems with the data entered " + Error;
        }
    }
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            int PrimaryKey = 0;

            TestItem.Name              = "Joe,Bloggs";
            TestItem.Address           = "2 Random Street,RandomTown,RandomCounty,RN27FT";
            TestItem.Email             = "*****@*****.**";
            TestItem.Password          = "******";
            TestItem.Marketing_emails  = false;
            TestItem.Registration_date = DateTime.Now.Date;

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

            TestItem.Customer_id       = PrimaryKey;
            TestItem.Name              = "Jane,Bloggs";
            TestItem.Address           = "5 Random Street,RandomTown,RandomCounty,RN27FT";
            TestItem.Email             = "*****@*****.**";
            TestItem.Password          = "******";
            TestItem.Marketing_emails  = false;
            TestItem.Registration_date = DateTime.Now.Date.AddDays(1);

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

            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);

            AllCustomers.Delete();
        }
예제 #9
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.Over18          = true;
            TestItem.CustomerID      = 1;
            TestItem.CustomerPayment = "Siren Ocean etc.";
            TestItem.CustomerAddress = "Western Road";
            TestItem.SignUpDate      = DateTime.Now.Date;
            TestItem.DateOfBirth     = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;

            PrimaryKey               = AllCustomers.Add();
            TestItem.CustomerID      = PrimaryKey;
            TestItem.Over18          = true;
            TestItem.CustomerID      = 1;
            TestItem.CustomerPayment = "Siren Ocean etc.";
            TestItem.CustomerAddress = "Western Road";
            TestItem.SignUpDate      = DateTime.Now.Date;
            TestItem.DateOfBirth     = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
    void Update()
    {
        //create an instance of the customer class
        clsCustomerCollection Customers = new clsCustomerCollection();
        //validate the data on the web form
        String Error = Customers.ThisCustomer.Valid(txtTitle.Text, txtForeName.Text, txtLastName.Text, txtCustomerEmail.Text, txtPhoneNo.Text, txtDateAdded.Text);

        //if the data is OK then add it to the object
        if (Error == "")
        {
            //get the data entered by the user
            Customers.ThisCustomer.Title     = txtTitle.Text;
            Customers.ThisCustomer.ForeName  = txtForeName.Text;
            Customers.ThisCustomer.LastName  = txtLastName.Text;
            Customers.ThisCustomer.Email     = txtCustomerEmail.Text;
            Customers.ThisCustomer.PhoneNo   = Convert.ToInt32(txtPhoneNo.Text);
            Customers.ThisCustomer.DateAdded = Convert.ToDateTime(txtDateAdded.Text);
            Customers.ThisCustomer.Active    = checkboxActive.Checked;
            //update the record
            Customers.Update();
            //all done so redirect back to the main page
            Response.Redirect("CustomerDefault");
        }
        else
        {
            //report an error
            lblError.Text = "There were problems with the data entered " + Error;
        }
    }
예제 #11
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.Username    = "******";
            TestItem.Password    = "******";
            TestItem.Email       = "*****@*****.**";
            TestItem.DateCreated = DateTime.Now.Date;
            TestItem.Active      = true;

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

            TestItem.Username    = "******";
            TestItem.Password    = "******";
            TestItem.Email       = "*****@*****.**";
            TestItem.DateCreated = DateTime.Now.Date;
            TestItem.Active      = false;

            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #12
0
        public void Update()
        {
            //create an instance of the Inventory Collection
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //validate the data on the Windows Form
            string Error = AllCustomers.ThisCustomer.Valid(txtNewName.Text, txtPhonenum.Text, txtEmail.Text, DateTime.Now.Date.ToString(), txtBio.Text, txtAccountBalance.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //find the record to UPDATE
                AllCustomers.ThisCustomer.Find(mCustomerId);
                //get the data entered by the user

                AllCustomers.ThisCustomer.Name           = txtNewName.Text;
                AllCustomers.ThisCustomer.Email          = txtEmail.Text;
                AllCustomers.ThisCustomer.AccountBalance = Convert.ToDecimal(txtAccountBalance.Text);
                AllCustomers.ThisCustomer.Bio            = Convert.ToString(txtBio.Text);
                AllCustomers.ThisCustomer.DateJoined     = Convert.ToDateTime(txtDateJoined.Text);
                AllCustomers.ThisCustomer.Phonenum       = txtPhonenum.Text;


                //UPDATE the record
                AllCustomers.Update();
                //All Done so Redirect to the previous Form
            }
            else
            {
                lblError.Text = "There were problems with the data entered: " + Error;
            }
        }
예제 #13
0
    void Update()

    {
        //create an instance of the customer records
        clsCustomerCollection CustomerRecords = new clsCustomerCollection();
        //validate the data on the web form
        String Error = CustomerRecords.ThisCustomer.Valid(txtFirstName.Text, txtLastName.Text, txtEmail.Text, txtTeleNo.Text);

        //if the data is OK then add it the object
        if (Error == "")
        {
            CustomerRecords.ThisCustomer.Find(CustomerID);
            //get the data entered by the user
            CustomerRecords.ThisCustomer.CustomerFirstName = txtFirstName.Text;
            CustomerRecords.ThisCustomer.CustomerLastName  = txtLastName.Text;
            CustomerRecords.ThisCustomer.CustomerEmail     = txtEmail.Text;
            CustomerRecords.ThisCustomer.CustomerTeleNo    = txtTeleNo.Text;
            CustomerRecords.ThisCustomer.Active            = chkActive.Checked;
            //update the record
            CustomerRecords.Update();
            Response.Redirect("CustomerViewer.aspx");
        }
        else
        {
            //report an error
            lblError.Text = "There were problem with the data entered - " + Error;
        }
    }
예제 #14
0
    //function for updating records
    void Update()
    {
        //create an instance of the customer store
        MyClassLibrary.clsCustomerCollection CustomerStore = new clsCustomerCollection();
        //validate the data on the web form
        string Error = CustomerStore.ThisCustomer.Valid(txtFirstName.Text, txtSurName.Text, txtStreet.Text, txtHouseNo.Text, txtPostCode.Text, txtPhoneNo.Text);

        //if the data is OK then add it to the object
        if (Error == "")
        {
            //find the record to update
            CustomerStore.ThisCustomer.Find(CustomerID);
            //get the data entered by the user
            CustomerStore.ThisCustomer.FirstName = txtFirstName.Text;
            CustomerStore.ThisCustomer.SurName   = txtSurName.Text;
            CustomerStore.ThisCustomer.Street    = txtStreet.Text;
            CustomerStore.ThisCustomer.HouseNo   = txtHouseNo.Text;
            CustomerStore.ThisCustomer.PostCode  = txtPostCode.Text;
            CustomerStore.ThisCustomer.PhoneNo   = Convert.ToInt32(txtPhoneNo.Text);
            CustomerStore.ThisCustomer.Active    = chkActive.Checked;
            CustomerStore.ThisCustomer.CountyNo  = Convert.ToInt32(ddlCounty.SelectedValue);
            //update the record
            CustomerStore.Update();
            //all done so redirect back to the main page
            Response.Redirect("Default.aspx");
        }
        else
        {
            //report an error
            lblError.Text = "There were problem with the data entered" + Error;
        }
    }
예제 #15
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.CustomerNumber   = 1;
            TestItem.CustomerName     = "Michael Smith";
            TestItem.CustomerEmail    = "*****@*****.**";
            TestItem.CustomerDOB      = DateTime.Now.Date;
            TestItem.CustomerGender   = "M";
            TestItem.CustomerPostcode = "LE1 1AB";
            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey = AllCustomers.Add();
            TestItem.CustomerNumber   = PrimaryKey;
            TestItem.CustomerNumber   = 3;
            TestItem.CustomerName     = "Jane Paul";
            TestItem.CustomerEmail    = "*****@*****.**";
            TestItem.CustomerDOB      = DateTime.Now.Date;
            TestItem.CustomerGender   = "F";
            TestItem.CustomerPostcode = "B42 2QJ";
            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
    void Update()
    {
        //create an instance of the staff
        clsCustomerCollection Customer = new clsCustomerCollection();

        //validate the data on the web form
        // Boolean OK = Customer.ThisCustomer.Valid(txtboxFirstName.Text, txtboxAddress.Text, txtboxPostcode.Text, txtboxContactNumber.Text, txtboxEmail.Text, txtboxDateJoined.Text);
        //if the data is OK them add it to the object
        // if (OK == true)
        //if we are adding a new record

        // {
        //get the data entered by the user
        Customer.ThisCustomer.Find(CustomerId);
        Customer.ThisCustomer.Name          = Convert.ToString(txtboxFirstName.Text);
        Customer.ThisCustomer.Address       = Convert.ToString(txtboxAddress.Text);
        Customer.ThisCustomer.PostCode      = Convert.ToString(txtboxPostcode.Text);
        Customer.ThisCustomer.ContactNumber = Convert.ToString(txtboxContactNumber.Text);
        Customer.ThisCustomer.EmailAddress  = Convert.ToString(txtboxEmail.Text);
        Customer.ThisCustomer.DateJoined    = Convert.ToDateTime(txtboxDateJoined.Text);
        Customer.ThisCustomer.Active        = Active.Checked;

        //add the record
        Customer.Update();
        Response.Redirect("Customer.aspx");
        // }
        //else
        //{
        //report an error
        //  lblError.Text = "There were problems with the data provided";
        //}
    }
예제 #17
0
    void Update()
    {
        //create an instance of the Customer Book
        clsCustomerCollection CustomerBook = new clsCustomerCollection();
        //validate the data on the web form
        String Error = CustomerBook.ThisCustomer.Valid(txtCustomerID.Text, txtCustomerName.Text, txtCustomerTelNumber.Text, txtCustomerAddress.Text, txtDateJoined.Text);

        //if the data is OK then add it to the object
        if (Error == "")
        {
            //find the record to update
            CustomerBook.ThisCustomer.Find(CustomerID);
            //get the data entered by the user
            CustomerBook.ThisCustomer.CustomerID        = Convert.ToInt32(txtCustomerID.Text);
            CustomerBook.ThisCustomer.CustomerName      = txtCustomerName.Text;
            CustomerBook.ThisCustomer.CustomerTelNumber = txtCustomerTelNumber.Text;
            CustomerBook.ThisCustomer.CustomerAddress   = txtCustomerAddress.Text;
            CustomerBook.ThisCustomer.DateJoined        = Convert.ToDateTime(txtDateJoined.Text);
            CustomerBook.ThisCustomer.Active            = ChkActive.Checked;
            //Update the record
            CustomerBook.Update();
            //all done so redirect back to the main page
            Response.Redirect("DefaultCustomer.aspx");
        }

        else
        {
            //report an error
            lblError.Text = "There were problems with the data entered" + Error;
        }
    }
        public void UpdateMethodOK()
        {
            //Create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //Create the item of test data
            clsCustomer TestItem = new clsCustomer();
            //Variable to store the primary key
            Int32 PrimaryKey = 0;

            //Set its properties
            TestItem.FirstName     = "David";
            TestItem.LastName      = "Haddock";
            TestItem.DateOfBirth   = new DateTime(1982, 7, 23);
            TestItem.EmailAddress  = "*****@*****.**";
            TestItem.MobilePhoneNo = 07775828423;
            TestItem.Password      = "******";
            //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;
            //Modify the test data
            TestItem.FirstName     = "Julia";
            TestItem.LastName      = "Summers";
            TestItem.MobilePhoneNo = 07776828332;
            //Set the record based on the new test data
            AllCustomers.ThisCustomer = TestItem;
            //Update the record.
            AllCustomers.Update();
            //Fihnd the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //Test to see if ThisCustomer matches the test data
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #19
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.AccountVerified  = true;
            TestItem.Ballance         = 1;
            TestItem.CustomerName     = "Gary";
            TestItem.CustomerEmail    = "*****@*****.**";
            TestItem.DateAdded        = DateTime.Now.Date;
            TestItem.DateOfBirth      = Convert.ToDateTime("01/01/2000");
            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey         = AllCustomers.Add();
            TestItem.AccountNo = PrimaryKey;

            TestItem.AccountVerified = false;
            TestItem.Ballance        = 3;
            TestItem.CustomerName    = "Wanderer";
            TestItem.CustomerEmail   = "*****@*****.**";
            TestItem.DateAdded       = DateTime.Now.Date;
            TestItem.DateOfBirth     = Convert.ToDateTime("01/01/2000");

            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey = AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #20
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clscustomer           TestItem     = new clscustomer();
            Int32 PrimaryKey = 0;

            TestItem.Registered = true;
            TestItem.DOB        = Convert.ToDateTime("16/08/1999");
            TestItem.Name       = "Rushil";
            TestItem.Email      = "Ramesh";
            TestItem.Address    = "60, Rainworth road, LE5 4QE";
            TestItem.CustomerNo = 1;

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

            TestItem.Registered = false;
            TestItem.DOB        = Convert.ToDateTime("16/08/1999");
            TestItem.Name       = "John";
            TestItem.Email      = "Steve";
            TestItem.Address    = "64, Worth road, LE7 4WE";
            TestItem.CustomerNo = 10;

            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #21
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 1;

            //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;
            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey         = AllCustomers.Add();
            TestItem.ProductNo = PrimaryKey;
            //modify test data
            TestItem.PhoneNumber      = "999999999999";
            TestItem.FullName         = "John Smith";
            TestItem.Email            = "*****@*****.**";
            TestItem.CustomerID       = 3;
            TestItem.Date             = DateTime.Now.Date;
            TestItem.Address          = "90 Hamilton Road LE5 J3D";
            TestItem.OrderNo          = 6;
            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #22
0
        public void UpdateMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 1;

            TestItem.Active           = true;
            TestItem.PhoneNumber      = "66666666666";
            TestItem.FullName         = "Update Method";
            TestItem.Email            = "*****@*****.**";
            TestItem.CustomerID       = 70;
            TestItem.Date             = DateTime.Now.Date;
            TestItem.Address          = "9 Update Road";
            TestItem.PostCode         = "LE6 6UM";
            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey          = AllCustomers.Add();
            TestItem.CustomerID = PrimaryKey;
            //modify test data
            TestItem.PhoneNumber      = "999999999999";
            TestItem.FullName         = "Done Update";
            TestItem.Email            = "*****@*****.**";
            TestItem.Date             = DateTime.Now.Date;
            TestItem.Address          = "60 Updated Street";
            TestItem.PostCode         = "LE6 9UM";
            TestItem.Active           = true;
            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #23
0
    //function for updating records
    void Update()
    {
        //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 == "")
        {
            //find the record to update
            CList.ThisCustomer.Find(CustomerID);
            //get the data entered by the user
            CList.ThisCustomer.Surname       = Convert.ToString(txtSurname.Text);
            CList.ThisCustomer.ForeName      = Convert.ToString(txtForename.Text);
            CList.ThisCustomer.dateOfBirth   = Convert.ToDateTime(txtDateOfBirth.Text);
            CList.ThisCustomer.HouseNo       = Convert.ToString(txtHouseNumber.Text);
            CList.ThisCustomer.FlatNo        = Convert.ToString(txtFlatNo.Text);
            CList.ThisCustomer.PostCode      = Convert.ToString(txtPostCode.Text);
            CList.ThisCustomer.Gender        = Convert.ToString(txtGender.Text);
            CList.ThisCustomer.ContactNumber = Convert.ToString(txtContactNumber.Text);
            CList.ThisCustomer.EMail         = Convert.ToString(txtEmail.Text);
            //CList.ThisCustomer.UserName = User.Identity.Name;
            //update the record
            CList.Update();
            //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;
        }
    }
예제 #24
0
        public void UpdateMethodOK()
        {
            //create an instance of the classes we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            //create test data for each attribute
            TestItem.CustomerName      = "Tobias Jenkins";
            TestItem.CustomerDOB       = new DateTime(1994, 10, 10);
            TestItem.CustomerEmail     = "*****@*****.**";
            TestItem.CustomerSubscribe = true;
            AllCustomers.ThisCustomer  = TestItem;
            PrimaryKey          = AllCustomers.Add();
            TestItem.CustomerId = PrimaryKey;
            //create new data for each attribute to update
            TestItem.CustomerName      = "Paul Jenkins";
            TestItem.CustomerDOB       = new DateTime(1995, 09, 10);
            TestItem.CustomerEmail     = "*****@*****.**";
            TestItem.CustomerSubscribe = false;
            AllCustomers.ThisCustomer  = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //test to see that it passes
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #25
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);
        }
예제 #26
0
    //function for Updating records
    void Update()
    {
        //create an instance of the customer class
        clsCustomerCollection CustomerList = new clsCustomerCollection();
        //validate the data on the web form
        String Error = CustomerList.ThisCustomer.Valid(txtFirstname.Text, txtLastname.Text, txtHouseNo.Text, txtStreetName.Text, txtCity.Text, txtPostcode.Text, txtEmail.Text, txtPhoneNo.Text);

        //if the data is OK then add it to the object
        if (Error == "")
        {
            //find the record to update
            CustomerList.ThisCustomer.Find(CustomerID);
            //get the data entered by the user
            CustomerList.ThisCustomer.Customerfirstname  = txtFirstname.Text;
            CustomerList.ThisCustomer.Customerlastname   = txtLastname.Text;
            CustomerList.ThisCustomer.Customerhouseno    = txtHouseNo.Text;
            CustomerList.ThisCustomer.Customerstreetname = txtStreetName.Text;
            CustomerList.ThisCustomer.Customercity       = txtCity.Text;
            CustomerList.ThisCustomer.Customerpostcode   = txtPostcode.Text;
            CustomerList.ThisCustomer.Customeremail      = txtEmail.Text;
            CustomerList.ThisCustomer.Customerphoneno    = Convert.ToInt64(txtPhoneNo.Text);

            //add the record
            CustomerList.Update();
            //redirect to the main page
            Response.Redirect("CustomerList.aspx");
        }
        else
        {
            //report an error
            lblError.Text = "There were problems with the data entered: " + Error;
        }
    }
예제 #27
0
        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);
        }
예제 #28
0
    //function for updating records
    void Update()
    {
        //create an instance of the Customer Book
        clsCustomerCollection CustomerBook = new clsCustomerCollection();
        //validate the data on the web form
        String Error = CustomerBook.ThisCustomer.Valid(txtName.Text, txtPhone.Text, txtEmail.Text, txtUsername.Text, txtPassword.Text, txtPaymentType.Text);

        //if the data is ok then add it to the object
        if (Error == "")
        {
            //find the record to update
            CustomerBook.ThisCustomer.Find(CustomerID);
            //get the data entered by the user
            CustomerBook.ThisCustomer.Name        = txtName.Text;
            CustomerBook.ThisCustomer.Phone       = txtPhone.Text;
            CustomerBook.ThisCustomer.Email       = txtEmail.Text;
            CustomerBook.ThisCustomer.Username    = txtUsername.Text;
            CustomerBook.ThisCustomer.Password    = txtPassword.Text;
            CustomerBook.ThisCustomer.PaymentType = txtPaymentType.Text;
            //update the record
            CustomerBook.Update();
            //all done so redirect back to the main page
            Response.Redirect("CustomerList.aspx");
        }
        else
        {
            //report an error
            lblError.Text = "There were problems with the data entered " + Error;
        }
    }
예제 #29
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);
        }
예제 #30
0
        public void UpdateMethodOk()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            List <clsCustomer>    TestList     = new List <clsCustomer>();
            clsCustomer           TestItem     = new clsCustomer();

            TestItem.VerifiedAccount  = true;
            TestItem.CustomerID       = 123;
            TestItem.DateCreated      = DateTime.Now.Date;
            TestItem.EmailAddress     = "*****@*****.**";
            TestItem.Postcode         = "tr1 3es";
            TestItem.Username         = "******";
            AllCustomers.ThisCustomer = TestItem;
            Int32 PrimaryKey = AllCustomers.Add();

            TestItem.CustomerID       = PrimaryKey;
            TestItem.VerifiedAccount  = false;
            TestItem.DateCreated      = DateTime.Now.Date;
            TestItem.EmailAddress     = "*****@*****.**";
            TestItem.Postcode         = "Pl3 4se";
            TestItem.Username         = "******";
            AllCustomers.ThisCustomer = TestItem;
            AllCustomers.Update();
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }