private void ShowNotification() => NotificationsModel.Notification(new NotificationModel( "Could not execute T4 file", "Execution is already running", true, RdNotificationEntryType.ERROR, new List <NotificationHyperlink>() ));
public async Task <ActionResult> SetNotification(Guid studentId, [FromBody] NotificationsModel notificationsModel) { // check if student exists // update notifications //return 204 var studentExists = _repository.StudentExists(studentId); if (!studentExists) { return(NotFound()); } var notificationEntity = _mapper.Map <NotificationsSettings>(notificationsModel); notificationEntity.StudentId = studentId; await _repository.UpdateNotification(notificationEntity); await _repository.SaveAsync(); await _jobsManager.RefreshJobs(); var telegramDataExists = _repository.UserTelegramDataExists(studentId); if (notificationsModel.NotificationType == "Telegram" && !telegramDataExists) { return(Ok(new { message = "Для роботи нотифікацій через телеграм бот, потрібно авторизуватись через телеграм, зайти в телеграмм бот і натиснути /start" })); } return(NoContent()); // if student telegram chat not exists, return it to client }
public IActionResult ViewNotificationDetails(int notifID) { // return Content("View Notification Details"); NotificationsModel foundNotif = _context.notificationsList.FirstOrDefault(n => n.id == notifID); return(View(foundNotif)); }
public NotificationsModel GetNotifications() { string BaseUrl = ConfigurationManager.ConnectionStrings["NotificationServerName"].ConnectionString; string url = BaseUrl + DestinationNames.GetNotifications; HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); req.Method = "GET"; HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); using (Stream stream = resp.GetResponseStream()) { BinaryFormatter bf = new BinaryFormatter(); var sr = new StreamReader(stream); Notifications notifications = (Notifications)bf.Deserialize(stream); NotificationsModel notificationsModel = new NotificationsModel(); foreach (Notification el in notifications.ListOfEvents) { Models.NotificationModel item = new NotificationModel(); DateTime newDt = new DateTime(DateTime.Now.Year, el.Date.Month, el.Date.Day); item.Date = newDt; item.Address = el.Address; item.Type = el.Type; notificationsModel.ListOfEvents.Add(item); } foreach (Birthday el in notifications.ListOfBirthdays) { BirthdayModel day = new BirthdayModel(); day.Date = el.Date; day.FirstName = el.FirstName; day.LastName = el.LastName; notificationsModel.ListOfBirthdays.Add(day); } return(notificationsModel); } }
public ActionResult GetNotifications() { NotificationsModel result = new NotificationsModel(); result = Manager.Instance().GetNotifications(); return(View(result)); }
public RunViaUnityEditorStrategy(ISolution solution, IUnitTestResultManager unitTestResultManager, UnityEditorProtocol editorProtocol, NUnitTestProvider unitTestProvider, IUnitTestElementIdFactory idFactory, ISolutionSaver riderSolutionSaver, UnityRefresher unityRefresher, NotificationsModel notificationsModel, UnityHost unityHost, ILogger logger, Lifetime lifetime, PackageValidator packageValidator ) { mySolution = solution; myUnitTestResultManager = unitTestResultManager; myEditorProtocol = editorProtocol; myUnitTestProvider = unitTestProvider; myIDFactory = idFactory; myRiderSolutionSaver = riderSolutionSaver; myUnityRefresher = unityRefresher; myNotificationsModel = notificationsModel; myUnityHost = unityHost; myLogger = logger; myLifetime = lifetime; myPackageValidator = packageValidator; myElements = new WeakToWeakDictionary <UnitTestElementId, IUnitTestElement>(); myUnityProcessId = new Property <int?>(lifetime, "RunViaUnityEditorStrategy.UnityProcessId"); myUnityProcessId.ForEachValue_NotNull(lifetime, (lt, processId) => { var process = myLogger.CatchIgnore(() => Process.GetProcessById(processId.NotNull())); if (process == null) { myUnityProcessId.Value = null; return; } process.EnableRaisingEvents = true; void OnProcessExited(object sender, EventArgs a) => myUnityProcessId.Value = null; lt.Bracket(() => process.Exited += OnProcessExited, () => process.Exited -= OnProcessExited); if (process.HasExited) { myUnityProcessId.Value = null; } }); myEditorProtocol.UnityModel.ViewNotNull(lifetime, (lt, model) => { if (model.UnityProcessId.HasValue()) { myUnityProcessId.Value = model.UnityProcessId.Value; } model.UnityProcessId.FlowInto(lt, myUnityProcessId, id => id); }); }
/// <summary> /// Fetches a list of notifications on a certain date /// </summary> /// <param name="date"> /// Passes a date as paramter /// </param> /// <returns> /// <para>Returns a list of all the notifications for a certain date</para> /// <para>Type: List<NotificationsModel></para> /// </returns> public async Task <List <NotificationsModel> > FetchNotificationsGivenDateAsync(string date) { List <NotificationsModel> notificationsList = new List <NotificationsModel>(); using (MySqlConnection connection = new MySqlConnection(DbConnString.DBCONN_STRING)) { await connection.OpenAsync(); string queryString = "SELECT * FROM notifications_table WHERE notif_date LIKE @date "; MySqlCommand command = new MySqlCommand(queryString, connection); command.Parameters.AddWithValue("@date", "%" + date + "%"); MySqlDataReader reader = command.ExecuteReader(); while (await reader.ReadAsync()) { NotificationsModel notifications = new NotificationsModel() { Notifications_ID = int.Parse(reader["notif_id"].ToString()), NotificationTitle = reader["notif_title"].ToString(), NotificationContent = reader["notif_content"].ToString(), NotificationDate = DateTime.Parse(reader["notif_date"].ToString()), Administrator = await AdministratorRepository.SingleInstance.FindAdministratorAsync(reader["user_name"].ToString()), TypeOfNotification = CategorizeNotification(reader["notif_title"].ToString()) }; notificationsList.Add(notifications); } } notificationsList.Reverse(); return(notificationsList); }
public static FCMPushNotification SendNotification(int userId, string notificationId, string message) { IMasterTablesDataAccess _repository = new MasterTablesDataAccess(); IAuthentication _authrepository = new DataAccess.Authentication.Authentication(); UserModel user = new UserModel(); user = _authrepository.GetUserDetails(userId); string DeviceId = user.DeviceId.ToString(); List <string> NotificationsSubscribed = GetList(user.NotificationTypeId); FCMPushNotification pushNotification = new FCMPushNotification(); if (NotificationsSubscribed.Contains(notificationId.ToString())) { NotificationsModel response = new NotificationsModel(); NotificationModel notificationModel = new NotificationModel(); response.NotificationMasterList = _repository.GetNotificationMaster(); var notification = response.NotificationMasterList.Where(x => x.NotificationID == Convert.ToInt32(notificationId)).FirstOrDefault(); Notification objNotification = new Notification(); if (notification.ToAll) { pushNotification = objNotification.SendNotificationToTopic(notification.NotificationCode, notification.NotificationAction, message); } else { pushNotification = objNotification.SendNotificationToRegisteredUser(DeviceId, notification.NotificationAction, message); } notificationModel.NotificationText = message; notificationModel.ToAll = notification.ToAll; notificationModel.ToUserId = userId; notificationModel.CreatedBy = userId; _repository.AddNotification(notificationModel); } return(pushNotification); }
public ActionResult Index(int?id) { if (Convert.ToString(Session["key"]) != "doctor") { return(RedirectToAction("Login", "Home")); } // id = 5006; if (id != null) { System.Web.HttpContext.Current.Session.Add("key", "doctor"); System.Web.HttpContext.Current.Session.Add("UserId", id); Login_Api la = new Login_Api(); var name = la.GetUserName(id); System.Web.HttpContext.Current.Session.Add("UserName", name); } NotificationsModel notificationModel = new NotificationsModel(); Admin_Api adminApi = new Admin_Api(); notificationModel.UserRoleID = (int)Session["UserId"];//6003; var notifications = adminApi.GetAllNotificationsByRole(notificationModel); return(View("~/Views/Doctor/DoctorHome.cshtml", notificationModel)); }
static void Main(string[] args) { string certificatesFolder = System.Configuration.ConfigurationManager.AppSettings["certificate_path"]; string certificatesPassword = System.Configuration.ConfigurationManager.AppSettings["certificate_password"]; InitFactories(); using (var db = new NotificationsModel()) { char input; do { Product p0 = db.Products.Find(1); p0.Price = 0.49; db.SaveChanges(); PushService service = PushService.Instance; service.Init(certificatesFolder, certificatesPassword, "", "", db.Notifications); service.Push(); // Restore the normal state p0.Price = 0.99; db.SaveChanges(); input = Console.ReadKey().KeyChar; } while (input == 'c'); } }
public async Task <ActionResult> SetNotifications(Guid studentId, [FromBody] NotificationsModel notificationsModel) { var student = await _repository.GetStudentWithNotification(studentId); if (student == null) { return(NotFound()); } var notificationentity = _mapper.Map <NotificationsSettings>(notificationsModel); notificationentity.StudentId = studentId; await _repository.UpdateNotification(notificationentity); await _repository.SaveAsync(); var telegramDataExists = _repository.UserTelegramDataExists(studentId); if (notificationsModel.NotificationType == "Telegram" && !telegramDataExists) { return(Ok(new { message = "Для роботи нотифікацій через телеграм бот, потрібно авторизуватись через телеграм, зайти в телеграмм бот і натиснути /start" })); } return(NoContent()); }
public NotificationsModel GetNotificationMaster(RequestForTractorPriceModel model) { IMasterTablesDataAccess _repository = new MasterTablesDataAccess(); NotificationsModel response = new NotificationsModel(); response.NotificationMasterList = _repository.GetNotificationMaster(); return(response); }
public NotificationsModel GetNotifications(NotificationModel model) { IMasterTablesDataAccess _repository = new MasterTablesDataAccess(); NotificationsModel response = new NotificationsModel(); response.NotificationList = _repository.GetNotificationList(model.ToUserId); return(response); }
public RunViaUnityEditorStrategy(ISolution solution, IUnitTestResultManager unitTestResultManager, BackendUnityHost backendUnityHost, NUnitTestProvider unitTestProvider, IUnitTestElementIdFactory idFactory, ISolutionSaver riderSolutionSaver, UnityRefresher unityRefresher, NotificationsModel notificationsModel, FrontendBackendHost frontendBackendHost, ILogger logger, Lifetime lifetime, PackageValidator packageValidator, JetBrains.Application.ActivityTrackingNew.UsageStatistics usageStatistics) { mySolution = solution; myUnitTestResultManager = unitTestResultManager; myBackendUnityHost = backendUnityHost; myUnitTestProvider = unitTestProvider; myIDFactory = idFactory; myRiderSolutionSaver = riderSolutionSaver; myUnityRefresher = unityRefresher; myNotificationsModel = notificationsModel; myFrontendBackendHost = frontendBackendHost; myLogger = logger; myLifetime = lifetime; myPackageValidator = packageValidator; myUsageStatistics = usageStatistics; myUnityProcessId = new Property <int?>(lifetime, "RunViaUnityEditorStrategy.UnityProcessId"); myUnityProcessId.ForEachValue_NotNull(lifetime, (lt, processId) => { var process = myLogger.CatchIgnore(() => Process.GetProcessById(processId.NotNull())); if (process == null) { myUnityProcessId.Value = null; return; } process.EnableRaisingEvents = true; void OnProcessExited(object sender, EventArgs a) => myUnityProcessId.Value = null; lt.Bracket(() => process.Exited += OnProcessExited, () => process.Exited -= OnProcessExited); if (process.HasExited) { myUnityProcessId.Value = null; } }); myBackendUnityHost.BackendUnityModel.ViewNotNull(lifetime, (lt, model) => { // This will set the current value, if it exists model.UnityApplicationData.FlowInto(lt, myUnityProcessId, data => data.UnityProcessId); }); }
private static void Load() { Notifications = Notifications.Load <NotificationsModel>(DefaultPaths.PathToLocal + "Notifications.json"); foreach (NotifyModel notify in Notifications.Notifications) { PopupNotify popup = new PopupNotify(notify); NotifyList.NotifyPanel?.panelList.Children.Insert(0, popup); popup.Margin = new Thickness(0, 0, 0, 20); popup.ClickClose += Popup_ClickClose; } }
public NotificationsModel getSuggestionList(NotificaitonViewModel foRequest) { if (foRequest.inPageSize <= 0) { foRequest.inPageSize = 10; } if (foRequest.inPageIndex <= 0) { foRequest.inPageIndex = 1; } if (foRequest.stSortColumn == "") { foRequest.stSortColumn = null; } if (foRequest.stSearch == "") { foRequest.stSearch = null; } List <Expression <Func <NotificationHistory, Object> > > includes = new List <Expression <Func <NotificationHistory, object> > >(); Func <IQueryable <NotificationHistory>, IOrderedQueryable <NotificationHistory> > orderingFunc = query => query.OrderBy(x => x.Id); Expression <Func <NotificationHistory, bool> > expression = null; (List <NotificationHistory>, int)objSuggestions = Repository <NotificationHistory> .GetEntityListForQuery(expression, orderingFunc, includes, foRequest.inPageIndex, foRequest.inPageSize); NotificationsModel objSuggestion = new NotificationsModel(); objSuggestion.inRecordCount = objSuggestions.Item2; objSuggestion.inPageIndex = foRequest.inPageIndex; objSuggestion.Pager = new Pager(objSuggestions.Item2, foRequest.inPageIndex); if (objSuggestions.Item1.Count > 0) { foreach (var suggestion in objSuggestions.Item1) { objSuggestion.notifications.Add(new NotificaitonViewModel { Id = suggestion.Id, Title = suggestion.Title, NotificaitonText = suggestion.NotificationText }); } } return(objSuggestion); }
public ActionResult DeleteNotifications(NotificationsModel notification) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Admin_Api adminApi = new Admin_Api(); var model = adminApi.DeleteNotifications(notification); return(View("~/Views/Administrator/AdminManageNotifications.cshtml", model)); }
private static void Unregister(string udid) { using (var db = new NotificationsModel()) { Device device = Find(db, udid); if (device != null) { db.Devices.Remove(device); db.SaveChanges(); } } }
public NotificationsViewModel(NotificationTabParameters param, IMastodonClient client) : base(param, null) { model = new NotificationsModel(client); Notifications = new ReadOnlyObservableCollection <Notification>(model); IsStreaming = model.StreamingStarted; ReloadCommand = new AsyncReactiveCommand().WithSubscribe(() => model.FetchPreviousAsync()); ReloadOlderCommand = new AsyncReactiveCommand().WithSubscribe(() => model.FetchNextAsync()); ToggleStreamingCommand = new ReactiveCommand().WithSubscribe(() => model.StreamingStarting.Value = !IsStreaming.Value); model.StreamingStarting.Value = param.StreamingOnStartup; ReloadCommand.Execute(); }
public UnityPluginInstaller( Lifetime lifetime, ILogger logger, ISolution solution, IShellLocks shellLocks, UnityPluginDetector detector, NotificationsModel notifications, ISettingsStore settingsStore, PluginPathsProvider pluginPathsProvider, UnityVersion unityVersion, UnityHost unityHost, UnitySolutionTracker unitySolutionTracker, UnityRefresher refresher) { myPluginInstallations = new JetHashSet <FileSystemPath>(); myLifetime = lifetime; myLogger = logger; mySolution = solution; myShellLocks = shellLocks; myDetector = detector; myNotifications = notifications; myPluginPathsProvider = pluginPathsProvider; myUnityVersion = unityVersion; myUnitySolutionTracker = unitySolutionTracker; myRefresher = refresher; myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext())); myQueue = new ProcessingQueue(myShellLocks, myLifetime); unityHost.PerformModelAction(rdUnityModel => { rdUnityModel.InstallEditorPlugin.AdviseNotNull(lifetime, x => { myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnityPluginInstaller.InstallEditorPlugin", () => { var installationInfo = myDetector.GetInstallationInfo(myCurrentVersion); QueueInstall(installationInfo, true); }); }); }); unitySolutionTracker.IsUnityProjectFolder.AdviseOnce(lifetime, args => { if (!args) { return; } myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "IsAbleToEstablishProtocolConnectionWithUnity", InstallPluginIfRequired); BindToInstallationSettingChange(); }); }
public IActionResult DeleteNotifConf(int notifID) { NotificationsModel foundNotif = _context.notificationsList.FirstOrDefault(n => n.id == notifID); if (foundNotif != null) { return(View(foundNotif)); } else { return(Content("No notification found with that ID")); } }
public IActionResult AddNotif(NotificationsModel newNotification) { if (ModelState.IsValid) { _context.notificationsList.Add(newNotification); _context.SaveChanges(); return(RedirectToAction("ViewNotifications")); } else { return(Content("Not valid Notification")); } }
public ActionResult ManageNotification(NotificationsModel mangeNotifications) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Admin_Api adminApi = new Admin_Api(); mangeNotifications.AdminID = (int)Session["UserId"]; //6003; var notificationsModels = adminApi.ManageNotifications(mangeNotifications); return(View("~/Views/Administrator/AdminManageNotifications.cshtml", notificationsModels)); }
public ActionResult GetAllNotifications(NotificationsModel getNotifications) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Admin_Api adminApi = new Admin_Api(); getNotifications.AdminID = (int)System.Web.HttpContext.Current.Session["UserId"]; //6003; var notificationsModels = adminApi.GetAllNotifications(getNotifications); return(View("~/Views/Administrator/AdminManageNotifications.cshtml", notificationsModels)); }
public IActionResult DeleteNotif(int notifID) { // return Content("Delete Notification"); NotificationsModel foundNotif = _context.notificationsList.FirstOrDefault(n => n.id == notifID); if (foundNotif != null) { _context.Remove(foundNotif); _context.SaveChanges(); return(RedirectToAction("ViewNotifications")); } else { return(Content("Notification not found")); } }
/// <summary> /// Inserts a new notification inside the database /// </summary> /// <param name="notification"> /// Passes a notification object as paramater /// </param> public async Task InsertNewNotificationAsync(NotificationsModel notification) { using (MySqlConnection connection = new MySqlConnection(DbConnString.DBCONN_STRING)) { await connection.OpenAsync(); string queryString = "INSERT INTO notifications_table(notif_title,notif_content,notif_date,user_name)" + "VALUES(@title,@content,@date,@username)"; MySqlCommand command = new MySqlCommand(queryString, connection); command.Parameters.AddWithValue("@title", notification.NotificationTitle); command.Parameters.AddWithValue("@content", notification.NotificationContent); command.Parameters.AddWithValue("@date", notification.NotificationDate); command.Parameters.AddWithValue("@username", notification.Administrator.Username); await command.ExecuteNonQueryAsync(); } }
private async void AcceptrejectQuote(bool notificationStatusvalue, NotificationsModel item) { try { IsLoaderBusy = true; //await App.Current.MainPage.Navigation.PushPopupAsync(new LoaderPopup()); AcceptRejectQuoteModel request = new AcceptRejectQuoteModel() { is_accept = notificationStatusvalue, job_request_id = item.job_request_id.Value, notification_id = item.id, user_id = user_id }; AcceptRejectQuoteResponseModel response; try { response = await _webApiRestClient.PostAsync <AcceptRejectQuoteModel, AcceptRejectQuoteResponseModel>(ApiUrl.AcceptRejectQuote, request); } catch (Exception ex) { response = null; IsLoaderBusy = false; //LoaderPopup.CloseAllPopup(); await MaterialDialog.Instance.SnackbarAsync(ex.Message, 3000); return; } if (response != null) { await MaterialDialog.Instance.SnackbarAsync(response.message, 3000); if (response.status) { Getnotification(); } } } catch (Exception ex) { } finally { IsLoaderBusy = false; //LoaderPopup.CloseAllPopup(); } }
public BackendUnityProtocol(Lifetime lifetime, ILogger logger, BackendUnityHost backendUnityHost, FrontendBackendHost frontendBackendHost, IScheduler dispatcher, IShellLocks locks, ISolution solution, IApplicationWideContextBoundSettingStore settingsStore, UnitySolutionTracker unitySolutionTracker, UnityVersion unityVersion, NotificationsModel notificationsModel, IHostProductInfo hostProductInfo, IFileSystemTracker fileSystemTracker) { myPluginInstallations = new JetHashSet <FileSystemPath>(); myLifetime = lifetime; myLogger = logger; myBackendUnityHost = backendUnityHost; myDispatcher = dispatcher; myLocks = locks; mySolution = solution; myUnityVersion = unityVersion; myNotificationsModel = notificationsModel; myHostProductInfo = hostProductInfo; myFrontendBackendHost = frontendBackendHost; myBoundSettingsStore = settingsStore.BoundSettingsStore; mySessionLifetimes = new SequentialLifetimes(lifetime); if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null) { return; } unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) => { if (!args) { return; } var solFolder = mySolution.SolutionDirectory; // todo: consider non-Unity Solution with Unity-generated projects var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json"); fileSystemTracker.AdviseFileChanges(lf, protocolInstancePath, OnProtocolInstanceJsonChange); // connect on start of Rider CreateProtocol(protocolInstancePath); }); }
public UnityEditorProtocol(Lifetime lifetime, ILogger logger, UnityHost host, IScheduler dispatcher, IShellLocks locks, ISolution solution, ISettingsStore settingsStore, JetBrains.Application.ActivityTrackingNew.UsageStatistics usageStatistics, UnitySolutionTracker unitySolutionTracker, IThreading threading, UnityVersion unityVersion, NotificationsModel notificationsModel, IHostProductInfo hostProductInfo, IFileSystemTracker fileSystemTracker) { myPluginInstallations = new JetHashSet <FileSystemPath>(); myComponentLifetime = lifetime; myLogger = logger; myDispatcher = dispatcher; myLocks = locks; mySolution = solution; myUsageStatistics = usageStatistics; myThreading = threading; myUnityVersion = unityVersion; myNotificationsModel = notificationsModel; myHostProductInfo = hostProductInfo; myHost = host; myBoundSettingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext())); mySessionLifetimes = new SequentialLifetimes(lifetime); if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null) { return; } unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) => { if (!args) { return; } var solFolder = mySolution.SolutionDirectory; AdviseModelData(lifetime); // todo: consider non-Unity Solution with Unity-generated projects var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json"); fileSystemTracker.AdviseFileChanges(lf, protocolInstancePath, OnChangeAction); // connect on start of Rider CreateProtocols(protocolInstancePath); }); }
public ActionResult ViewRoleNoti(string role) { if (role != null && role != "-Select") { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Admin_Api adminApi = new Admin_Api(); NotificationsModel model = new NotificationsModel(); ViewBag.dropdownModel = null; model.UserRoleID = Convert.ToInt32(role); var notis = adminApi.GetAllNotificationsByRole(model); ViewBag.dropdownModel = "true"; return(View("~/Views/Administrator/AdminManageNotifications.cshtml", notis)); } return(View("~/Views/Administrator/AdminManageNotifications.cshtml")); }
public ActionResult Notifications(NotificationsModel model) { return View(); }