public async Task <IActionResult> OnGetAsync() { var user = await _userManager.GetUserAsync(User); var notificationList = _context.NoNotifications.Where(x => x.UserId == user.Id); var mailNotify = new MailNotify() { BeforeLecture = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.Email).Any(x => x.NotificationType == EnumList.Notifications.LectureStart), CourseUpdate = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.Email).Any(x => x.NotificationType == EnumList.Notifications.CourseUpdate), ImportantUpdate = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.Email).Any(x => x.NotificationType == EnumList.Notifications.ImportantUpdate), OfferAndOther = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.Email).Any(x => x.NotificationType == EnumList.Notifications.OfferAndOther), }; //ToDo :: Add Sms notify list var smsNotify = new SmsNotify() { BeforeLecture = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.SMS).Any(x => x.NotificationType == EnumList.Notifications.LectureStart), CourseUpdate = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.SMS).Any(x => x.NotificationType == EnumList.Notifications.CourseUpdate), ImportantUpdate = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.SMS).Any(x => x.NotificationType == EnumList.Notifications.ImportantUpdate), OfferAndOther = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.SMS).Any(x => x.NotificationType == EnumList.Notifications.OfferAndOther), }; Input = new InputModel() { ShowName = user.ShowFullName, FullName = user.FirstName + " " + user.LastName, ProfileUserName = user.ProfileUserName, MailNotify = mailNotify, SmsNotify = smsNotify }; return(Page()); }
private void OnMailNotifyRes(short state, MailNotify down = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } for (int i = 0; i < down.msgs.get_Count(); i++) { this.AddOne2Mails(down.msgs.get_Item(i)); } if (MailUIViewModel.Instance != null && MailUIViewModel.Instance.get_gameObject().get_activeSelf()) { MailUIViewModel.Instance.UpdateUI(true); } }
public override MethodResult Execute(object testClass) { try { var currentMode = RegistryModeFactory.GetCurrentMode(); var shouldProcess = true; if (LiveOnly && currentMode != RegistryMode.Live) { shouldProcess = false; } if (shouldProcess) { var observer = ObjectFactory.GetInstance <IObserver>(); if (observer != null) { observer.PopAll(); var ret = testMethod.MethodInfo.Invoke(testClass, null); var specItem = ret as SpecItem; if (specItem == null) { throw new InvalidOperationException("The function has no return type or the type is not SpecItem!"); } specItem.ToWatchItem().RunTest(true); if (observer.HasItem) { // send email #region SendEmail var notify = new MailNotify() { SMTP = "smtp.exmail.qq.com", UserName = "******", Password = "******", Subject = "【自动化测试】接口测试异常报警", MailTo = new string[] { "*****@*****.**" }, MailFrom = "*****@*****.**" }; var mailContent = new StringBuilder(); while (observer.HasItem) { var item = observer.Pop().Display(); mailContent.AppendLine(item); } notify.SendMail(mailContent.ToString()); #endregion return(new FailedResult(testMethod, new Exception(mailContent.ToString()), DisplayName)); } } } } catch (ParameterCountMismatchException) { throw new InvalidOperationException("Fact method " + TypeName + "." + MethodName + " cannot have parameters"); } return(new PassedResult(testMethod, DisplayName)); }