protected void hlSendPush_Click(object sender, EventArgs e) { try { Button btn = (Button)(sender); var arguments = btn.CommandArgument; var notificationToSend = NotificationFilter.FetchByID(int.Parse(arguments)); var users = NotificationGroups.GetUsersOfFilter(notificationToSend); try { Task.Run(() => Snoopi.core.FcmService.SendTemplateToMany(notificationToSend.Name, notificationToSend.MessageTemplate, users)).Wait(); } catch (Exception ex) { using (System.IO.StreamWriter sw = System.IO.File.AppendText(AppDomain.CurrentDomain.BaseDirectory + @"\Output\push-log.txt")) { sw.WriteLine(@" ------------" + DateTime.Now + "--------------------" + '\n' + "Exception " + ex.Message + " CallStack : " + ex.StackTrace); } } Master.MessageCenter.DisplaySuccessMessage(NotificationStrings.GetText(@"NotificationSent")); } catch (Exception ex) { Master.MessageCenter.DisplayErrorMessage(NotificationStrings.GetText(@"DeleteErrorMessage") + " \n" + ex.Message + '\n' + ex.StackTrace); } }
protected void checkUserNumber_Click(object sender, EventArgs e) { var filter = GetCurrentFilter(); var users = NotificationGroups.GetUsersOfFilter(filter); lblNumOfUsers.Text = users.Count().ToString(); lblTempUsers.Text = users.Where(x => x.IsTempUser).Count().ToString(); //lblWebTempUsers.Text = users.Where(x => x.IsTempUser && string.IsNullOrEmpty(x.FcmToken)).Count().ToString(); lblAndroidUsers.Text = users.Where(x => !x.IsTempUser && !string.IsNullOrEmpty(x.FcmToken)).Count().ToString(); lblAppleUsers.Text = users.Where(x => !x.IsTempUser && !string.IsNullOrEmpty(x.ApnToken)).Count().ToString(); lblwebUsers.Text = users.Where(x => !x.IsTempUser && string.IsNullOrEmpty(x.ApnToken) && string.IsNullOrEmpty(x.FcmToken)).Count().ToString(); }
protected void hlChechNumOfUsers(object sender, EventArgs e) { try { Button btn = (Button)(sender); var arguments = btn.CommandArgument; var notificationToSend = NotificationFilter.FetchByID(int.Parse(arguments)); var users = NotificationGroups.GetUsersOfFilter(notificationToSend); Master.MessageCenter.DisplaySuccessMessage(NotificationStrings.GetText(@"NotificationSent")); } catch (Exception ex) { Master.MessageCenter.DisplayErrorMessage(NotificationStrings.GetText(@"DeleteErrorMessage") + " \n" + ex.Message + '\n' + ex.StackTrace); } }