internal static void NotifyOccurrenceUpdate(Guid?clientId, Altask.Data.Dto.Occurrence occurrence) { if (!clientId.HasValue) { _context.Clients.All.notifyOccurrenceUpdate(new { occurrence = occurrence }); } else { SignalRConnection connection; if (_connections.TryGetValue(clientId.Value, out connection)) { _context.Clients.AllExcept(connection.ConnectionId).notifyOccurrenceUpdate(new { connection = connection, occurrence = occurrence }); } else { _context.Clients.All.notifyOccurrenceCreate(new { occurrence = occurrence }); } } }
/// <summary> /// Maps all the non-primary key and tracking properties of a <see cref='Altask.Data.Dto.Occurrence'/> object to a <see cref='Altask.Data.Model.Occurrence'/> object. /// </summary> public static Altask.Data.Model.Occurrence FromDto(this Altask.Data.Model.Occurrence model, Altask.Data.Dto.Occurrence entity) { model.TaskId = entity.TaskId; model.ScheduleId = entity.ScheduleId; model.AssetId = entity.AssetId; model.UserId = entity.UserId; model.FormModel = entity.FormModel; model.XmlResults = entity.XmlResults; model.AsEarlyAsDate = entity.AsEarlyAsDate; model.Date = entity.Date; model.Dismissed = entity.Dismissed; model.DismissedBy = entity.DismissedBy; model.DismissedOn = entity.DismissedOn; model.Started = entity.Started; model.StartedBy = entity.StartedBy; model.StartedOn = entity.StartedOn; model.StoppedBy = entity.StoppedBy; model.StoppedOn = entity.StoppedOn; model.ResumedBy = entity.ResumedBy; model.ResumedOn = entity.ResumedOn; model.Completed = entity.Completed; model.CompletedBy = entity.CompletedBy; model.CompletedOn = entity.CompletedOn; model.TimeSpent = entity.TimeSpent; return(model); }
/// <summary> /// Maps a <see cref='Altask.Data.Model.Occurrence'/> object to a <see cref='Altask.Data.Dto.Occurrence'/> object. /// </summary> /// <param name="includeLogs">Indicates whether to load any logs associated with the object when mapping.</param> public static Altask.Data.Dto.Occurrence ToDto(this Altask.Data.Model.Occurrence entity, bool includeLogs = false) { var dto = new Altask.Data.Dto.Occurrence(); dto.Id = entity.Id; dto.TaskId = entity.TaskId; dto.ScheduleId = entity.ScheduleId; dto.AssetId = entity.AssetId; dto.UserId = entity.UserId; dto.FormModel = entity.FormModel; dto.XmlResults = entity.XmlResults; dto.AsEarlyAsDate = entity.AsEarlyAsDate; dto.Date = entity.Date; dto.Dismissed = entity.Dismissed; dto.DismissedBy = entity.DismissedBy; dto.DismissedOn = entity.DismissedOn; dto.Started = entity.Started; dto.StartedBy = entity.StartedBy; dto.StartedOn = entity.StartedOn; dto.StoppedBy = entity.StoppedBy; dto.StoppedOn = entity.StoppedOn; dto.ResumedBy = entity.ResumedBy; dto.ResumedOn = entity.ResumedOn; dto.Completed = entity.Completed; dto.CompletedBy = entity.CompletedBy; dto.CompletedOn = entity.CompletedOn; dto.TimeSpent = entity.TimeSpent; dto.CreatedBy = entity.CreatedBy; dto.CreatedOn = entity.CreatedOn; dto.UpdatedBy = entity.UpdatedBy; dto.UpdatedOn = entity.UpdatedOn; if (entity.Asset != null) { dto.Asset = entity.Asset.ToDto(); } if (entity.Schedule != null) { dto.Schedule = entity.Schedule.ToDto(); } if (entity.Task != null) { dto.Task = entity.Task.ToDto(); } if (entity.User != null) { dto.User = entity.User.ToDto(); } dto.Logs = new List <Altask.Data.Dto.OccurrenceLog>(); if (includeLogs) { if (entity.Logs != null) { foreach (var item in entity.Logs) { dto.Logs.Add(item.ToDto()); } } } return(dto); }
internal async Task <EntityResult> AfterUpdateAsync(Altask.www.Models.TaskInstance instance, Altask.Data.Dto.Occurrence occurrence, bool notifyAll = false) { SignalRHub.NotifyOccurrenceUpdate(ClientId, instance, occurrence); return(await System.Threading.Tasks.Task.FromResult(EntityResult.Succeded(0))); }