protected override void EditItem(object parameter) { log.Debug("Edit " + ItemName + " button"); PartnerEntity Item = new PartnerEntity(); EntityCloner.CloneProperties <PartnerEntity>(SelectedItem, Item); EditPartnerViewModel EPVM = new EditPartnerViewModel(Item, false, ItemName); EditItemWindow EIV = new EditItemWindow() { DataContext = EPVM }; EIV.ShowDialog(); if (EPVM.SaveEdit) { Item = EPVM.Item; NotificationProvider.Info("Partner saved", string.Format("Partner name:{0}", Item.Name)); RefreshList(parameter); foreach (var p in List) { if (Item.Id == p.Id) { SelectedItem = p; } } } }
private void Login(object parameter) { log.Debug("Login button"); PasswordBox pwBox = (PasswordBox)parameter; Password = pwBox.Password; if (!DatabaseConnection.TestConnection()) { NotificationProvider.Alert("Database connection error", "Please set the database connection, before login."); } else { try { UserLogin.Login(UserID, Password); NotificationProvider.Info(String.Format("Welcome, {0}!", UserID), "You have succesfully logged in."); LoginWindow.Close(); } catch (ArgumentException e) { NotificationProvider.Error("Login error", e.Message); } } }
public ActionResult Index() { var notificationProvider = new NotificationProvider(this); notificationProvider.LoadNotifications(); return(View()); }
private void ModifyUser(object parameter) { log.Debug("Modify user button"); PasswordBox pwBox = (PasswordBox)parameter; string OldPassword = pwBox.Password; if (string.IsNullOrWhiteSpace(_oldUserID) || string.IsNullOrWhiteSpace(OldPassword) || string.IsNullOrWhiteSpace(UserID) || string.IsNullOrWhiteSpace(Password) || string.IsNullOrWhiteSpace(Confirm)) { NotificationProvider.Error("Edit user error", "Please fill the Username and Password fieleds."); } else { try { if (UserLogin.ModifyUser(_oldUserID, OldPassword, UserID, Password, Confirm)) { NotificationProvider.Info(String.Format("User modified: {0}", _oldUserID), String.Format("New username: {0}", UserID)); EditWindow?.Close(); } else { NotificationProvider.Error("Edit user error", "Database error"); } } catch (ArgumentException e) { switch (e.ParamName) { case "oldUserID": NotificationProvider.Error("Edit user error", "The original username is missing from the database."); break; case "oldPassword": NotificationProvider.Error("Edit user error", "The old password is wrong."); break; case "newUserId": NotificationProvider.Error("Edit user error", "The new username already exist."); break; case "password": NotificationProvider.Error("Edit user error", "Please fill the password field."); break; case "confirm": NotificationProvider.Error("Edit user error", "Password does not match the confirm password."); break; default: NotificationProvider.Error("Edit user error", "UserLogin error"); break; } } } }
private async Task CreateAndNotify(IEnumerable <RekeyingTask> tasks) { if (!tasks.Any()) { return; } await Task.WhenAll(tasks.Select(t => RekeyingTasks.CreateAsync(t))); foreach (var task in tasks) { var secret = await ManagedSecrets.GetAsync(task.ManagedSecretId); if (task.ConfirmationType == TaskConfirmationStrategies.AdminCachesSignOff || task.ConfirmationType == TaskConfirmationStrategies.AdminSignsOffJustInTime) { await NotificationProvider.DispatchNotification_AdminApprovalRequiredTaskCreated( secret.AdminEmails.ToArray(), task); } else if (task.ConfirmationType == TaskConfirmationStrategies.AutomaticRekeyingAsNeeded || task.ConfirmationType == TaskConfirmationStrategies.AutomaticRekeyingScheduled) { await NotificationProvider.DispatchNotification_AutoRekeyingTaskCreated( secret.AdminEmails.ToArray(), task); } } }
protected override void NewItem(object parameter) { log.Debug("New " + ItemName + " button"); ProductCategoryEntity Item = new ProductCategoryEntity(); EditProductCategoryViewModel EPVM = new EditProductCategoryViewModel(Item, true, ItemName); EditItemWindow EIV = new EditItemWindow() { DataContext = EPVM }; EIV.ShowDialog(); if (EPVM.SaveEdit) { Item = EPVM.Item; NotificationProvider.Info("Product category added", string.Format("Category name:{0}", Item.Category)); RefreshList(parameter); foreach (var p in List) { if (Item.Id == p.Id) { SelectedItem = p; } } } }
protected override bool Save(object parameter) { log.Debug("Save " + ItemName); bool result = false; if (string.IsNullOrWhiteSpace(Item.Category)) { NotificationProvider.Error((NewRecord ? "New" : "Edit") + " product category error", "Please fill the category field."); } else { if (NewRecord) { result = ManageProducts.NewProductCategory(Item); } else { result = ManageProducts.ModifyProductCategory(Item); } if (!result) { NotificationProvider.Error((NewRecord ? "New" : "Edit") + " product category error", "Category name already exist."); } } return(result); }
public void PublishToSubscriber(Common.Model.Message pMessage) { if (pMessage is Common.Model.DeliverProcessedMessage) { Common.Model.DeliverProcessedMessage lMessage = pMessage as Common.Model.DeliverProcessedMessage; string orderNumber = lMessage.orderNumber; Guid pDeliveryId = lMessage.pDeliveryId; DeliveryStatus status = (DeliveryStatus)lMessage.status; string errorMsg = lMessage.errorMsg; NotificationProvider.NotifyDeliveryProcessed(orderNumber, pDeliveryId, status, errorMsg); } else if (pMessage is Common.Model.DeliverCompleteMessage) { Common.Model.DeliverCompleteMessage lMessage = pMessage as Common.Model.DeliverCompleteMessage; Guid pDeliveryId = lMessage.pDeliveryId; DeliveryStatus status = (DeliveryStatus)lMessage.status; NotificationProvider.NotifyDeliveryCompletion(pDeliveryId, status); } else if (pMessage is Common.Model.TransferResultMessage) { Common.Model.TransferResultMessage lMessage = pMessage as Common.Model.TransferResultMessage; Boolean success = lMessage.Success; String Msg = lMessage.Message; Guid orderId = lMessage.OrderNumber; OrderProvider.AfterTransferResultReturns(success, orderId, Msg); } }
protected override void EditItem(object parameter) { log.Debug("Edit " + ItemName + " button"); TransactionHeadListEntity Item = new TransactionHeadListEntity(); EntityCloner.CloneProperties <TransactionHeadListEntity>(SelectedItem, Item); EditTransactionViewModel ETVM = new EditTransactionViewModel(Item, false, ItemName); EditItemWindow EIV = new EditItemWindow() { DataContext = ETVM }; EIV.ShowDialog(); if (ETVM.SaveEdit) { Item = ETVM.Item; NotificationProvider.Info("Transaction saved", string.Format("Id: {0}\nDate: {1}\nPartner name: {2}", Item.Head.Id, Item.Head.Date.ToString("d"), Item.Partner.Name)); RefreshList(parameter); foreach (var t in List) { if (Item.Head.Id == t.Head.Id) { SelectedItem = t; } } } }
protected override void NewItem(object parameter) { log.Debug("New " + ItemName + " button"); TransactionHeadListEntity Item = new TransactionHeadListEntity(); Item.Head = new TransactionHeadEntity(); Item.Head.Incoming = this.Incoming; Item.Head.Date = DateTime.Now.Date; EditTransactionViewModel ETVM = new EditTransactionViewModel(Item, true, ItemName); EditItemWindow EIV = new EditItemWindow() { DataContext = ETVM }; EIV.ShowDialog(); if (ETVM.SaveEdit) { Item = ETVM.Item; NotificationProvider.Info("Transaction added", string.Format("Id: {0}\nDate: {1}\nPartner name: {2}", Item.Head.Id, Item.Head.Date.ToString("d"), Item.Partner.Name)); RefreshList(parameter); foreach (var t in List) { if (Item.Head.Id == t.Head.Id) { SelectedItem = t; } } } }
private void AddUser(object parameter) { log.Debug("Add user button"); if (Password != Confirm) { NotificationProvider.Error("New user error", "Password does not match the confirm password."); } else { try { if (UserLogin.AddUser(UserID, Password)) { NotificationProvider.Info("New user added", String.Format("Username: {0}", UserID)); NewUserWindow.Close(); } else { NotificationProvider.Error("New user error", "Username already exist."); } } catch { NotificationProvider.Error("New user error", "Please fill the Username and Password fieleds."); } } }
private void UpdateControls() { bool OK = true; if (OK && String.IsNullOrEmpty(textbox_ServerAddress.Text)) { OK = false; } if (OK && checkbox_RequiresAuthentication.Checked) { if (String.IsNullOrEmpty(textbox_LogonName.Text)) { OK = false; } else if (String.IsNullOrEmpty(textbox_Password.Text)) { OK = false; } } string from = textbox_FromName.Text.Trim(); from = (from.Length == 0) ? textbox_FromAddress.Text : String.Format("{0}<{1}>", from, textbox_FromAddress.Text); if (OK && (String.IsNullOrEmpty(from) || !NotificationProvider.IsMailAddressValid(from, true))) { OK = false; } if (m_DataOKDelegate != null) { m_DataOKDelegate(OK); } }
public JobProvider(IDatabase database, NotificationProvider notificationProvider, IEnumerable <IJob> jobs) { StopWatch = new Stopwatch(); _database = database; _notificationProvider = notificationProvider; _jobs = jobs; ResetThread(); }
protected override void ProcessNotification(NotificationProvider notificationProvider, Item item) { var notification = new ChildCreatedNotification(); notification.ChildId = ChildId; notification.Processed = false; notification.Uri = new ItemUri(item.ID, item.Paths.FullPath, Language.Invariant, Sitecore.Data.Version.Latest, item.Database.Name); WriteNotification(notification); }
public static void Connect(string displayName, string groupName) { ClientInfo.DisplayName = displayName; ClientInfo.ChannelName = groupName; SaveClientInfo(); NotificationProvider.Connect(); }
/// <summary> /// create an instance of INotificationService /// </summary> /// <param name="notificationType">how user will receive notification</param> /// <returns>notification service instance</returns> public IPushNotificationServices CreatePushNotificationServiceInstance(NotificationProvider notificationProvider) { if (notificationServices.TryGetValue(notificationProvider, out var notificationServiceInstance)) { return(notificationServiceInstance); } throw new KeyNotFoundException(nameof(notificationServiceInstance)); }
public MainWindowViewModel(Window mainwindow) { log.Debug(">>> Program started. <<<"); MainWindow = mainwindow; try { // Set database connection. if (!DatabaseConnection.TestConnection()) { log.Debug("Can't connect to database. => Opening connection setup window."); SetupConnectionWindow SCW = new SetupConnectionWindow(); SCW.ShowDialog(); if (!DatabaseConnection.TestConnection()) { log.Debug("Database connection wasn't set."); CloseWindow(); return; } } // New user. if (UserLogin.IsEmptyUserDatabase()) { log.Debug("User datatable is empty. => Opening new user window."); NotificationProvider.Info("Welcome First User!", "Please, set a username and a password."); NewUserWindow NUW = new NewUserWindow(); NUW.ShowDialog(); if (UserLogin.IsEmptyUserDatabase()) { log.Debug("User wasn't added."); CloseWindow(); return; } } // Login. log.Debug("Opening login window."); LoginWindow LW = new LoginWindow(); LW.ShowDialog(); if (UserLogin.LoginedUser == "") { log.Debug("Not logged in."); CloseWindow(); return; } } catch (Exception ex) { log.Fatal("Program initialization error.", ex); MessageBox.Show("Program initialization error.\nCheck RedLog.txt for more information.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); CloseWindow(); return; } }
protected override void DeleteItem(object parameter) { log.Debug("Delete " + ItemName + " button"); string UserID = SelectedItem.Username; UserLogin.RemoveUser(UserID); NotificationProvider.Info("User deleted", String.Format("Username: {0}", UserID)); RefreshList(parameter); }
public HttpResponseMessage getCustomerNoticationData(int customerId, int capacity) { NotificationProvider notificationProvider = new NotificationProvider(); ErrorModel errorModel = null; var data = notificationProvider.getNotificationsDataCustomer(customerId, capacity, out errorModel); APIResponseModel aPIResponseModel = new APIResponseModel(); aPIResponseModel.Response = data; aPIResponseModel.Error = errorModel; return(Request.CreateResponse(HttpStatusCode.OK, aPIResponseModel)); }
public MainForm() { InitializeComponent(); var provider = new NotificationProvider(this, global::CryptoMarketClient.Properties.Resources.notification_image3); provider.StatusItem = this.bsiStatus; NotificationManager.Provider = provider; this.ribbonControl1.RibbonStyle = DevExpress.XtraBars.Ribbon.RibbonControlStyle.Office2019; this.ribbonControl1.CommandLayout = DevExpress.XtraBars.Ribbon.CommandLayout.Simplified; this.ribbonControl1.GetController().PropertiesRibbon.DefaultSimplifiedRibbonGlyphSize = 22; FormBorderEffect = FormBorderEffect.None; }
void DoNotify() { Thread.Sleep(5000); Events.EndpointReferenceType reference = (Events.EndpointReferenceType)Application["consumer"]; Notification.NotificationProvider provider = new NotificationProvider(); //string address = "http://192.168.31.142:8080//onvif_notify_server/"; string address = reference.Address.Value; provider.Notify(address); }
public ShellViewModel() { // Build the menus this.Menu.Add(new MenuItem() { Icon = new PackIconMaterial() { Kind = PackIconMaterialKind.Home }, Text = "Home", NavigationDestination = new Uri("Views/HomeView.xaml", UriKind.RelativeOrAbsolute) }); this.Menu.Add(new MenuItem() { Icon = new PackIconMaterial() { Kind = PackIconMaterialKind.Collage }, Text = "Collection", NavigationDestination = new Uri("Views/CollectionView.xaml", UriKind.RelativeOrAbsolute) }); this.Menu.Add(new MenuItem() { Icon = new PackIconMaterial() { Kind = PackIconMaterialKind.Folder }, Text = "Folders", NavigationDestination = new Uri("Views/FoldersView.xaml", UriKind.RelativeOrAbsolute) }); this.Menu.Add(new MenuItem() { Icon = new PackIconMaterial() { Kind = PackIconMaterialKind.Sync }, Text = "Synchronization", NavigationDestination = new Uri("Views/SynchronizeView.xaml", UriKind.RelativeOrAbsolute) }); this.OptionsMenu.Add(new MenuItem() { Icon = new PackIconMaterial() { Kind = PackIconMaterialKind.Settings }, Text = "Settings", NavigationDestination = new Uri("Views/SettingsView.xaml", UriKind.RelativeOrAbsolute) }); this.OptionsMenu.Add(new MenuItem() { Icon = new PackIconMaterial() { Kind = PackIconMaterialKind.Help }, Text = "About", NavigationDestination = new Uri("Views/AboutView.xaml", UriKind.RelativeOrAbsolute) }); NotificationProvider.Notify("[Ongoing] Antman & the Wasp", 2); }
/// <summary> /// 向数据库添加并一条邮政消息并保存 /// </summary> /// <param name="message">消息对象</param> public async Task AddAsync([NotNull] Message message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } _dbContext.Messages.Add(message); await _dbContext.SaveChangesAsync(); await IncreaseUserUnreadMessageCountAsync(message.ReceiverId, 1); NotificationProvider.Hub <MessageHub, IMessageHubClient>().User(message.ReceiverId)? .OnUnreadCountChanged(await GetUserUnreadMessageCountAsync(message.ReceiverId)); }
private static void Initialize() { if (!_initialized) { lock (_lock) { if (!_initialized) { try { NotificationSection section = ConfigurationManager.GetSection("lionsguard/notification") as NotificationSection; if (section != null) { _providers = new NotificationProviderCollection(); ProvidersHelper.InstantiateProviders(section.Providers, _providers, typeof(NotificationProvider)); _provider = _providers[section.DefaultProvider]; if (_provider == null) { throw new ConfigurationErrorsException("Default NotificationProvider not found in application configuration file.", section.ElementInformation.Properties["defaultProvider"].Source, section.ElementInformation.Properties["defaultProvider"].LineNumber); } if (!String.IsNullOrEmpty(section.AdminEmail)) { _adminEmail = section.AdminEmail; } if (!String.IsNullOrEmpty(section.EmailSubject)) { _emailSubject = section.EmailSubject; } if (!String.IsNullOrEmpty(section.SmtpServer)) { _smtpServer = section.SmtpServer; } } } catch (Exception ex) { _initException = ex; } _initialized = true; } } } if (_initException != null) { throw _initException; } }
protected override void DeleteItem(object parameter) { log.Debug("Delete " + ItemName + " button"); string name = SelectedItem.Category; if (ManageProducts.DeleteProductCategory(SelectedItem)) { RefreshList(parameter); NotificationProvider.Info("Product category deleted", string.Format("Category name:{0}", name)); } else { NotificationProvider.Error("Delete product category error", "This category is set to one or more product"); } }
protected override void DeleteItem(object parameter) { log.Debug("Delete " + ItemName + " button"); string name = SelectedItem.Name; if (ManagePartners.DeletePartner(SelectedItem)) { RefreshList(parameter); NotificationProvider.Info("Partner deleted", string.Format("Partner name:{0}", name)); } else { NotificationProvider.Error("Delete partner error", "This partner is set to one or more transactions."); } }
private void ConnectDatabase(object parameter) { log.Debug("Connect to database"); if (DatabaseConnection.ChangeDatabase(Directory, DbName)) { NotificationProvider.Info("Connected to:", ConnectedFile); SetupWindow?.Close(); } else { NotificationProvider.Error("Connection error", "Database connection failed."); } RaisePropertyChanged("ConnectionState"); RaisePropertyChanged("ConnectedFile"); }
private void Source_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Speed") { if (AppSettings.Current.IsSpeedAlertEnabled && source.Speed > AppSettings.Current.SpeedLimit && !timer.IsEnabled) { NotificationProvider.Notify(); timer.Start(); } else if (timer.IsEnabled) { timer.Stop(); } } }
public JsonResult Subscribe(string title) { // make an API call to subscribe _interestsService.Subscribe("user2", new Interest() { Title = title }); // send slack notifications (although my intention was to have it in a separate console application but I am limited by time) // Call the Api to get the content of the interest and send var content = _interestsService.GetContentForInterest(title); NotificationProvider.SendSlackNotification("Demo Message", "user2", title, content.Result); return(Json("")); }
protected override void DeleteItem(object parameter) { log.Debug("Delete " + ItemName + " button"); string date = SelectedItem.Head.Date.ToString("d"); string PartnerName = SelectedItem.Partner.Name; int id = SelectedItem.Head.Id; if (ManageTransactions.RemoveTransaction(SelectedItem.Head)) { RefreshList(parameter); NotificationProvider.Info("Transaction deleted", string.Format("Id: {0}\nDate: {1}\nPartner name: {2}", id, date, PartnerName)); } else { NotificationProvider.Error("Delete transaction error", "Unknown reason."); } }
private void CreateDatabase(object parameter) { log.Debug("Create database"); if (DatabaseConnection.CreateDatabase(Directory, DbName)) { RaisePropertyChanged("ConnectionState"); RaisePropertyChanged("ConnectedFile"); CollectDbNames(Directory); NotificationProvider.Info("Database created", "New database: " + DbName); NotificationProvider.Info("Connected to:", ConnectedFile); SetupWindow?.Close(); } else { NotificationProvider.Error("New database error", "Database creation failed."); } }
public void CopyTo(NotificationProvider[] array, int index) { base.CopyTo(array, index); }
protected override void ProcessNotification(NotificationProvider notificationProvider, Item item) { notificationProvider.AddNotification(Notification); }
protected override void ProcessNotification(NotificationProvider notificationProvider, Item item) { notificationProvider.GetNotifications(item).ToList().ForEach(WriteNotification); }
protected abstract void ProcessNotification(NotificationProvider notificationProvider, Item item);
protected override void ProcessNotification(NotificationProvider notificationProvider, Item item) { Notification.Reject(item); }