Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length == 0)
            {
                return(DependencyProperty.UnsetValue);
            }

            DateTime?from = (DateTime?)(values[0] is DateTime? ? values[0] : null);
            DateTime?to   = (DateTime?)(values.Length > 1 && values[1] is DateTime? ? values[1] : null);

            if (from == null && to == null)
            {
                return("");
            }

            var labels = parameter as IList <string>;

            return(DateFormatter.GetIntervalString(from, to, labels));
        }