public virtual System.Object Clone() { TelephoneLocalNumber clone = new TelephoneLocalNumber(); clone.TelephoneNumber = TelephoneNumber; return(clone); }
public static TelephoneLocalNumber Create(String telephoneLocalNumberString) { TelephoneLocalNumber result = null; if (!Ca.Infoway.Messagebuilder.StringUtils.IsBlank(telephoneLocalNumberString)) { String noHyphenNumber = Ca.Infoway.Messagebuilder.StringUtils.Remove( telephoneLocalNumberString, '-'); result = new TelephoneLocalNumber(); result.TelephoneNumber = noHyphenNumber; } return(result); }
public Telephone() { this.phoneNumber = new TelephoneLocalNumber(); }
public Telephone(String areaCode_0, TelephoneLocalNumber phoneNumber_1) { this.phoneNumber = new TelephoneLocalNumber(); this.areaCode = areaCode_0; this.phoneNumber = phoneNumber_1; }
/* This is a bit dreadful, but it seems to work */ private Telephone ProcessFormattedTelephoneNumber(String telephoneNumber) { String areaCode = null; String extension = null; String firstPart = null; TelephoneLocalNumber number = null; bool bracket = false; bool invalid = false; bool extensionIndicator = false; bool firstTime = true; /* foreach */ foreach (String token in Tokenize(telephoneNumber)) { if (Ca.Infoway.Messagebuilder.StringUtils.IsBlank(token)) { // ignore it } else if ("(".Equals(token)) { if (bracket || areaCode != null || number != null) { invalid = true; break; } else { bracket = true; } } else if (")".Equals(token)) { if (bracket && areaCode != null) { bracket = false; } else { invalid = true; break; } } else if (IsExtensionIndicator(token)) { if (extension == null) { extensionIndicator = true; } else { invalid = true; break; } } else if (IsOnlyNumbers(token) && extensionIndicator) { extension = token; extensionIndicator = false; } else if (IsOnlyNumbers(token) && token.Length == 3 && bracket) { if (areaCode == null) { areaCode = token; } else { invalid = true; break; } } else if (IsOnlyNumbers(token) && token.Length == 3) { if (firstPart == null) { firstPart = token; } else if (areaCode == null) { areaCode = firstPart; firstPart = token; } else { invalid = true; break; } } else if (IsOnlyNumbers(token) && token.Length == 4) { if (firstPart == null) { invalid = true; break; } else { Telephone temp = ProcessNumericNumber(firstPart + token); number = temp.PhoneNumber; firstPart = null; } } else if (IsOnlyNumbers(token) && token.Length == 7) { if (firstPart != null) { if (areaCode == null) { areaCode = firstPart; firstPart = null; } else { invalid = true; break; } } Telephone temp_0 = ProcessNumericNumber(token); number = temp_0.PhoneNumber; } else if (IsPunctuation(token)) { // ignore it } else if ("1".Equals(token) && firstTime) { // ignore it } else { invalid = true; break; } if (!"+".Equals(token)) { firstTime = false; } } if (number != null && !bracket && !invalid && !extensionIndicator) { Telephone result = new Telephone(); result.AreaCode = areaCode; result.PhoneNumber = number; result.Extension = extension; return(result); } else { return(null); } }