예제 #1
0
 public void SaveObjects(Entities.IEntitySession session, IList<object> items)
 {
     foreach (NotificationLogEntry entry in items) {
     var ent = session.NewLogEntity<INotificationLog>(entry);
     var msg = entry.Message;
     ent.Type = msg.Type;
     ent.MediaType = msg.MediaType;
     ent.Error = msg.Error;
     ent.AttemptCount = msg.AttemptCount;
     ent.Status = msg.Status.ToString();
     ent.MainRecipientUserId = msg.MainRecipientUserId;
     ent.Recipients = msg.Recipients;
     var recipients = entry.Message.Recipients.Split(';');
     switch (recipients.Length) {
       case 0:
     ent.MainRecipient = "(none)";
     break;
       case 1:
     ent.MainRecipient = recipients[0];
     break;
       default:
     ent.MainRecipient = recipients[0];
     break;
     }
     if (entry.Message.Attachments.Count > 0)
       ent.AttachmentList = string.Join(", ", entry.Message.Attachments.Select(a => a.ToString()));
     //simplified for now
     ent.Parameters = string.Join("|||", msg.Parameters.Select(kv => kv.Key + "=" + kv.Value));
       }//foreach
 }