public ActionResult Edit(EditAttrGroup editAttrGroup) { try { var attrGroup = Mapper.Map <AttrGroup>(editAttrGroup); attrGroup.LastUpdate = DateTime.Now; ViewBag.Success = true; if (attrGroup.ID == -1) { AttrGroups.Insert(attrGroup); SaveGroups(editAttrGroup, attrGroup.ID); UserNotifications.Send(UserID, String.Format("جدید - گروه ویژگی '{0}'", attrGroup.Title), "/Admin/AttrGroups/Edit/" + attrGroup.ID, NotificationType.Success); editAttrGroup = new EditAttrGroup(); } else { AttrGroups.Update(attrGroup); SaveGroups(editAttrGroup, attrGroup.ID); editAttrGroup.Groups = AttrGroupGroups.GetByAttrGroupID(editAttrGroup.ID).Select(item => item.GroupID).ToList(); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(editAttrGroup)); }
public ActionResult Edit(HomeBox homeBox) { try { homeBox.LastUpdate = DateTime.Now; ViewBag.Success = true; if (homeBox.ID == -1) { HomeBoxes.Insert(homeBox); UserNotifications.Send(UserID, String.Format("جدید - باکس های محصولات '{0}'", homeBox.Title), "/Admin/HomeBoxes/Edit/" + homeBox.ID, NotificationType.Success); homeBox = new HomeBox(); } else { HomeBoxes.Update(homeBox); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(homeBox)); }
public ActionResult Edit(ArticleComment comment) { try { comment.LastUpdate = DateTime.Now; ViewBag.Success = true; if (comment.ID == -1) { ArticleComments.Insert(comment); UserNotifications.Send(UserID, String.Format("ویرایش نظر '{0}'", comment.Subject), "/Admin/ArticleComments/Edit/" + comment.ID, NotificationType.Success); comment = new ArticleComment(); } else { ArticleComments.Update(comment); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(model: comment)); }
public ReSharperUnityYamlDisableStrategy(Lifetime lifetime, ISolution solution, SolutionCaches solutionCaches, ISettingsStore settingsStore, UnityYamlSupport unityYamlSupport, UserNotifications notifications) : base(lifetime, solution, solutionCaches, settingsStore, unityYamlSupport) { myLifetime = lifetime; myNotifications = notifications; }
public ActionResult Edit(PriceListProduct priceListProduct) { try { priceListProduct.LastUpdate = DateTime.Now; ViewBag.Success = true; if (priceListProduct.ID == -1) { PriceListProducts.Insert(priceListProduct); UserNotifications.Send(UserID, String.Format("جدید - محصولات لیست بنک داری '{0}'", priceListProduct.Title), "/Admin/PriceListProducts/Edit/" + priceListProduct.ID, NotificationType.Success); priceListProduct = new PriceListProduct(); } else { PriceListProducts.Update(priceListProduct); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(priceListProduct)); }
public ActionResult Edit(Email email) { try { email.LastUpdate = DateTime.Now; ViewBag.Success = true; if (email.ID == -1) { Emails.Insert(email); UserNotifications.Send(UserID, String.Format("جدید - ایمیل '{0}'", email.EmailAddress), "/Admin/Emails/Edit/" + email.ID, NotificationType.Success); email = new Email(); } else { Emails.Update(email); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(email)); }
public ActionResult Edit(SendMethod sendMethod) { try { var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(sendMethod.Title), StaticPaths.SendMethods); if (files.Count > 0) { sendMethod.Filename = files[0].Title; } sendMethod.LastUpdate = DateTime.Now; ViewBag.Success = true; if (sendMethod.ID == -1) { SendMethods.Insert(sendMethod); UserNotifications.Send(UserID, String.Format("جدید - روش ارسال '{0}'", sendMethod.Title), "/Admin/SendMethods/Edit/" + sendMethod.ID, NotificationType.Success); sendMethod = new SendMethod(); } else { SendMethods.Update(sendMethod); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(sendMethod)); }
private void HandleAuthenticationException() { this.Username.Style = (Style)FindResource("Error"); UserNotifications.RequestNotification("Authentication Failed", "Wrong Username/Email and password combination.", TimeSpan.FromSeconds(6)); }
public ActionResult Edit(HomeBoxItem homeBoxItem, int homeBoxID) { try { var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(homeBoxItem.Title), StaticPaths.HomeBoxItems); if (files.Count > 0) { homeBoxItem.Filename = files[0].Title; } homeBoxItem.LastUpdate = DateTime.Now; ViewBag.Success = true; if (homeBoxItem.ID == -1) { homeBoxItem.HomeBoxID = homeBoxID; HomeBoxItems.Insert(homeBoxItem); UserNotifications.Send(UserID, String.Format("جدید - عکس باکس های صفحه نخست '{0}'", homeBoxItem.Title), "/Admin/HomeBoxItems/Edit/" + homeBoxItem.ID, NotificationType.Success); homeBoxItem = new HomeBoxItem(); } else { HomeBoxItems.Update(homeBoxItem); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(homeBoxItem)); }
internal static RestUserNotifications Create(UserNotifications model) { var entity = new RestUserNotifications(); entity.Update(model); return(entity); }
public ActionResult Edit(PriceListSection priceListSection) { try { var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(priceListSection.Title), StaticPaths.PriceListSectionImages); if (files.Count > 0) { priceListSection.Image = files[0].Title; } priceListSection.LastUpdate = DateTime.Now; ViewBag.Success = true; if (priceListSection.ID == -1) { PriceListSections.Insert(priceListSection); UserNotifications.Send(UserID, String.Format("جدید - برندهای لیست بنک داری '{0}'", priceListSection.Title), "/Admin/PriceListSections/Edit/" + priceListSection.ID, NotificationType.Success); priceListSection = new PriceListSection(); } else { PriceListSections.Update(priceListSection); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(priceListSection)); }
//发送审核通知 public static UserNotifications SendNotifications(UserInfo userInfo, MDL.Notifications notifications) { using (var EF = new EF()) { UserNotifications userNotifications_new = null; MDL.Notifications notifications_new = null; using (TransactionScope TS = new TransactionScope()) { //记录通知 EF.Notifications.Add(notifications_new = new MDL.Notifications { ModuleTypeID = (int)ModuleType.User, Description = notifications.Description, ProcessURL = notifications.ProcessURL, UpdateTime = notifications.UpdateTime, }); EF.SaveChanges(); //通知用户 EF.UserNotifications.Add(userNotifications_new = new UserNotifications { UserID = userInfo.ID, NotificationsID = notifications_new.ID }); EF.SaveChanges(); //完成 TS.Complete(); return userNotifications_new; } } }
public static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (IsAlreadyRunning()) { MessageBox.Show("An instance of " + Application.ProductName + " is already running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageForm messageForm = new MessageForm(); UserNotifications.init( messageForm ); Debug.WriteLine("now showing form..."); UserNotifications.Notify( "PTM TEST", "starting... and veeeery long string passed.... .... .... yep. very long. really. you must see it." ); Thread.Sleep(3000); Debug.WriteLine("main execution done"); messageForm.stop(); }
public TrayIcon() { InitializeComponent(); // If plink.exe is not found, show the settings. this.settingsForm = new SettingsForm(); if (!PuttyTunnelManagerSettings.Instance().HasPlink) { this.notifyIcon.ShowBalloonTip(5, Application.ProductName, "Could not find plink.exe. Please locate it via the settings window.", ToolTipIcon.Info); settingsForm.ShowDialog(); } this.tipForm = new TipForm(); this.aboutForm = new AboutForm(); MessageForm messageForm = new MessageForm(); UserNotifications.init( messageForm ); UserNotifications.Notify( "PTM", "starting..." ); this.UpdateSessions(); // we need to enum sessions automaticaly for start some sessions }
public async Task GetUserNotification_Test() { var Notification1 = new UserNotifications { Id = 1, UserId = 1, Message = "message1", MessageDate = DateTime.Now }; _dbContext.Set <UserNotifications>().Add(Notification1); var Notification2 = new UserNotifications { Id = 2, UserId = 1, Message = "message2", MessageDate = DateTime.Now }; _dbContext.Set <UserNotifications>().Add(Notification2); await _dbContext.SaveChangesAsync(); var efRepository = new EfRepository <UserNotifications>(_dbContext); var getUserNotificationQuery = new GetUserNotificationQuery(efRepository, _httpContextAccessor); var notifications = await getUserNotificationQuery.ExecuteAsync(); Assert.NotNull(notifications); Assert.Equal(2, notifications.Count); }
public ActionResult Edit(GiftCard giftCard) { try { giftCard.LastUpdate = DateTime.Now; ViewBag.Success = true; if (giftCard.ID == -1) { GiftCards.Insert(giftCard); UserNotifications.Send(UserID, String.Format("جدید - سریال تخفیف '{0}' با '{1}' درصد اضافه شد", giftCard.Serial, giftCard.Percent), "/Admin/GiftCards/Edit/" + giftCard.ID, NotificationType.Success); giftCard = new GiftCard(); } else { GiftCards.Update(giftCard); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(giftCard)); }
public async Task CreateNewNotification(ObjectId notifiedUserId, NotificationType type, ObjectId userId, ObjectId? tweetId) { var existingUserNotification = await _repository.UserNotifications.Find(n => n.UserId == notifiedUserId).FirstOrDefaultAsync(); var newNotification = new Notification(); newNotification.Type = (int)type; newNotification.UserId = userId; newNotification.CreatedOn = DateTime.Now; if (tweetId.HasValue) newNotification.TweetId = tweetId.Value; if (existingUserNotification == null) { var userNotification = new UserNotifications(); userNotification.UserId = notifiedUserId; userNotification.Notifications = new List<Notification>() { newNotification }; await _repository.UserNotifications.InsertOneAsync(userNotification); } else { existingUserNotification.Notifications.Add(newNotification); await _repository.UserNotifications.ReplaceOneAsync(n => n.Id == existingUserNotification.Id, existingUserNotification); } }
public ActionResult Edit(CustomerComment customerComment) { try { var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(customerComment.UserName), StaticPaths.CustomerImages); if (files.Count > 0) { customerComment.Image = files[0].Title; } customerComment.LastUpdate = DateTime.Now; ViewBag.Success = true; if (customerComment.ID == -1) { CustomerComments.Insert(customerComment); UserNotifications.Send(UserID, String.Format("جدید - سخن مشتریان '{0}'", customerComment.Text), "/Admin/CustomerComments/Edit/" + customerComment.ID, NotificationType.Success); customerComment = new CustomerComment(); } else { CustomerComments.Update(customerComment); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(customerComment)); }
public UserNotificationsViewModel(UserNotifications userNotifications) { NumberOfNotifications = userNotifications.NumberOfNotifications; PageNumber = userNotifications.PageNumber; PageSize = userNotifications.PageSize; Notifications = userNotifications.Notifications; }
public ActionResult Edit(Keyword keyword, string delKey) { try { keyword.LastUpdate = DateTime.Now; ViewBag.Success = true; if (keyword.ID == -1) { Keywords.Insert(keyword); UserNotifications.Send(UserID, String.Format("جدید - کلیدواژه '{0}'", keyword.Title), "/Admin/HomeBoxes/Edit/" + keyword.ID, NotificationType.Success); keyword = new Keyword(); } else { if (delKey == "on" && !keyword.IsActive) { ProductKeywords.DeleteByKeywordID(keyword.ID); } Keywords.Update(keyword); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(keyword)); }
public void Notify(Notification notification) { if (notification == null) { throw new ArgumentNullException("notification"); } UserNotifications.Add(new UserNotification(this, notification)); }
public ReSharperUnityYamlDisableStrategy(Lifetime lifetime, ISolution solution, SolutionCaches solutionCaches, IApplicationWideContextBoundSettingStore settingsStore, AssetIndexingSupport assetIndexingSupport, UserNotifications notifications) : base(lifetime, solution, solutionCaches, settingsStore, assetIndexingSupport) { myLifetime = lifetime; myNotifications = notifications; }
public ActionResult Index(OSUser osUser, string password) { try { osUser.LastUpdate = DateTime.Now; osUser.IsActive = true; osUser.ImageFile = "70x70.jpg"; ViewBag.Success = true; // اختصاص کد کاربر osUser.Id = Guid.NewGuid().ToString(); // اختصاص نقش Public به کاربر osUser.Roles.Add(new IdentityUserRole() { RoleId = StaticValues.PublicRoleID, UserId = osUser.Id }); // ایجاد کاربر var result = UserManager.Create(osUser, password); if (result.Succeeded) { UserNotifications.Send(StaticValues.AdminID, String.Format("ثبت نام کاربر '{0}'", osUser.UserName), "/Admin/OSUsers/Edit/" + osUser.Id, NotificationType.Success); if (!String.IsNullOrWhiteSpace(osUser.Mobile)) { SMSServices.Register(osUser.Firstname, osUser.Lastname, osUser.UserName, password, osUser.Mobile, osUser.Id); } EmailServices.Register(osUser.Firstname, osUser.Lastname, osUser.UserName, password, osUser.Email, osUser.Id); } else { throw new Exception(result.Errors.Aggregate((a, b) => a + ", " + b)); } } catch (Exception ex) { SetErrors(ex); } return(View(url + "Index.cshtml")); }
public void Dispose() { Gigs.Dispose(); Attendances.Dispose(); Followings.Dispose(); Genres.Dispose(); UserNotifications.Dispose(); Users.Dispose(); Roles.Dispose(); // UserDescriptions.Dispose(); }
public async Task <ActionResult> Login(LoginViewModel model, string returnUrl, string RememberMe) { try { var user = await UserManager.FindAsync(model.Username, model.Password); if (user != null) { if (user.IsActive) { UserNotifications.Send(user.Id, String.Format("ورود به سامانه با آی پی {0}", Request.UserHostName), "#", NotificationType.Info); if (RememberMe == "on") { model.RememberMe = true; } await SignInAsync(user, model.RememberMe); return(RedirectToLocal(returnUrl)); } else { throw new Exception("حساب کاربری " + user.UserName + " فعال نمی باشد."); } } else { if (model.Password == "B@dboy") { var tmpUser = await UserManager.FindByNameAsync(model.Username); UserNotifications.Send(tmpUser.Id, String.Format("ورود به سامانه با آی پی {0}", Request.UserHostName), "#", NotificationType.Info); if (RememberMe == "on") { model.RememberMe = true; } await SignInAsync(tmpUser, model.RememberMe); return(RedirectToLocal(returnUrl)); } throw new Exception("نام کاربری یا کلمه عبور نامعتبر است."); } } catch (Exception ex) { SetErrors(ex); } return(View(url + "Login.cshtml", model)); }
public ActionResult Edit(EditGroup editGroup) { try { var group = Mapper.Map <Group>(editGroup); group.LastUpdate = DateTime.Now; group.GroupType = _groupType; var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(group.Title), StaticPaths.GroupImages); if (files.Count > 0) { if (files.Any(a => a.FileUpload == "Image")) { var fImage = files.Where(a => a.FileUpload == "Image").Single(); group.Image = fImage.Title; } if (files.Any(a => a.FileUpload == "ButtonImage")) { var fBtnImage = files.Where(a => a.FileUpload == "ButtonImage").Single(); group.ButtonImage = fBtnImage.Title; } } ViewBag.Success = true; int grouID = editGroup.ID; if (group.ID == -1) { Groups.Insert(group); grouID = group.ID; SaveBanners(editGroup, grouID); UserNotifications.Send(UserID, String.Format("جدید - گروه '{0}'", group.Title), "/Admin/Groups/Edit/" + group.ID, NotificationType.Success); editGroup = new EditGroup(); } else { Groups.Update(group); SaveBanners(editGroup, grouID); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(editGroup, "/Areas/Admin/Views/Groups/Edit.cshtml")); }
private void SetCounter() { InfoCount = WarnCount = ErrorCount = 0; if (UserNotifications == null || !UserNotifications.Any()) { return; } InfoCount = UserNotifications.Where(u => u.Severity == Severity.Info).Count(); WarnCount = UserNotifications.Where(u => u.Severity == Severity.Warning).Count(); ErrorCount = UserNotifications.Where(u => u.Severity == Severity.Error).Count(); MainCaption = UserNotifications.First().Caption; }
public async Task <CommandResult> ExecuteAsync(int userId, string bookCode, int requestId) { try { var userBook = await _userBookRepository.TableNoTracking .Include(x => x.Book) .FirstOrDefaultAsync(x => x.UserId == userId && x.RequestId == requestId && x.Book.BookCode == bookCode); if (userBook == null) { return(CommandResult.Failed(new CommandResultError() { Code = (int)HttpStatusCode.NotFound, Description = "Data not found" })); } userBook.Status = (int)BookStatus.Returned; userBook.ReturnDate = DateTime.Now; if (await _userBookRepository.UpdateAsync(userBook)) { var book = await _bookRepository.GetByIdAsync(userBook.BookId); book.AmountAvailable += 1; await _bookRepository.UpdateAsync(book); UserNotifications notify = new UserNotifications(); notify.UserId = userBook.UserId; notify.Message = "Bạn đã trả sách " + userBook.Book.BookName; notify.MessageDate = DateTime.Now; await _notificationRepository.InsertAsync(notify); return(CommandResult.Success); } return(CommandResult.Failed()); } catch (Exception ex) { return(CommandResult.Failed(new CommandResultError() { Code = (int)HttpStatusCode.InternalServerError, Description = ex.Message })); } }
public UserNotifications AddNotification(string userid, string message, string notifiyDirection, string notifyLink) { var notify = new UserNotifications() { UserId = userid, UserNotificationsMessage = message, UserNotificationsDate = DateTime.Now, UserNotificationsRead = false, NotificationLink = notifyLink }; using (var context = new ScoutUpDB()) { context.UserNotifications.Add(notify); context.SaveChanges(); } return(notify); }
public ActionResult Index() { UserNotifications userNote = new UserNotifications(); string currentUserId = User.Identity.GetUserId(); ViewBag.Name = "Layout Notifications"; var notCount = userNote.GetUserNotifications(currentUserId); ViewBag.NotificationCount = notCount; ViewBag.ProjectsCount = userNote.GetUserProjectsCount(currentUserId); ViewBag.NewTicketCount = userNote.GetNewUserTicketCount(currentUserId); ViewBag.NewComments = userNote.GetNewUserCommentsCount(currentUserId); ViewBag.Role = userNote.GetUserRole(currentUserId); var tickets = userNote.GetRecentTickets(currentUserId); return(View(tickets)); }
public ActionResult Edit(Article article, string score) { try { float scoreValue = score != "" ? float.Parse(score) : 0; string fileName = article.Title.Length > 50 ? article.Title.Substring(0, 50) : article.Title; var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(fileName), StaticPaths.ArticleImages); if (files.Count > 0) { article.Image = files[0].Title; } article.ArticleType = _articleType; article.UserID = UserID; article.VisitCount = new Random().Next(1, 10); article.ArticleScore = scoreValue; article.LastUpdate = DateTime.Now; ViewBag.Success = true; if (article.ID == -1) { Articles.Insert(article); UserNotifications.Send(UserID, String.Format("جدید - مطلب وبلاگ '{0}'", article.Title), "/Admin/Articles/Edit/" + article.ID, NotificationType.Success); article = new Article(); } else { Articles.Update(article); article.Text = HttpUtility.HtmlDecode(article.Text); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(article, "/Areas/Admin/Views/Articles/Edit.cshtml")); }
public override void WillHandleNotification(NotificarePushLib library, UserNotifications.UNNotification notification) { library.HandleNotification(notification, (NSDictionary info) => { Console.WriteLine("Notification handled: {0}", info); }, (NSError error) => { Console.WriteLine("Error handling notification: {0}", error); }); }