/* this isn't needed right now, because acknowledged notes are never shown. * private static IconSet GetIsAcknowledgedIcon(bool isAcknowledged) * { * return isAcknowledged ? new IconSet("NoteRead.png") : new IconSet("NoteUnread.png"); * } */ // Creates a semi-colon delimited list of the recipients private static string RecipientsList(IEnumerable <StaffSummary> staffRecipients, IEnumerable <StaffGroupSummary> groupRecipients) { var sb = new StringBuilder(); const string itemSeparator = "; "; foreach (var staffSummary in staffRecipients) { if (String.Equals(PersonNameFormat.Format(staffSummary.Name), PersonNameFormat.Format(LoginSession.Current.FullName))) { sb.Insert(0, "me; "); } else { sb.Append(StaffNameAndRoleFormat.Format(staffSummary)); sb.Append(itemSeparator); } } foreach (var groupSummary in groupRecipients) { sb.Append(groupSummary.Name); sb.Append(itemSeparator); } return(sb.ToString().TrimEnd(itemSeparator.ToCharArray())); }
/// <summary> /// Formats the specified Staff (must be a JSML encoded <see cref="StaffSummary"/> or <see cref="StaffDetail"/> object). /// </summary> /// <param name="jsml"></param> /// <returns></returns> public string FormatStaffNameAndRole(string jsml) { try { var staffSummary = JsmlSerializer.Deserialize <StaffSummary>(jsml); return(staffSummary == null ? "" : StaffNameAndRoleFormat.Format(staffSummary)); } catch (InvalidCastException) { var staffDetail = JsmlSerializer.Deserialize <StaffDetail>(jsml); return(staffDetail == null ? "" : StaffNameAndRoleFormat.Format(staffDetail)); } }
private OrderNoteboxTable(int cellRowCount) : base(cellRowCount) { var resolver = new ResourceResolver(this.GetType().Assembly); var urgentColumn = new TableColumn <OrderNoteboxItemSummary, IconSet>(SR.ColumnUrgent, item => item.Urgent ? new IconSet("SingleExclamation.png") : null, 0.3f) { Comparison = (item1, item2) => item1.Urgent.CompareTo(item2.Urgent), ResourceResolver = resolver }; this.Columns.Add(urgentColumn); /* JR: this isn't needed right now, because acknowledged notes are never shown. * TableColumn<OrderNoteboxItemSummary, IconSet> acknowledgedColumn = * new TableColumn<OrderNoteboxItemSummary, IconSet>(SR.ColumnStatus, * delegate(OrderNoteboxItemSummary item) { return GetIsAcknowledgedIcon(item.IsAcknowledged); }, * 0.3f); * acknowledgedColumn.Comparison = delegate(OrderNoteboxItemSummary item1, OrderNoteboxItemSummary item2) * { return item1.IsAcknowledged.CompareTo(item2.IsAcknowledged); }; * acknowledgedColumn.ResourceResolver = resolver; * this.Columns.Add(acknowledgedColumn); */ this.Columns.Add(new TableColumn <OrderNoteboxItemSummary, string>(SR.ColumnMRN, item => MrnFormat.Format(item.Mrn), 1.0f)); this.Columns.Add(new TableColumn <OrderNoteboxItemSummary, string>(SR.ColumnPatientName, item => PersonNameFormat.Format(item.PatientName), 1.0f)); this.Columns.Add(new TableColumn <OrderNoteboxItemSummary, string>(SR.ColumnDescription, item => string.Format("{0} {1}", AccessionFormat.Format(item.AccessionNumber), item.DiagnosticServiceName), 1.0f, 1)); this.Columns.Add(new TableColumn <OrderNoteboxItemSummary, string>(SR.ColumnFrom, item => item.OnBehalfOfGroup != null ? String.Format(SR.FormatFromOnBehalf, StaffNameAndRoleFormat.Format(item.Author), item.OnBehalfOfGroup.Name, item.PostTime) : String.Format(SR.FormatFrom, StaffNameAndRoleFormat.Format(item.Author), item.PostTime), 1.0f, 2)); this.Columns.Add(new TableColumn <OrderNoteboxItemSummary, string>(SR.ColumnTo, item => String.Format(SR.FormatTo, RecipientsList(item.StaffRecipients, item.GroupRecipients)), 1.0f, 3)); this.Columns.Add(_postTimeColumn = new DateTimeTableColumn <OrderNoteboxItemSummary>(SR.ColumnPostTime, item => item.PostTime)); _postTimeColumn.Visible = false; this.Sort(new TableSortParams(_postTimeColumn, false)); }
public static string Format(object staffOrGroup) { return((staffOrGroup is StaffSummary) ? StaffNameAndRoleFormat.Format(((StaffSummary)staffOrGroup)) : (staffOrGroup is StaffGroupSummary) ? ((StaffGroupSummary)staffOrGroup).Name : string.Empty); }
public OrderNoteTable() : base(2) { this.Columns.Add(new TableColumn <OrderNoteDetail, string>(SR.ColumnAuthor, n => n.Author == null ? SR.LabelMe : StaffNameAndRoleFormat.Format(n.Author), 0.25f)); this.Columns.Add(new TableColumn <OrderNoteDetail, string>(SR.ColumnPostTime, n => n.PostTime == null ? SR.LabelNew : Format.DateTime(n.PostTime), 0.25f)); this.Columns.Add(_linkColumn = new TableColumn <OrderNoteDetail, string>(" ", n => SR.ColumnMore, 0.05f)); this.Columns.Add(new TableColumn <OrderNoteDetail, string>(SR.ColumnComments, n => RemoveLineBreak(n.NoteBody), 0.5f, 1)); }
public override string FormatItem(StaffSummary item) { return(StaffNameAndRoleFormat.Format(item)); }