private static string GetContactPointInfo(ExternalPractitionerContactPointDetail cp) { var builder = new StringBuilder(); builder.AppendFormat("Description: {0}", cp.Description); builder.AppendLine(); builder.AppendFormat(SR.FormatPhone, cp.CurrentPhoneNumber == null ? "" : TelephoneFormat.Format(cp.CurrentPhoneNumber)); builder.AppendLine(); builder.AppendFormat(SR.FormatFax, cp.CurrentFaxNumber == null ? "" : TelephoneFormat.Format(cp.CurrentFaxNumber)); builder.AppendLine(); builder.AppendFormat(SR.FormatAddress, cp.CurrentAddress == null ? "" : AddressFormat.Format(cp.CurrentAddress)); builder.AppendLine(); builder.AppendFormat(SR.FormatEmail, cp.CurrentEmailAddress == null ? "" : cp.CurrentEmailAddress.Address); return(builder.ToString()); }
/// <summary> /// Formats the specified Telephone number (must be a non-formatted 10-digit string). /// </summary> /// <param name="telephone"></param> /// <returns></returns> public string FormatStringTelephone(string telephone) { return(TelephoneFormat.Format(telephone, TextFieldMasks.TelephoneNumberFullMask)); }
/// <summary> /// Formats the specified Telephone number (must be a JSML encoded <see cref="TelephoneDetail"/> object). /// </summary> /// <param name="jsml"></param> /// <returns></returns> public string FormatTelephone(string jsml) { var telephoneDetail = JsmlSerializer.Deserialize <TelephoneDetail>(jsml); return(telephoneDetail == null ? "" : TelephoneFormat.Format(telephoneDetail)); }
public ExternalPractitionerContactPointTable() : base(NumRows) { var activeColumn = new TableColumn <ExternalPractitionerContactPointDetail, bool>(SR.ColumnActive, cp => !cp.Deactivated, SetDeactivatedStatus, 0.1f); var defaultColumn = new TableColumn <ExternalPractitionerContactPointDetail, bool>(SR.ColumnDefault, cp => cp.IsDefaultContactPoint, MakeDefaultContactPoint, 0.1f); var nameColumn = new TableColumn <ExternalPractitionerContactPointDetail, string>(SR.ColumnName, cp => cp.Name, 0.3f); var descriptionColumn = new TableColumn <ExternalPractitionerContactPointDetail, string>(SR.ColumnDescription, cp => cp.Description, 0.5f); var phoneColumn = new TableColumn <ExternalPractitionerContactPointDetail, string>(SR.ColumnPhone, cp => string.Format(SR.FormatPhone, cp.CurrentPhoneNumber == null ? "" : TelephoneFormat.Format(cp.CurrentPhoneNumber)), 1.0f, PhoneRow); var faxColumn = new TableColumn <ExternalPractitionerContactPointDetail, string>(SR.ColumnFax, cp => string.Format(SR.FormatFax, cp.CurrentFaxNumber == null ? "" : TelephoneFormat.Format(cp.CurrentFaxNumber)), 1.0f, FaxRow); var addressColumn = new TableColumn <ExternalPractitionerContactPointDetail, string>(SR.ColumnAddress, cp => string.Format(SR.FormatAddress, cp.CurrentAddress == null ? "" : AddressFormat.Format(cp.CurrentAddress)), 1.0f, AddressRow); var emailColumn = new TableColumn <ExternalPractitionerContactPointDetail, string>(SR.ColumnEmail, cp => string.Format(SR.FormatEmail, cp.CurrentEmailAddress == null ? "" : cp.CurrentEmailAddress.Address), 1.0f, EmailRow); this.Columns.Add(activeColumn); this.Columns.Add(defaultColumn); this.Columns.Add(nameColumn); this.Columns.Add(descriptionColumn); this.Columns.Add(phoneColumn); this.Columns.Add(faxColumn); this.Columns.Add(addressColumn); this.Columns.Add(emailColumn); }
/// <summary> /// Formats a telephone number. For U.S. 10-digit numbers, if a leading "1" is included, it is stripped prior to formatting. /// </summary> /// <example> /// <code> /// using Mezzocode.Halide3; /// ... /// string sourceStr = "1112223333"; /// string result = h3Text.FormatTelephoneNumber(sourceStr, h3Text.TelephoneFormat.Full); /// </code> /// result would be "(111) 222-3333". /// </example> /// <param name="phoneNumber">The phone number.</param> /// <param name="TF">TelephoneFormat constant which defines how the telephone number should be formatted.</param> /// <returns>A string formatted telephone number.</returns> public static String FormatTelephoneNumber(string phoneNumber, TelephoneFormat TF) { string returnVal = String.Empty; if (phoneNumber.Length > 0) { for (int x = 0; x < phoneNumber.Length; x++) { char strChar = Convert.ToChar(Mid(phoneNumber, x, 1)); if ((int)strChar > 47 && (int)strChar < 58) returnVal += Mid(phoneNumber, x, 1); } } if (returnVal.Length == 11 && returnVal.StartsWith("1")) { returnVal = returnVal.TrimStart('1'); } if (returnVal.Length == 10) { if (TF == TelephoneFormat.Full) { returnVal = string.Format("({0}) {1}-{2}", returnVal.Substring(0, 3), returnVal.Substring(3, 3), returnVal.Substring(6)); } if (TF == TelephoneFormat.Dots) { returnVal = string.Format("{0}.{1}.{2}", returnVal.Substring(0, 3), returnVal.Substring(3, 3), returnVal.Substring(6)); } if (TF == TelephoneFormat.Hyphens) { returnVal = string.Format("{0}-{1}-{2}", returnVal.Substring(0, 3), returnVal.Substring(3, 3), returnVal.Substring(6)); } } return returnVal; }
public TelephoneNumberTable() { this.Columns.Add(new TableColumn <TelephoneDetail, string>(SR.ColumnType, delegate(TelephoneDetail t) { return(t.Type.Value); }, 1.1f)); this.Columns.Add(new TableColumn <TelephoneDetail, string>(SR.ColumnNumber, delegate(TelephoneDetail pn) { return(TelephoneFormat.Format(pn)); }, 2.2f)); this.Columns.Add(new DateTableColumn <TelephoneDetail>(SR.ColumnExpiryDate, delegate(TelephoneDetail pn) { return(pn.ValidRangeUntil); }, 0.9f)); }