Beispiel #1
0
        public void updatePremiumCustDB(string firstname, string lastname, string email, string phone, string dob, string country, string townorcity, string nationality, string address, string postalcd, string username, string password, string cardtype, string cardno, string expdate, string chname, string ccv, string membership, double subsidy)
        {
            List <Object> updateArray = new List <object>();

            updateArray.Add(Subsidy);
            updateArray.Add(FirstName);
            updateArray.Add(LastName);
            updateArray.Add(Email);
            updateArray.Add(Phone);
            updateArray.Add(Convert.ToDateTime(DOB));
            updateArray.Add(Country);
            updateArray.Add(TownOrCity);
            updateArray.Add(Nationality);
            updateArray.Add(CustAddress);
            updateArray.Add(PostalCd);
            updateArray.Add(Username);
            updateArray.Add(CustPassword);
            updateArray.Add(CardType);
            updateArray.Add(CardNo);
            updateArray.Add(CardExpirationDate);
            updateArray.Add(CardHolderName);
            updateArray.Add(CCV);
            updateArray.Add(Membership);
            updateArray.Add(DBNull.Value);

            PremiumCustomer p = new PremiumCustomer();

            db.updateRow(updateArray, "tblCustomer", " WHERE Username = '******'", p);
        }
Beispiel #2
0
        public override Object getCustomerRow(string username)
        {
            PremiumCustomer currentUserInfoLine = new PremiumCustomer();

            ObservableCollection <PremiumCustomer> customerLines = populatePremiumCustomerDetails();

            foreach (PremiumCustomer line in customerLines)
            {
                if (line.Username == username)
                {
                    currentUserInfoLine = line;
                }
            }
            return(currentUserInfoLine);
        }
Beispiel #3
0
        //calculates total cost for entire cart
        public double calculateTotal()
        {
            double total = 0;
            Cart   ct    = new Cart(username);
            ObservableCollection <Cart> cartItems = ct.getCartItems();

            foreach (Cart cartItem in cartItems)
            {
                total += cartItem.Subtotal;
            }
            Customer cust     = new Customer();
            Customer customer = (Customer)cust.getCustomerRow(username);

            if (customer.Membership == "Premium")
            {
                PremiumCustomer pc = new PremiumCustomer(username);
                pc    = (PremiumCustomer)pc.getCustomerRow(username);
                total = pc.calculateFinalPrice(total, pc.Subsidy);
            }

            return(total);
        }
Beispiel #4
0
        public ObservableCollection <PremiumCustomer> populatePremiumCustomerDetails()
        {
            custPremiumCollection = new ObservableCollection <PremiumCustomer>();

            DataTable table = db.getDataTable("select * from tblCustomer where Membership = 'Premium' ");

            int size = table.Rows.Count;

            for (int i = 0; i < size; i++)
            {
                DataRow row = table.Rows[i];
                FirstName          = row["FirstName"].ToString();
                LastName           = row["LastName"].ToString();
                Email              = row["Email"].ToString();
                Phone              = row["Phone"].ToString();
                DOB                = row["DOB"].ToString();
                Country            = row["Country"].ToString();
                TownOrCity         = row["TownOrCity"].ToString();
                Nationality        = row["Nationality"].ToString();
                CustAddress        = row["CustAddress"].ToString();
                PostalCd           = row["PostalCd"].ToString();
                Username           = row["Username"].ToString();
                CustPassword       = row["CustPassword"].ToString();
                CardType           = row["CardType"].ToString();
                CardNo             = row["CardNo"].ToString();
                CardExpirationDate = row["CardExpirationDate"].ToString();
                CardHolderName     = row["CardHolderName"].ToString();
                CCV                = row["ccv"].ToString();
                Membership         = row["Membership"].ToString();
                Subsidy            = Convert.ToDouble(row["Subsidy"]);

                PremiumCustomer pCust = new PremiumCustomer(FirstName, LastName, Email, Phone, DOB, Country, TownOrCity, Nationality, CustAddress, PostalCd, Username, CustPassword, CardType, CardNo, CardExpirationDate, CardHolderName, CCV, Membership, Subsidy);     //create object
                custPremiumCollection.Add(pCust);
            }

            return(custPremiumCollection);
        }