public ShiftCrewDto GetShiftCrew( string profileName, DateTime?date = null) { date ??= DateTime.Now; if (!startedEvent.WaitOne(TimeSpan.FromMinutes(1))) { logger.LogWarning("Not Initialized shift service daemon"); return(null); } if (GetShiftProfile(profileName, date, date) == null) { logger.LogWarning("Not profile available with Name:{0} and Date:{1}", profileName, date); return(null); } ShiftCrewDto result = null; lock (this) Scoped((_, shiftScope) => { result = shiftScope.GetShiftCrew(profileName, date); }); return(result); }
private void ShiftScopedPublishShiftCrew(object sender, ShiftCrewDto shiftCrew) { logger.LogInformation("PublishShiftCrew {@shiftCrew}", shiftCrew); var profile = GetShiftProfile(shiftCrew.NameShiftProfile); if (profile != null && connector != null && !string.IsNullOrWhiteSpace(profile.TagPublish)) { connector.SetJson(profile.TagPublish, shiftCrew); } PublishShiftCrew?.Invoke(this, shiftCrew); notification?.OnUpdateShiftCrew(shiftCrew); }