public List <CommunityNews> GetNotifications(List <Guid> notificationsID, int UserLanguageID, int DefaultLanguageID) { List <CommunityNews> iResponse = new List <CommunityNews>(); using (ISession session = NHSessionHelper.GetSession()) { try { foreach (Guid ID in notificationsID) { NotificationBase notification = (from nb in session.Linq <NotificationBase>() where nb.UniqueNotifyID == ID && nb.LanguageID == UserLanguageID select nb).FirstOrDefault <NotificationBase>(); if (notification.UniqueNotifyID != System.Guid.Empty) { CommunityNews news = new CommunityNews(notification.UniqueNotifyID, notification.CommunityID, notification.SentDate, notification.Day, notification.Message, notification.ModuleID); iResponse.Add(news); } } } catch (Exception ex) { iResponse = new List <CommunityNews>(); } } return(iResponse); }
public DynamicNotification(NotificationBase model) { InitializeComponent(); Bind(model); MouseDown += (sender, args) => { this.Notification.Close(); }; }
public void RemoveNotification(NotificationBase notificationBase) { Items.Remove(notificationBase); if (Items.Count < maxCountNotification && notifications.Count != 0) { var notification = notifications.Dequeue(); Add(notification); } }
protected virtual bool GetMessage(NotificationBase notification, out string message) { if (notification is INotificationMessage) { message = ((INotificationMessage)notification).Message; return true; } message = null; return false; }
public void AddNotification(NotificationBase notificationBase, bool addForce = false) { if (Items.Count < maxCountNotification || addForce) { Add(notificationBase); } else { notifications.Enqueue(notificationBase); } }
public async Task SendNotification(NotificationBase notification, string path) { HttpClient client = new HttpClient(); string url = this.configurationComponent.OwlveyNofiticationApi + path; StringContent content = new StringContent( JsonConvert.SerializeObject(notification) , Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); if (!response.IsSuccessStatusCode) { throw new ApplicationException("notification fails " + response.StatusCode.ToString()); } }
private static MailMessage CreateMessage(NotificationBase notification) { var message = new MailMessage { Subject = notification.Subject, Body = notification.Text, IsBodyHtml = true, From = EnarodMailbox.From }; message.To.Add(notification.Recipient); return(message); }
/// <summary> /// Invokes notifications on the bot /// </summary> /// <param name="notification">Notification to be sent</param> /// <returns></returns> internal Task ProcessNotificationResult(NotificationBase notification) { Trace.TraceInformation( $"RealTimeMediaCallService [{CallLegId}]: Received the notification for {notification.Type} operation, callId: {notification.Id}"); switch (notification.Type) { case NotificationType.CallStateChange: return(HandleCallStateChangeNotification(notification as CallStateChangeNotification)); case NotificationType.RosterUpdate: return(HandleRosterUpdateNotification(notification as RosterUpdateNotification)); } throw new BotCallingServiceException($"[{CallLegId}]: Unknown notification type {notification.Type}"); }
public static TestNotificationRequest ToNotificationDto(this NotificationBase notification) { var result = new TestNotificationRequest { Language = notification.Language.CultureName, ObjectId = notification.StoreId, ObjectTypeId = "Store", Type = notification.Type, NotificationParameters = notification.GetNotificationParameters().Select(x => new NotificationParameter { Type = "String", Value = x.Value, ParameterName = x.Key }).ToList() }; return(result); }
private RabbitConfigurationModel GetConfigurationForNotification(NotificationBase notification) { if (notification.HasException()) { return(RabbitConfigurationModel.Factory.NewConfigurationForException()); } else if (notification.HasError()) { return(RabbitConfigurationModel.Factory.NewConfigurationForError()); } else { return(null); } }
private object GetMessageForNotification(NotificationBase notification) { if (notification.HasException()) { return(notification.Exception); } else if (notification.HasError()) { return(notification.Message); } else { return(null); } }
public async Task <Category> Handle(AddCategoryCmd request, CancellationToken cancellationToken) { CategoryId categoryId = this.repository.GenerateCategoryId(); Category category = Category.CreateCategory(categoryId, request.Name, request.Level, request.IconPath); var @event = category.DomainEvents.First(o => o is CategoryCreated) as CategoryCreated; this.repository.Save(category, @event); NotificationBase <CategoryCreated> createdNotification = new NotificationBase <CategoryCreated>(@event); await this.mediator.Publish(createdNotification, cancellationToken); return(await Task.FromResult(category)); }
private void Preprocessing2(NotificationBase notificationError) { string MessageTypeStr = notificationError.ToString(); MessageTypeStr = MessageTypeStr.Substring(MessageTypeStr.LastIndexOf(".") + 1) + ",NoteID:" + notificationError.customer_ID + ",TaskID:" + notificationError.serverTask_ID.ToString() + ",NotificationID:" + notificationError.notification_ID.ToString(); OutPut("Error#" + MessageTypeStr); /* * string NotificationStr = null; * if (notificationError is CountNotification) * { * CountNotification MyCountNotifi = notificationError as CountNotification; * NotificationStr = "count#" + MyCountNotifi.customer_ID + ",IN:" + MyCountNotifi.count_in.ToString() + ";OUT:" + MyCountNotifi.count_out.ToString() + ",TaskID:" + MyCountNotifi.serverTask_ID.ToString() + ",GateID:" + MyCountNotifi.counting_gate_id.id; * * HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager(); * CountingHelper MyCountingHelper = new CountingHelper(MyCountNotifi.customer_ID, MyCountNotifi.serverTask_ID, (int)MyCountNotifi.count_in, (int)MyCountNotifi.count_out); * //CountingMannager MyCountingMannager = new CountingMannager("ABC987654321", 1000, 1, 1); * CountingHelper.DoUpdateWork(MyHellaAPCECOManager, MyCountingHelper); * * } * * if (notificationError is StartupNotification) * { * StartupNotification MyStartNotifi = notificationError as StartupNotification; * NotificationStr = "start#" + MyStartNotifi.customer_ID + ",TaskID:" + MyStartNotifi.serverTask_ID.ToString() + "," + MyStartNotifi.ip_address + "," + MyStartNotifi.mac_address; * * * } * * if (notificationError is AliveNotification) * { * AliveNotification MyAliveNotifi = notificationError as AliveNotification; * NotificationStr = "keepalive#" + MyAliveNotifi.customer_ID + ",TaskID:" + MyAliveNotifi.serverTask_ID.ToString() + "," + MyAliveNotifi.ip_address + "," + MyAliveNotifi.mac_address; * * * } * * * if (NotificationStr != null) * { * OutPut(NotificationStr); * * //SoapMessageLogExtension MySoapMessageLogExtension = new SoapMessageLogExtension(); * //MySoapMessageLogExtension.LGJLogTextMessage(NotificationStr, notification.Item.GetType()); * * } */ }
private async Task <SendNotificationResult> SendNotificationAsync(NotificationBase notification) { var result = new SendNotificationResult(); try { result = await _platformNotificationApi.SendNotificationAsync(notification.ToNotificationDto()); } catch { result.IsSuccess = false; result.ErrorMessage = "Error occurred while sending notification"; } return(result); }
public async Task <NotificationBase> BuildAttackMessage(string user, params int[] attackIds) { var notify = new NotificationBase() { Login = user, SiteType = SiteTypes.Dns }; var attacksToNotify = await _dbContext .DnsAttacks .Where(x => attackIds.Contains(x.Id)) .Include(x => x.Histories) .ToListAsync(); notify.Email = BuildAttackEmailMessage(attacksToNotify); return(notify); }
public void Add(string queuename, NotificationBase notification) { lock (lockObj) { if (!_notification.ContainsKey(queuename)) { _notification.Add(queuename, new List <NotificationBase>()); } } lock (lockObj) { var nb = _notification[queuename]; nb.Add(notification); } }
private void OnNotify(object sender, NotificationBase notification) { string message; if (GetMessage(notification, out message)) { // reset the timer to zero _timer?.Change(0, 0); Text = message; if (_timer == null) { _timer = new Timer(OnTimerCallback); } _timer.Change(5000, 0); } }
/// <summary> /// Find container for notification by screen if not found container create new and then add notification to container associated with the screen /// </summary> /// <param name="screen">Screen where show notification</param> /// <param name="notification">Notification</param> /// <param name="addForce">If tru Add to stack notifications if count notification more then max</param> void AddNotification(Screen screen, NotificationBase notification, bool addForce = false) { NotificationsContainerWindow window = null; lock (lockObj) { windowsForNotifications.TryGetValue(screen.DeviceName, out window); if (window == null) { window = new NotificationsContainerWindow(screen); window.Show(); windowsForNotifications[screen.DeviceName] = window; } } (window.DataContext as NotificationsContainerViewModel)?.AddNotification(notification, addForce); window.Show(); }
public static OperationResult Send(NotificationBase notification) { OperationResult result; var message = NotificationService.CreateMessage(notification); try { NotificationService.Client.Send(message); result = OperationResult.Success(11, notification.SuccessfulySentMessage); } catch (Exception exception) { result = OperationResult.ExceptionResult(exception); } return(result); }
private async Task <NotificationSendResult> SendNotificationAsync(NotificationBase notification) { NotificationSendResult result; try { result = await _platformNotificationApi.SendNotificationByRequestAsync(notification.ToNotificationDto()); } catch (Exception exception) { result = new NotificationSendResult { IsSuccess = false, ErrorMessage = $"Error occurred while sending notification: {exception.Message}" }; } return(result); }
private void Preprocessing2(NotificationBase notificationError) { LGJSynchTcpClient MyLGJSynchTcpClient = new LGJSynchTcpClient(null, null, null, "8000"); string MessageTypeStr = notificationError.ToString(); MessageTypeStr = MessageTypeStr.Substring(MessageTypeStr.IndexOf(".") + 1); MyLGJSynchTcpClient.SendMessage("APC-Error#" + MessageTypeStr); string NotificationStr = null; if (notificationError is CountNotification) { CountNotification MyCountNotifi = notificationError as CountNotification; NotificationStr = "APC-count#" + MyCountNotifi.customer_ID + ",IN:" + MyCountNotifi.count_in.ToString() + ";OUT:" + MyCountNotifi.count_out.ToString() + ",TaskID:" + MyCountNotifi.serverTask_ID.ToString() + ",GateID:" + MyCountNotifi.counting_gate_id.id; HellaAPCECOMannager MyHellaAPCECOManager = new HellaAPCECOMannager(); CountingHelper MyCountingHelper = new CountingHelper(MyCountNotifi.customer_ID, MyCountNotifi.serverTask_ID, (int)MyCountNotifi.count_in, (int)MyCountNotifi.count_out); //CountingMannager MyCountingMannager = new CountingMannager("ABC987654321", 1000, 1, 1); CountingHelper.DoUpdateWork(MyHellaAPCECOManager, MyCountingHelper); } if (notificationError is StartupNotification) { StartupNotification MyStartNotifi = notificationError as StartupNotification; NotificationStr = "APC-start#" + MyStartNotifi.customer_ID + ",TaskID:" + MyStartNotifi.serverTask_ID.ToString() + "," + MyStartNotifi.ip_address + "," + MyStartNotifi.mac_address; } if (notificationError is AliveNotification) { AliveNotification MyAliveNotifi = notificationError as AliveNotification; NotificationStr = "APC-keepalive#" + MyAliveNotifi.customer_ID + ",TaskID:" + MyAliveNotifi.serverTask_ID.ToString() + "," + MyAliveNotifi.ip_address + "," + MyAliveNotifi.mac_address; } if (NotificationStr != null) { MyLGJSynchTcpClient.SendMessage(NotificationStr); //SoapMessageLogExtension MySoapMessageLogExtension = new SoapMessageLogExtension(); //MySoapMessageLogExtension.LGJLogTextMessage(NotificationStr, notification.Item.GetType()); } }
private void Add(NotificationBase notificationBase) { int i = 0; for (; i < Items.Count; i++) { if (notificationBase.Position <= Items[i].Position) { break; } } Items.Insert(i, notificationBase); void Notification_Closed(object sender, EventArgs e) { RemoveNotification(notificationBase); notificationBase.Closed -= Notification_Closed; } notificationBase.Closed += Notification_Closed; }
private void HandleError(MessageWrapper messageWrapper, string reason, NotificationBase notification) { if (!_fileSystemService.FileExists(messageWrapper.File)) { return; } MoveMessageRequestToErrorDirectory(messageWrapper.File); if (!notification.HasErrors) { Logger.Log(NotificationSeverity.Error, reason); //// ReSharper disable AssignNullToNotNullAttribute File.WriteAllText(Path.Combine(_errorMessageDirectory, Path.GetFileName(messageWrapper.File + ErrorReasonFileExtension)), reason); //// ReSharper restore AssignNullToNotNullAttribute } else { //// ReSharper disable AssignNullToNotNullAttribute File.WriteAllText(Path.Combine(_errorMessageDirectory, Path.GetFileName(messageWrapper.File + ErrorReasonFileExtension)), reason + Environment.NewLine + notification); //// ReSharper restore AssignNullToNotNullAttribute } messageWrapper.Processed = true; }
public void Publish(NotificationBase @event) { if (!_persistentConnection.IsConnected) { _persistentConnection.TryConnect(); } var policy = Policy.Handle <BrokerUnreachableException>() .Or <SocketException>() .WaitAndRetry(_retryCount, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (ex, time) => { _logger.LogWarning(ex.ToString()); }); using (var channel = _persistentConnection.CreateModel()) { var eventName = GetEventKey(@event); channel.ExchangeDeclare(exchange: _brokerName, type: "direct"); channel.QueueBind(queue: _eventQueueName, exchange: _brokerName, routingKey: eventName); var message = JsonConvert.SerializeObject(@event); _logger.LogDebug(message); var body = Encoding.UTF8.GetBytes(message); policy.Execute(() => { var properties = channel.CreateBasicProperties(); properties.DeliveryMode = 2; // persistent channel.BasicPublish(exchange: _brokerName, routingKey: eventName, mandatory: true, basicProperties: properties, body: body); }); } }
public async Task <ActionResult> ForgotPassword(ForgotPassword formModel) { TryValidateModel(formModel); if (!ModelState.IsValid) { return(View("customers/forgot_password", WorkContext)); } var user = await _signInManager.UserManager.FindByEmailAsync(formModel.Email); if (user == null) { user = await _signInManager.UserManager.FindByNameAsync(formModel.Email); } if (user == null) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.OperationFailed()); return(View("customers/forgot_password", WorkContext)); } var successViewName = "customers/forgot_password"; NotificationBase resetPasswordNotification = null; if (_options.ResetPasswordNotificationGateway.EqualsInvariant("Phone")) { successViewName = "customers/forgot_password_code"; var phoneNumber = await _signInManager.UserManager.GetPhoneNumberAsync(user); if (string.IsNullOrEmpty(phoneNumber)) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.PhoneNumberNotFound()); return(View("customers/forgot_password", WorkContext)); } var token = await _signInManager.UserManager.GenerateUserTokenAsync(user, TokenOptions.DefaultPhoneProvider, "ResetPassword"); resetPasswordNotification = new ResetPasswordSmsNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Token = token, Recipient = phoneNumber, }; // This required for populate hidden fields on the form WorkContext.Form = Form.FromObject(new ResetPasswordByCodeModel { Email = user.Email }); } else // "Email" { var token = await _signInManager.UserManager.GeneratePasswordResetTokenAsync(user); var callbackUrl = Url.Action("ResetPassword", "Account", new { UserId = user.Id, Token = token }, protocol: Request.Scheme, host: WorkContext.CurrentStore.Host); resetPasswordNotification = new ResetPasswordEmailNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Url = callbackUrl, Sender = WorkContext.CurrentStore.Email, Recipient = GetUserEmail(user) }; } var sendingResult = await SendNotificationAsync(resetPasswordNotification); if (sendingResult.IsSuccess == true) { return(View(successViewName, WorkContext)); } WorkContext.Form.Errors.Add(SecurityErrorDescriber.ErrorSendNotification(sendingResult.ErrorMessage)); return(View("customers/forgot_password", WorkContext)); }
public async Task <ActionResult> Login([FromForm] Login login, [FromQuery] string returnUrl) { TryValidateModel(login); // This required for populate fields on form on post-back WorkContext.Form = Form.FromObject(login); if (!ModelState.IsValid) { return(View("customers/login", WorkContext)); } login.UserName = login.UserName?.Trim(); var user = await _signInManager.UserManager.FindByNameAsync(login.UserName); if (user == null) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.LoginFailed()); return(View("customers/login", WorkContext)); } if (!new CanUserLoginToStoreSpecification(user).IsSatisfiedBy(WorkContext.CurrentStore)) { if (login.ForceLoginToAccountStore) { var store = WorkContext.AllStores.First(x => x.Id == user.StoreId); var url = HttpContext.Request.GetEncodedUrl(); var redirectUrl = _urlBuilder.ToStoreAbsolute(url, store, store.DefaultLanguage); return(RedirectPreserveMethod(redirectUrl)); } WorkContext.Form.Errors.Add(SecurityErrorDescriber.UserCannotLoginInStore()); return(View("customers/login", WorkContext)); } if (new IsUserLockedOutSpecification().IsSatisfiedBy(user)) { return(View("lockedout", WorkContext)); } if (new IsUserSuspendedSpecification().IsSatisfiedBy(user)) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.AccountIsBlocked()); return(View("customers/login", WorkContext)); } var loginResult = await _signInManager.PasswordSignInAsync(login.UserName, login.Password, login.RememberMe, lockoutOnFailure : true); if (loginResult.Succeeded) { await _publisher.Publish(new UserLoginEvent(WorkContext, user)); if (new IsUserPasswordExpiredSpecification().IsSatisfiedBy(user)) { //the sign in operation doesn't change the current request user principal, this only happens on incoming requests when the cookie or bearer token is set. //Need to manually set User in the HttpContext to avoid issues such as Antiforegery cookies generated for anonymous within this request despite the user has already signed in. HttpContext.User = await _signInManager.ClaimsFactory.CreateAsync(user); WorkContext.Form = Form.FromObject(new ResetPassword { Token = await _signInManager.UserManager.GenerateUserTokenAsync(user, TokenOptions.DefaultProvider, "ResetPassword"), Email = user.Email, UserName = user.UserName }); return(View("customers/reset_password", WorkContext)); } return(StoreFrontRedirect(returnUrl)); } if (loginResult.RequiresTwoFactor) { var selectedProvider = _options.TwoFactorAuthenticationNotificationGateway; var userManager = _signInManager.UserManager; var code = await userManager.GenerateTwoFactorTokenAsync(user, selectedProvider); if (string.IsNullOrWhiteSpace(code)) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.OperationFailed()); return(View("customers/login", WorkContext)); } NotificationBase twoFactorNotification = null; var veryfyCodeViewModel = new VerifyCodeViewModel { Provider = selectedProvider, ReturnUrl = returnUrl, RememberMe = login.RememberMe, Username = login.UserName }; if (veryfyCodeViewModel.Provider.EqualsInvariant("Phone")) { var phoneNumber = await userManager.GetPhoneNumberAsync(user); if (string.IsNullOrEmpty(phoneNumber)) { // Do not tell we have this user without phone WorkContext.Form.Errors.Add(SecurityErrorDescriber.OperationFailed()); return(View("customers/login", WorkContext)); } twoFactorNotification = new TwoFactorSmsNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Token = code, Recipient = phoneNumber, }; } else // "Email" { twoFactorNotification = new TwoFactorEmailNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Token = code, Sender = WorkContext.CurrentStore.Email, Recipient = GetUserEmail(user) }; } var sendingResult = await SendNotificationAsync(twoFactorNotification); if (sendingResult.IsSuccess != true) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.ErrorSendNotification(sendingResult.ErrorMessage)); return(View("customers/login", WorkContext)); } WorkContext.Form = Form.FromObject(veryfyCodeViewModel); return(View("customers/verify_code", WorkContext)); } WorkContext.Form.Errors.Add(SecurityErrorDescriber.LoginFailed()); return(View("customers/login", WorkContext)); }
public async Task <ActionResult> Login([FromForm] Login login, string returnUrl) { TryValidateModel(login); // This required for populate fields on form on post-back WorkContext.Form = Form.FromObject(login); if (!ModelState.IsValid) { return(View("customers/login", WorkContext)); } login.UserName = login.UserName?.Trim(); var loginResult = await _signInManager.PasswordSignInAsync(login.UserName, login.Password, login.RememberMe, lockoutOnFailure : true); if (loginResult.Succeeded) { var user = await _signInManager.UserManager.FindByNameAsync(login.UserName); // Check that current user can sing in to current store if (new CanUserLoginToStoreSpecification(user).IsSatisfiedBy(WorkContext.CurrentStore) && new IsUserSuspendedSpecification().IsSatisfiedBy(user) == false) { await _publisher.Publish(new UserLoginEvent(WorkContext, user)); return(StoreFrontRedirect(returnUrl)); } else { WorkContext.Form.Errors.Add(SecurityErrorDescriber.UserCannotLoginInStore()); await _signInManager.SignOutAsync(); loginResult = Microsoft.AspNetCore.Identity.SignInResult.NotAllowed; } } if (loginResult.RequiresTwoFactor) { var user = await _signInManager.UserManager.FindByNameAsync(login.UserName); if (user == null) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.OperationFailed()); return(View("customers/login", WorkContext)); } var selectedProvider = _options.TwoFactorAuthenticationNotificationGateway; var userManager = _signInManager.UserManager; var code = await userManager.GenerateTwoFactorTokenAsync(user, selectedProvider); if (string.IsNullOrWhiteSpace(code)) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.OperationFailed()); return(View("customers/login", WorkContext)); } NotificationBase twoFactorNotification = null; var veryfyCodeViewModel = new VerifyCodeViewModel { Provider = selectedProvider, ReturnUrl = returnUrl, RememberMe = login.RememberMe, Username = login.UserName }; if (veryfyCodeViewModel.Provider.EqualsInvariant("Phone")) { var phoneNumber = await userManager.GetPhoneNumberAsync(user); if (string.IsNullOrEmpty(phoneNumber)) { // Do not tell we have this user without phone WorkContext.Form.Errors.Add(SecurityErrorDescriber.OperationFailed()); return(View("customers/login", WorkContext)); } twoFactorNotification = new TwoFactorSmsNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Token = code, Recipient = phoneNumber, }; } else // "Email" { twoFactorNotification = new TwoFactorEmailNotification(WorkContext.CurrentStore.Id, WorkContext.CurrentLanguage) { Token = code, Sender = WorkContext.CurrentStore.Email, Recipient = GetUserEmail(user) }; } var sendingResult = await SendNotificationAsync(twoFactorNotification); if (sendingResult.IsSuccess != true) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.ErrorSendNotification(sendingResult.ErrorMessage)); return(View("customers/login", WorkContext)); } WorkContext.Form = Form.FromObject(veryfyCodeViewModel); return(View("customers/verify_code", WorkContext)); } if (loginResult.IsLockedOut) { return(View("lockedout", WorkContext)); } if (loginResult is CustomSignInResult signInResult && signInResult.IsRejected) { WorkContext.Form.Errors.Add(SecurityErrorDescriber.AccountIsBlocked()); } WorkContext.Form.Errors.Add(SecurityErrorDescriber.LoginFailed()); return(View("customers/login", WorkContext)); }
public SendMessageRabbitRequest(NotificationBase notification) { Notification = notification; }
private void CreateOrUpdateCounterListItem(NotificationContainer notification, ErrorContainer error) { CounterListItemType counterListItem = null; DateTime now = DateTime.Now; string mac_address; NotificationBase notificationBase = null; ExtendedNotificationBase extNotificationBase = null; if (notification != null) { mac_address = notification.Item.mac_address; notificationBase = notification.Item as NotificationBase; if (notification.Item is ExtendedNotificationBase) { extNotificationBase = notification.Item as ExtendedNotificationBase; } } else if (error != null) { mac_address = error.mac_address; notificationBase = error as NotificationBase; extNotificationBase = error as ExtendedNotificationBase; } else { return; } counterListItem = GetCounterListItemByMacAddress(mac_address); if (counterListItem == null) { counterListItem = new CounterListItemType(); counterList.Add(counterListItem); counterListItem.mac_address = mac_address; counterListItem.registered_timestamp = now; counterListItem.updated_timestamp = now; counterListItem.notifications_count = 0; counterListItem.errors_count = 0; } if (extNotificationBase != null) { if (!string.Equals(extNotificationBase.ip_address, counterListItem.ip_address)) { counterListItem.ip_address = extNotificationBase.ip_address; counterListItem.updated_timestamp = now; } } if (notificationBase != null) { if (!string.Equals(notificationBase.customer_ID, counterListItem.customer_ID)) { counterListItem.customer_ID = notificationBase.customer_ID; counterListItem.updated_timestamp = now; } } if (notification != null) { counterListItem.last_notification_ID = notification.Item.notification_ID; counterListItem.last_notification_timestamp = notification.Item.timestamp; counterListItem.last_notification_type = notification.Item.task_type; counterListItem.notifications_count++; } else if (error != null) { counterListItem.last_error_ID = error.notification_ID; counterListItem.last_error_timestamp = error.timestamp; counterListItem.last_error_reason = error.error_reason; counterListItem.errors_count++; } counterListItem.changed = true; }
public Task Handle(NotificationBase <ProductCreated> notification, CancellationToken cancellationToken) { throw new NotImplementedException(); }
public AudioPlayerNotification(NotificationBase model) { InitializeComponent(); Bind(model); }
private void CloseAction(NotificationBase obj) { var opts = obj.DisplayPart.GetOptions(); _vm.ShowInformation($"Notification close clicked, Tag: {opts.Tag}"); }