public static void ShowInteractiveToast(ToastModel toastModel, string appId) { var toastXml = new ToastXml(toastModel); // Register shortcut var shortcut = new ShortcutModel { ShortcutFileName = appId + ".lnk", ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location, AppId = appId, ActivatorId = typeof(NotificationActivator).GUID }; ShortcutService.CheckInstallShortcut(shortcut); // Create Xml document var document = new XmlDocument(); document.LoadXml(toastXml.GetInteractiveToastXml()); // Send toast var toast = new ToastNotification(document); ToastNotificationManager.CreateToastNotifier(appId).Show(toast); }
public async Task <ActionResult> ChangeEmail(UpdateEmail em) { ToastModel tm = new ToastModel(); string role = await _common.GetUserRoleName(User.Identity.Name); if (ModelState.IsValid) { string uId = await _account.GetUserIdByEmail(User.Identity.Name); bool isEmailExists = await _account.CheckIsEmailExists(em.Email); if (isEmailExists) { tm.IsSuccess = false; tm.Message = "Email already exists"; return(Json(tm)); } else { UpdateEmail emailModel = new UpdateEmail(); emailModel.userId = uId; emailModel.Email = em.Email; HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/UpdateEmailAddress", emailModel, true); tm.IsSuccess = true; tm.Message = "Email updated successfully"; return(Json(tm)); } } return(RedirectToAction("EditEmail", "Common")); }
private void InitilzeModel(ToastModel toast) { var state = Instance.model.GetState(); state = toast; Instance.model.SetState(state); }
public async Task <ActionResult> ChangeEmail(UpdateEmail em, string nextBtn) { ToastModel tm = new ToastModel(); if (nextBtn != null) { if (ModelState.IsValid) { string uId = await _account.GetUserIdByEmail(User.Identity.Name); bool isEmailExists = await _account.CheckIsEmailExists(em.email); if (isEmailExists) { tm.IsSuccess = false; tm.Message = "Select Email which does not exist already...!"; return(Json(tm)); } else { UpdateEmail emailModel = new UpdateEmail(); emailModel.userId = uId; emailModel.email = em.email; HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/UpdateEmailAddress", emailModel, true); tm.IsSuccess = true; tm.Message = "Email updated successfully"; return(Json(tm)); } } } return(RedirectToAction("MyAccount", "Account")); }
public async Task <ActionResult> AddFamilyMember(FamilyMemberModel MemberInformation) { ToastModel tm = new ToastModel(); MemberInformation.relationships = await _common.GetRelationshipData(); MemberInformation.grades = await _common.GetGradeData(); MemberInformation.genders = await _common.GetGenderData(); if (ModelState.IsValid) { MemberInformation.UpdatedBy = User.UserId; bool isEmailExists = string.IsNullOrEmpty(MemberInformation.Email) ? false : await _account.CheckIsEmailExists(MemberInformation.Email); if (!isEmailExists) { HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/PostFamilyMember", MemberInformation, true); tm.IsSuccess = true; tm.Message = "Family member added/updated successfully"; } else { tm.IsSuccess = false; tm.Message = "User Already Exists"; } return(Json(tm)); } return(RedirectToAction("MyAccount", "Account")); }
public async Task <ActionResult> ChangeAddress(ContactDetails Info) { ToastModel tm = new ToastModel(); string role = await _common.GetUserRoleName(User.Identity.Name); if (ModelState.IsValid) { ContactDetails cntd = new ContactDetails(); cntd.Email = User.Identity.Name; cntd.Address = Info.Address; cntd.City = Info.City; cntd.State = Info.State; cntd.Country = Info.Country; cntd.ZipCode = Info.ZipCode; cntd.HomePhone = Info.HomePhone; HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/UpdateAddress", cntd, true); tm.IsSuccess = true; tm.Message = "Address updated successfully"; return(Json(tm)); } else { return(RedirectToAction("EditAddress", "Common")); } }
public async Task <ActionResult> ChangePassword(UpdatePasswordModel Info, string nextBtn) { ToastModel tm = new ToastModel(); if (nextBtn != null) { if (ModelState.IsValid) { UpdatePasswordModel passwordModel = new UpdatePasswordModel(); passwordModel.Email = User.Identity.Name; EncryptDecrypt objEncryptDecrypt = new EncryptDecrypt(); passwordModel.OldPassword = objEncryptDecrypt.Encrypt(Info.OldPassword, WebConfigurationManager.AppSettings["ServiceAccountPassword"]); EncryptDecrypt objEncryptDecrypt1 = new EncryptDecrypt(); passwordModel.NewPassword = objEncryptDecrypt.Encrypt(Info.NewPassword, WebConfigurationManager.AppSettings["ServiceAccountPassword"]); HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/UpdatePassword", passwordModel, true); bool status = await Utility.DeserializeObject <bool>(userResponseMessage); if (status == true) { tm.IsSuccess = true; tm.Message = "Password updated successfully"; } else { tm.IsSuccess = false; tm.Message = "Password not updated"; } return(Json(tm)); } } return(RedirectToAction("MyAccount", "Account")); }
public async Task <ActionResult> ChangePassword(UpdatePasswordModel Info) { ToastModel tm = new ToastModel(); string role = await _common.GetUserRoleName(User.Identity.Name); if (ModelState.IsValid) { UpdatePasswordModel passwordModel = new UpdatePasswordModel(); passwordModel.Email = User.Identity.Name; EncryptDecrypt objEncryptDecrypt = new EncryptDecrypt(); passwordModel.OldPassword = objEncryptDecrypt.Encrypt(Info.OldPassword, WebConfigurationManager.AppSettings["ServiceAccountPassword"]); EncryptDecrypt objEncryptDecrypt1 = new EncryptDecrypt(); passwordModel.NewPassword = objEncryptDecrypt.Encrypt(Info.NewPassword, WebConfigurationManager.AppSettings["ServiceAccountPassword"]); HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/UpdatePassword", passwordModel, true); bool status = await Utility.DeserializeObject <bool>(userResponseMessage); if (status == true) { tm.IsSuccess = true; tm.Message = "Password updated successfully"; } else { tm.IsSuccess = false; tm.Message = "Failed to update Password"; //Old password Does not match } return(Json(tm)); } return(PartialView("_ChangePassword")); }
public async Task <ActionResult> AddEvent(EventsModel data) { ToastModel tm = new ToastModel(); data.weekday = await _common.GetWeekdayData(); data.frequencies = await _common.GetFrequencyData(); data.sessions = await _common.GetSessionData(); if (ModelState.IsValid) { data.CreatedBy = User.UserId; data.CreatedDate = DateTime.Now; data.UpdatedBy = User.UserId; HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/Event/PostEvent", data, true); var msg = await Utility.DeserializeObject <string>(userResponseMessage); if (msg == "Event successfully added" || msg == "Event successfully edited") { tm.IsSuccess = true; tm.Message = msg; } else { tm.IsSuccess = false; tm.Message = msg; } return(Json(tm)); } return(RedirectToAction("Event", "Event")); }
public async Task <ActionResult> Event(ToastModel tm = null) { ViewBag.msg = TempData["msg"] as string; if (!string.IsNullOrEmpty(tm.Message)) { ViewBag.tm = tm; } MainEventModel mainEventModel = new MainEventModel(); mainEventModel.currentEventModel = await _common.GetEvents(); foreach (var item in mainEventModel.currentEventModel) { if (item.Amount != null) { item.ChangeAmount = (int)item.Amount; } else { item.ChangeAmount = 0; } } mainEventModel.events.weekday = await _common.GetWeekdayData(); mainEventModel.events.frequencies = await _common.GetFrequencyData(); mainEventModel.events.sessions = await _common.GetSessionData(); ViewBag.CountryList = await _common.GetCountryData(); return(View("Event", mainEventModel)); }
public async Task <ActionResult> UserActivation(string user) { string email = _common.DecryptContent(user); UserModel um = await _user.GetUserInfo(email); ToastModel tm = new ToastModel(); if (um != null) { um.EmailConfirmed = true; um.Status = true; HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/PostUser", um, true); if (userResponseMessage.IsSuccessStatusCode) { tm.IsSuccess = true; tm.Message = "Your account has been activated successfully"; } else { tm.IsSuccess = false; tm.Message = "Problem occurred while activating your account, try again.."; } } else { tm.IsSuccess = false; tm.Message = "User not found"; } return(View(tm)); }
public async Task AddToastAsync <TComponent>(string title, string subTitle, RenderComponent <TComponent> component, ToastOptions options = null) where TComponent : IComponent { var toast = new ToastModel(title, subTitle, component?.Contents, options); toasts.Add(toast); await Changed(); }
public async Task <ActionResult> ChangeEmail(UpdateEmail em) { ToastModel tm = new ToastModel(); //string role = await _common.GetUserRoleName(User.Identity.Name); if (ModelState.IsValid) { //string uId = await _account.GetUserIdByEmail(User.Identity.Name); string uId = em.userId; bool isEmailExists = await _account.CheckIsEmailExists(em.Email); if (isEmailExists) { tm.IsSuccess = false; tm.Message = "Email already exists"; return(Json(tm)); } else { EncryptDecrypt objEncryptDecrypt = new EncryptDecrypt(); UpdateEmail emailM = await _user.GetEmailById(uId); string mailTo = emailM.Email; UpdateEmail emailModel = new UpdateEmail(); emailModel.userId = uId; emailModel.Email = em.Email; UserModel usrm = await _user.GetUserInfo(emailM.Email); HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/UpdateEmailAddress", emailModel, true); if (userResponseMessage.IsSuccessStatusCode) { EmailTemplateModel etm = await _account.GetEmailTemplate(1); string approvalLink = configMngr["UserActivationLink"] + objEncryptDecrypt.Encrypt(emailM.Email, configMngr["ServiceAccountPassword"]); string fullname = usrm.FirstName + " " + usrm.LastName; string emailBody = etm.Body .Replace("[Username]", fullname) .Replace("[URL]", approvalLink); etm.Body = emailBody; EmailManager emailmgr = new EmailManager { Body = etm.Body, To = mailTo, Subject = etm.Subject, From = ConfigurationManager.AppSettings["SMTPUsername"] }; emailmgr.Send(); } tm.IsSuccess = true; tm.Message = "Email updated successfully and an email has been sent to registered email. Please activate your account"; return(Json(tm)); } } return(RedirectToAction("EditUserEmail", "Common")); }
public async Task RemoveToastAsync(ToastModel toast) { if (toasts.Contains(toast)) { toasts.Remove(toast); } await Changed(); }
public async Task <IActionResult> EventDone(int id) { IResult result = await _eventService.EventDone(id); TempData["ToastMessage"] = result.IsSuccess ? JsonSerializer.Serialize <ToastModel>(ToastModel.Success("Etkinlik Sonlandırıldı !")) : JsonSerializer.Serialize <ToastModel>(ToastModel.Fail(result.Message)); return(RedirectToAction(nameof(Index))); }
public AnimatedToastBlock(ToastModel model) { InitializeComponent(); BackgroundRectangle.Fill = model.BackgroundColor; MessageTextBlock.Text = model.Text; MessageTextBlock.Foreground = model.FontColor; BackgroundRectangle.Width = MessageTextBlock.Width + model.ExtraSize; }
public void InitializeComponents(Grid parent) { _toastTimer.Interval = TimeSpan.FromMilliseconds(_timeElapse); _toastTimer.Tick += _toastTimer_Tick; _parentGrid = parent; ToastModel = new ToastModel(text: "BASE", fontColor: Color.FromArgb(255, 255, 255, 255), backgroundColor: Color.FromArgb(255, 56, 56, 56)); }
public static void Toast(ToastEmoji emoji, string contentText) { GRoot.inst.AddChild(Instance.root); Instance.root.Center(); var toast = new ToastModel() { content = contentText, emoji = emoji }; Instance.InitilzeModel(toast); }
public async Task <ActionResult> ResetForgotPassword(ResetForgotPasswordModel model) { bool areAllAnswersValid = false; ToastModel tm = new ToastModel(); List <SecurityQuestionsModel> sqList = await _account.GetSecurityQuestionsByEmail(model.Email); Dictionary <int, string> userAnsweredQuestions = new Dictionary <int, string>(); var enPassword = model.Password; EncryptDecrypt objEncryptDecrypt1 = new EncryptDecrypt(); enPassword = objEncryptDecrypt1.Encrypt(model.Password, WebConfigurationManager.AppSettings["ServiceAccountPassword"]); for (int i = 0; i < sqList.Count; i++) { if ((Request.Form["AnswerTextbox_" + (i + 1)]) != "") { userAnsweredQuestions.Add((i + 1), Request.Form["AnswerTextbox_" + (i + 1)]); } } foreach (var item in userAnsweredQuestions) { sqList.ForEach(sq => { areAllAnswersValid = sq.Value == item.Value; }); } if (areAllAnswersValid) { ResetPasswordModel rpm = new ResetPasswordModel { Email = model.Email, Password = enPassword }; string urlAction = "api/Account/ResetUserPassword"; HttpResponseMessage resetPasswordResponse = await Utility.GetObject(urlAction, rpm); tm.IsSuccess = await Utility.DeserializeObject <bool>(resetPasswordResponse); tm.Message = "Your password has been reset"; } else { EncryptDecrypt objEncryptDecrypt = new EncryptDecrypt(); string email = objEncryptDecrypt.Encrypt(model.Email, configMngr["ServiceAccountPassword"]); return(RedirectToAction("ResetForgotPassword", new { user = email, isRedirected = true })); } return(View("ResetPasswordConfirmation", tm)); }
public ActionResult Partial_FileAlreadyExistsToast() { ToastModel toast = new ToastModel(); toast.Head = "Ошибка"; toast.CloseText = "Закрыть"; toast.Message = "Такой файл уже существует!"; toast.Delay_ms = 20000; toast.BgColor = Colors.warning; toast.HeadColor = Colors.danger; toast.HeadTextColor = Colors.white; toast.BodyTextColor = Colors.dark; toast.CloseLinkColor = Colors.warning; return(PartialView("Partial_Toast", toast)); }
public ActionResult Partial_ExErrorToast(string ex) { ToastModel toast = new ToastModel(); toast.Head = "Ошибка"; toast.CloseText = "Закрыть"; toast.Message = ex; toast.IsAutohide = false; toast.BgColor = Colors.warning; toast.HeadColor = Colors.danger; toast.HeadTextColor = Colors.white; toast.BodyTextColor = Colors.white; toast.CloseLinkColor = Colors.warning; return(PartialView("Partial_Toast", toast)); }
public ActionResult Partial_SuccesUploadedToast() { ToastModel toast = new ToastModel(); toast.Head = "Успех"; toast.CloseText = "Закрыть"; toast.Message = "Файл успешно загружен!"; toast.Delay_ms = 20000; toast.BgColor = Colors.white; toast.HeadColor = Colors.success; toast.HeadTextColor = Colors.white; toast.BodyTextColor = Colors.dark; toast.CloseLinkColor = Colors.white; return(PartialView("Partial_Toast", toast)); }
public ActionResult Partial_DeletedToast() { ToastModel toast = new ToastModel(); toast.Head = "Успех"; toast.CloseText = "Закрыть"; toast.Message = "Успешно удалено!"; toast.Delay_ms = 20000; toast.BgColor = Colors.white; toast.HeadColor = Colors.warning; toast.HeadTextColor = Colors.dark; toast.BodyTextColor = Colors.dark; toast.CloseLinkColor = Colors.dark; return(PartialView("Partial_Toast", toast)); }
public ActionResult Partial_UnknownErrorToast() { ToastModel toast = new ToastModel(); toast.Head = "Ошибка"; toast.CloseText = "Закрыть"; toast.Message = "Непредвиденная ошибка!"; toast.Delay_ms = 20000; toast.BgColor = Colors.warning; toast.HeadColor = Colors.danger; toast.HeadTextColor = Colors.white; toast.BodyTextColor = Colors.dark; toast.CloseLinkColor = Colors.warning; return(PartialView("Partial_Toast", toast)); }
public void ShowMessage(string message) { var toastModel = new ToastModel { Position = new ToastPositionModel { X = "Right", Y = "Top" }, Content = message, TimeOut = TimeOut, CssClass = GetCssClass() }; ToastComponent.Show(toastModel); }
public async Task <IActionResult> Basket() { IDataResult <CartDTO> cart = await _cartService.GetCart(); if (!cart.IsSuccess) { TempData["ToastMessage"] = JsonSerializer.Serialize <ToastModel>(ToastModel.Fail("Sepetinizde Ürün Bulunmuyor !")); return(RedirectToAction(nameof(Index), "Home")); } int userId = Convert.ToInt32(User.FindFirst("UserId").Value); CreateOrderDto createOrderDto = new CreateOrderDto(); createOrderDto.UserAddresses = await _userAddressService.GetListAsync(userId); return(View(createOrderDto)); }
public void ShowSuccessToast(string message, string title = "Success!") { ToastModel toastModel; toastModel = new ToastModel { CssClass = "e-toast-success", Icon = "e-success toast-icons", Title = title, Content = message, ShowProgressBar = true, ShowCloseButton = true }; ShowToast(toastModel); }
private void ShowReminder(object sender, EventArgs e) { using (var service = new WindowsToastService()) { var toast = new ToastModel { Id = "sd4g63d42", Title = "Esto es una notificación", Body = "Esto es una notificación", Type = ToastTypes.Notification, Arguments = $"action={BackgroundDataTemplate.ShowTaskDetailsName}&listName=Casos de pruebas&taskId=48.58" }; service.ShowToast(toast); } }
private void ShowAlarm(object sender, EventArgs e) { using (var service = new WindowsToastService()) { var id = "k5j3hf9s1s"; var toast = new ToastModel { Id = id, Title = "Esto es una notificación", Body = "Esto es una notificación", Type = ToastTypes.Alarm, Arguments = $"action={BackgroundDataTemplate.CompleteTaskName}&listName=Casos de pruebas&taskId=48.58&toastId={id}" }; service.ShowToast(toast); } }
public void ShowExceptionToast(Exception exception) { ToastModel toastModel; #if DEBUG var contentBuilder = new StringBuilder(); contentBuilder.AppendLine($"{exception.GetType().Name}:"); contentBuilder.AppendLine(exception.Message); contentBuilder.AppendLine(); contentBuilder.AppendLine("Stack trace:"); contentBuilder.AppendLine(exception.StackTrace); if (exception.InnerException != null) { contentBuilder.AppendLine($"{exception.InnerException.GetType().Name}:"); contentBuilder.AppendLine(exception.InnerException.Message); contentBuilder.AppendLine("Stack trace:"); contentBuilder.AppendLine(exception.InnerException.StackTrace); } MarkupString markupString = (MarkupString)contentBuilder.ToString(); toastModel = new ToastModel { CssClass = "e-toast-danger", Icon = "e-error toast-icons", Title = "An Exception has occurred", Content = markupString.Value, ShowCloseButton = true, TimeOut = 0 }; #else toastModel = new ToastModel { CssClass = "e-toast-danger", Title = "An error has occured ;(", Content = "Detail are held secret", ShowCloseButton = true, TimeOut = 0, Width = "40%" }; #endif ShowToast(toastModel); }