Beispiel #1
0
        public void PhoneNumberRegEx8()
        {
            string input = "234.567.8901x8888";
            bool   b     = Regex.IsMatch(input, PhoneNumber10Ext.RegEx, RegexOptions.IgnoreCase);

            Assert.IsTrue(b, input);
            string t = PhoneNumber10Ext.Reformat(input);

            Assert.AreEqual(t, "(234) 567-8901 ext 8888");
        }
Beispiel #2
0
        public void PhoneNumberRegExRegEx()
        {
            string input = "aaa.567.8901 ext 8888";
            bool   b     = Regex.IsMatch(input, PhoneNumber10Ext.RegEx, RegexOptions.IgnoreCase);

            Assert.IsFalse(b, input);
            string t = PhoneNumber10Ext.Reformat(input);

            Assert.AreEqual(t, "ERROR");
        }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "ID,FirstName,LastName,CompanyName,Address,Address2,City,State,ZipCode,Latitude,Longitude,Directions,PhoneNumber1,PhoneNumber2,PhoneNumber3,EmailAddress,LastModifiedBy,LastModifiedDateTime,Name")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                if (string.IsNullOrEmpty(customer.PhoneNumber1) && string.IsNullOrEmpty(customer.PhoneNumber2) && string.IsNullOrEmpty(customer.PhoneNumber3))
                {
                    return(View(customer));
                }
                customer.PhoneNumber1         = PhoneNumber10Ext.Reformat(customer.PhoneNumber1);
                customer.PhoneNumber2         = PhoneNumber10Ext.Reformat(customer.PhoneNumber2);
                customer.PhoneNumber2         = PhoneNumber10Ext.Reformat(customer.PhoneNumber2);
                customer.LastModifiedById     = User.Identity.GetUserId();
                customer.LastModifiedDateTime = DateTime.Now;
                db.Customers.Add(customer);
                int count = db.SaveChanges();
                return(RedirectToAction("Create", "Measure", new { id = customer.Id }));
            }

            return(View(customer));
        }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "ID,FirstName,LastName,CompanyName,Address,Address2,City,State,ZipCode,Latitude,Longitude,Directions,PhoneNumber1,PhoneNumber2,PhoneNumber3,EmailAddress,LastModifiedBy,LastModifiedDateTime,Name")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         try
         {
             customer.PhoneNumber1         = PhoneNumber10Ext.Reformat(customer.PhoneNumber1);
             customer.PhoneNumber2         = PhoneNumber10Ext.Reformat(customer.PhoneNumber2);
             customer.PhoneNumber2         = PhoneNumber10Ext.Reformat(customer.PhoneNumber3);
             customer.LastModifiedById     = User.Identity.GetUserId();
             customer.LastModifiedDateTime = DateTime.Now;
             db.Entry(customer).State      = EntityState.Modified;
             db.SaveChanges();
         }
         catch (DbEntityValidationException e)
         {
         }
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
        public void TestFail(string a)
        {
            PhoneNumber10Ext pn = new PhoneNumber10Ext();

            Assert.False(pn.IsValid(a));
        }
        public void TestPass(string a)
        {
            PhoneNumber10Ext pn = new PhoneNumber10Ext();

            Assert.True(pn.IsValid(a));
        }