public void TestHasEmailOrMobile()
        {
            Customer c1 = new Customer();
            c1.PhoneNumber = "0412312869";
            Customer c2 = new Customer();
            c2.PhoneNumber = "412312869";
            c2.EmailAddress = "*****@*****.**";
            Customer c3 = new Customer();
            c3.PhoneNumber = "0260253606";
            c3.EmailAddress = "*****@*****.**";
            Customer c4 = new Customer();
            c4.PhoneNumber = "0260253606";

            Assert.IsTrue(c1.HasEmailOrMobile(), "Mobile only, should be true");
            Assert.IsTrue(c2.HasEmailOrMobile(), "Mobile + email, should be true");
            Assert.IsTrue(c3.HasEmailOrMobile(), "Email only, should be true");
            Assert.IsFalse(c4.HasEmailOrMobile(), "Neither, should be false");
        }
        public void TestIsMobileNumber()
        {
            Customer c1 = new Customer();
            c1.PhoneNumber = "0412312869";
            Customer c2 = new Customer();
            c2.PhoneNumber = "412312869";
            Customer c3 = new Customer();
            c3.PhoneNumber = "0260253606";
            Customer c4 = new Customer();
            c4.PhoneNumber = "61412312869";
            Customer c5 = new Customer();
            c5.PhoneNumber = "+61412312869";

            Assert.IsTrue(c1.IsMobile(), "Mobile number c1 should be true");
            Assert.IsTrue(c2.IsMobile(), "Mobile number c2 should be true");
            Assert.IsFalse(c3.IsMobile(), "c3 Should be reporting as not a mobile number");
            Assert.IsTrue(c4.IsMobile(), "Mobile number c4 should be true");
            Assert.IsTrue(c5.IsMobile(), "Mobile number c5 should be true");
        }
        public void TestFormatMobileNumber()
        {
            string expectedNumber = "0412312869";

            Customer c1 = new Customer();
            c1.PhoneNumber = "";
            Assert.AreEqual(c1.GetNormalisedMobileNumber(), "", "Should be empty string");

            c1 = new Customer();
            c1.PhoneNumber = "0412312869";
            Assert.AreEqual(expectedNumber, c1.GetNormalisedMobileNumber(), "1. NUmbers should be the same");
            c1.PhoneNumber = "(04) 1231 2869";
            Assert.AreEqual(expectedNumber, c1.GetNormalisedMobileNumber(), "2. NUmbers should be the same");
            c1.PhoneNumber = "0412 312 869";
            Assert.AreEqual(expectedNumber, c1.GetNormalisedMobileNumber(), "3. NUmbers should be the same");
            c1.PhoneNumber = "+61412312869";
            Assert.AreEqual(expectedNumber, c1.GetNormalisedMobileNumber(), "4. NUmbers should be the same");
            c1.PhoneNumber = "+614 1231 2869";
            Assert.AreEqual(expectedNumber, c1.GetNormalisedMobileNumber(), "5. NUmbers should be the same");
        }
        public string findDepotForCustomer(Customer customer)
        {
            if (depot_matrix == null)
                initMatrix();

            string result = "";

            var items = (from item in depot_matrix
                         where Tools.normalisePostcode(customer.Postcode) == item.Postcode && customer.City.ToUpper() == item.Suburb
                         select item).ToList();

            if (items.Count >= 1) {
                return items[0].DepotCode;
            } else if (items.Count == 0) {
                throw new CustomerException(string.Format("Could not match customer to a TOLL depot: P:{0}, S:{1}",
                    customer.Postcode, customer.City));
            }

            return result;
        }
 public Invoice(string invoiceNo)
 {
     this.invoiceNo = invoiceNo;
     invoiceCustomer = new Customer();
     parcels = new ArrayList();
 }
 public Invoice()
 {
     invoiceNo = "";
     invoiceCustomer = new Customer();
     parcels = new ArrayList();
 }
        public void loadInvoiceDetails()
        {
            if (!String.IsNullOrEmpty(invoiceNo)) {
                Customer temp_customer = new Customer();

                IDataReader reader = API.InvoicesAPI.GetInvoiceDetails(invoiceNo);
                if (reader.Read()) {
                    invoiceCustomer.CustomerNumber = reader["custNo"].ToString();
                    invoiceCustomer.Title = reader["title"].ToString();
                    invoiceCustomer.Firstname = reader["firstName"].ToString();
                    invoiceCustomer.Middlename = reader["middleName"].ToString();
                    invoiceCustomer.Lastname = reader["surName"].ToString();
                    invoiceCustomer.Address1 = reader["address1"].ToString();
                    invoiceCustomer.Address2 = reader["address2"].ToString();
                    invoiceCustomer.City = reader["city"].ToString();
                    invoiceCustomer.State = reader["state"].ToString();
                    invoiceCustomer.Postcode = reader["postcode"].ToString();
                    invoiceCustomer.Country = reader["countryCode"].ToString();
                    invoiceCustomer.PhoneNumber = reader["phoneNumber"].ToString();
                    invoiceCustomer.EmailAddress = reader["emailAddress"].ToString();
                    companyName = reader["companyName"].ToString();
                    companyABN = reader["companyABN"].ToString();
                    if (companyName == "Bright Life Australia") {
                        companyAddress = "PO Box 6521 Brookvale NSW 2100";
                    } else {
                        companyAddress = reader["companyAddress"].ToString();
                    }
                    status = Enums.InvoiceStatus.WAITING;
                    packed = false;
                }
                reader.Close();
            }
        }