Beispiel #1
0
        public override void Save()
        {
            StringCollection oldPhones = new StringCollection();

            oldPhones.AddRange(_contact.GetPhoneNames());
            foreach (HashMap.Entry E in _phoneControls)
            {
                string phoneNumber = ((TextBox)E.Value).Text.Trim();
                string phoneName   = ((Label)E.Key).Text;
                if (phoneName.Length > 0)
                {
                    phoneName = phoneName.Substring(0, phoneName.Length - 1);
                    if (!String.IsNullOrEmpty(phoneNumber.Trim()))
                    {
                        _contact.SetPhoneNumber(phoneName, phoneNumber);
                    }
                    else
                    {
                        _contact.DeletePhone(phoneName);
                    }
                    oldPhones.Remove(phoneName);
                }
            }
            foreach (string remainedPhone in oldPhones)
            {
                _contact.DeletePhone(remainedPhone);
            }
        }
Beispiel #2
0
        [Test] public void CheckNormilizedPhoneComparing()
        {
            string    email   = "*****@*****.**";
            ContactBO contact = (ContactBO)Core.ContactManager.FindOrCreateContact(email, "Sergey Zhulin");

            contact.SetPhoneNumber("Home", " 123-78-90");
            IResource phone = contact.GetPhoneByNumber("_1.2.3.7.8.9.0");

            Assert.IsNotNull(phone);
            Assert.AreEqual(" 123-78-90", phone.GetStringProp("PhoneNumber"));
        }