예제 #1
0
        // Save a new customer card into database
        public Boolean SaveCustomer()
        {
            Boolean   successFlag           = false;
            sqlAccess sqlconnfornewcustomer = new sqlAccess();

            successFlag = sqlconnfornewcustomer.SaveRecord(this._firstName, this._lastName, this._email, this._website, this._dOB, this._memberCard, this._loyaltyMember, this._phone, this._mobile, this._fax);
            return(successFlag);
        }
예제 #2
0
        // Update customer card
        public Boolean SaveCustomer(ourCustomer newinfo)
        {
            Boolean successFlag = false;
            // Divide two different entry, first one for insert new one; second for update.
            sqlAccess sqlconnforcustomerupdate = new sqlAccess();

            // 1. FirstName check
            if (this._firstName.CompareTo(newinfo._firstName) != 0)
            {
                this._firstName = newinfo._firstName;
                successFlag     = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.UFIRSTNAME, this._firstName);
            }

            // 2. LastName check
            if (this._lastName.CompareTo(newinfo._lastName) != 0)
            {
                this._lastName = newinfo._lastName;
                successFlag    = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.ULASTNAME, this._lastName);
            }

            // 3. Email check
            if (this._email.CompareTo(newinfo._email) != 0)
            {
                this._email = newinfo._email;
                successFlag = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.UEMAIL, this._email);
            }

            // 4. Website check
            if (this._website.CompareTo(newinfo._website) != 0)
            {
                this._website = newinfo._website;
                successFlag   = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.UWEBSITE, this._website);
            }

            // 5.DOB check
            if (this._dOB.CompareTo(newinfo._dOB) != 0)
            {
                this._dOB   = newinfo._dOB;
                successFlag = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.UDOB, this._dOB);
            }

            // 6. Loyaltymember check
            if (this._loyaltyMember.CompareTo(newinfo._loyaltyMember) != 0)
            {
                this._loyaltyMember = newinfo._loyaltyMember;
                successFlag         = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.ULOYALTYMEMBER, this._loyaltyMember);
            }

            // 7. phone check
            if (this._phone.CompareTo(newinfo._phone) != 0)
            {
                this._phone = newinfo._phone;
                successFlag = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.UPHONE, this._phone);
            }

            // 8. moblie check
            if (this._mobile.CompareTo(newinfo._mobile) != 0)
            {
                this._mobile = newinfo._mobile;
                successFlag  = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.UMOBILE, this._mobile);
            }

            // 9. fax check
            if (this._fax.CompareTo(newinfo._fax) != 0)
            {
                this._fax   = newinfo._fax;
                successFlag = sqlconnforcustomerupdate.SaveRecord(this._customerId, sqlAccess.UFAX, this._fax);
            }
            return(successFlag);
        }