Beispiel #1
0
        // Create the customer object to submit. Send an empty string[] if EFT
        public bool SubmitCustomer(string name, string address, string[] paymentDetails)
        {
            // Passed bool
            bool success = false;
            // Create a new customer object
            Customer aCust = new Customer();

            // Add the values
            aCust.Name    = name;
            aCust.Address = address;
            // Not blacklisted by default
            aCust.BlackListed = 0;
            // Not in debt by default
            aCust.Debt = 0;

            // Check the payment method
            if (paymentDetails == null)
            {
                // Creates empty values for an EFT to avoid data issues on the DB
                string[] empty = new string[3] {
                    "0", "0", "0"
                };
                aCust.CardHolderDetails = empty;
                aCust.Payment           = Customer.PaymentMethod.EFT;
            }
            else
            {
                aCust.CardHolderDetails = paymentDetails;
                aCust.Payment           = Customer.PaymentMethod.CreditCard;
            }

            // Insert the customer
            success = CustDB.InsertCustomer(aCust);
            return(success);
        }