protected override string GetCurrentPathDescription(CardItemViewModel current) { if (current == null) { return(null); } string delim = " \\ "; var sb = new StringBuilder(); var h = current.Holder; var p = h.GetPatient(); sb.Append(NameFormatter.GetFullName(p) ?? string.Format("Пациент ({0:dd.MM.yy hh:mm})", p.CreatedAt)); if (h is Course) { var c = h as Course; sb.AppendFormat("{0}курс {1}", delim, DateFormatter.GetIntervalString(c.Start, c.End)); } else if (h is Appointment) { var a = h as Appointment; sb.AppendFormat("{0}курс {1}{2}осмотр {3}", delim, DateFormatter.GetIntervalString(a.Course.Start, a.Course.End), delim, DateFormatter.GetDateString(a.DateAndTime)); } return(sb.ToString()); }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is IMan) { bool full = false; bool.TryParse(parameter as string, out full); if (full) { var name = NameFormatter.GetFullName(value as IMan); return(name ?? ((value is Patient) ? (value as Patient).FullNameOrCreatedAt : "")); } else { return(NameFormatter.GetShortName(value as IMan)); } } return(""); }