コード例 #1
0
 void alertTimer_Tick(object sender, EventArgs e)
 {
     myContext.Load <Alert>(myContext.GetMyAlertsQuery(),
                            (lo) =>
     {
         if (!lo.HasError)
         {
             foreach (Alert alertItem in lo.Entities)
             {
                 AlertUser alertUserItem = alertItem.AlertUsers.FirstOrDefault <AlertUser>(x => x.User.Name == App.Current.ApplicationLifetimeObjects.OfType <WebContext>().First().User.Name);
                 if (alertUserItem != null)
                 {
                     if (!alertItems.Contains(alertItem))
                     {
                         alertItems.Insert(0, alertItem);
                     }
                 }
             }
         }
         if (TopUnAcknowledgedAlertItem == null || TopUnAcknowledgedAlertItem.AlertUsers.First <AlertUser>(x => x.User.Name == App.Current.ApplicationLifetimeObjects.OfType <WebContext>().First().User.Name).UserMessageStatus == "Received")
         {
             SetUnAcknowledgedAlert();
         }
     }, null);
 }
コード例 #2
0
        /// <summary>
        /// Logs a message to the log channel
        /// </summary>
        /// <param name="title">Title of log</param>
        /// <param name="message">Message to log</param>
        /// <param name="mention">Alert TopHATTwaffle?</param>
        /// <returns>Task</returns>
        public Task ChannelLog(string title, string message, bool mention = false)
        {
            string alert = null;

            if (mention)
            {
                var splitUser = AlertUser.Split('#');
                alert = _client.GetUser(splitUser[0], splitUser[1]).Mention;
            }

            LogChannel.SendMessageAsync($"{alert}```{DateTime.Now}\n{title}\n{message}```");
            Console.WriteLine($"{DateTime.Now}: {title}\n{message}\n");
            return(Task.CompletedTask);
        }
コード例 #3
0
        private void AlertOK(object item)
        {
            Alert alertItem = item as Alert;

            if (alertItem != null)
            {
                AlertUser alertUserItem = alertItem.AlertUsers.FirstOrDefault <AlertUser>(x => x.User.Name == App.Current.ApplicationLifetimeObjects.OfType <WebContext>().First().User.Name);

                Alert alertItemInContext = myContext.Alerts.FirstOrDefault(x => x.Code == alertItem.Code);
                if (alertItemInContext != null)
                {
                    AlertUser alertUserItemContext = alertItemInContext.AlertUsers.FirstOrDefault <AlertUser>(x => x.User.Name == App.Current.ApplicationLifetimeObjects.OfType <WebContext>().First().User.Name);
                    if (alertUserItem != null)
                    {
                        alertUserItemContext.UserMessageStatus = "Received";
                        alertUserItem.UserMessageStatus        = "Received";
                        myContext.SubmitChanges(AlertOKCallback, null);
                    }
                }
            }
        }
コード例 #4
0
 public void DeleteAlertUser(AlertUser alertUserItem)
 {
     alertUserRepository.Delete(alertUserItem);
 }
コード例 #5
0
 public void UpdateAlertUser(AlertUser alertUserItem)
 {
     alertUserRepository.Update(alertUserItem);
 }
コード例 #6
0
 public void InsertAlertUser(AlertUser alertUserItem)
 {
     alertUserRepository.Add(alertUserItem);
 }
コード例 #7
0
 public static AlertUser WithUser(this AlertUser alertUser, MCUser user)
 {
     alertUser.User = user;
     return(alertUser);
 }
コード例 #8
0
 public static AlertUser WithAlert(this AlertUser alertUser, Alert alert)
 {
     alertUser.Alert = alert;
     return(alertUser);
 }
コード例 #9
0
 public static AlertUser WithAcknowledgedDate(this AlertUser alertUser, DateTime acknowledgedDate)
 {
     alertUser.AcknowledgedDate = acknowledgedDate;
     return(alertUser);
 }
コード例 #10
0
 public static AlertUser WithUserMessageStatus(this AlertUser alertUser, String userMessageStatus)
 {
     alertUser.UserMessageStatus = userMessageStatus;
     return(alertUser);
 }
コード例 #11
0
 public static AlertUser WithUserCode(this AlertUser alertUser, Guid userCode)
 {
     alertUser.UserCode = userCode;
     return(alertUser);
 }
コード例 #12
0
 public static AlertUser WithAlertCode(this AlertUser alertUser, Guid alertCode)
 {
     alertUser.AlertCode = alertCode;
     return(alertUser);
 }
コード例 #13
0
 public static AlertUser WithCode(this AlertUser alertUser, Guid code)
 {
     alertUser.Code = code;
     return(alertUser);
 }
コード例 #14
0
 public void IU_AlertUser(AlertUser data)
 {
     L2qContext.msp_AlertUser_IU(data.UserId, data.LatestViewDate);
 }