コード例 #1
0
 public List<Notification> GetLastTenRowsByStaffId(String id)
 {
     try
     {
         List<Notification> notifications = new List<Notification>();
         DataTable dt = notificationDAL.GetLastTenRowsByStaffID(id);
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             Notification notification = new Notification();
             notification.ID = dt.Rows[i][0].ToString();
             notification.Detail = dt.Rows[i][1].ToString();
             notification.ReceiveTime = Convert.ToDateTime(dt.Rows[i][2].ToString());
             notification.Deadline = Convert.ToDateTime(dt.Rows[i][3].ToString());
             notification.Times = Convert.ToInt16(dt.Rows[i][4].ToString());
             notification.Status = Convert.ToInt16(dt.Rows[i][6].ToString());
             notification.Title = dt.Rows[i][5].ToString();
             notifications.Add(notification);
         }
         return notifications;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 public bool Update(Notification notification)
 {
     SqlParameter[] parameters = new SqlParameter[]{
         new SqlParameter("@MaThongBao",notification.ID),
         new SqlParameter("@ThoiGianGui",notification.ReceiveTime),
         new SqlParameter("@ThoiHan",notification.Deadline),
         new SqlParameter("@SoLan",notification.Times)
     };
     return DBConnection.Instance.ExecuteQuery("UpdateNotification",parameters,CommandType.StoredProcedure);
 }
コード例 #3
0
 public Notification GetUnrepliedNotificationByStaffId(String id)
 {
     Notification notification = new Notification();
     DataTable dt = notificationDAL.GetUnrepliedNotificationByStaffId(id);
     if (dt.Rows.Count > 0)
     {
         notification.ID = dt.Rows[0][0].ToString();
         notification.Detail = dt.Rows[0][1].ToString();
         notification.ReceiveTime = Convert.ToDateTime(dt.Rows[0][2].ToString());
         notification.Deadline = Convert.ToDateTime(dt.Rows[0][3].ToString());
         notification.Times = Convert.ToInt16(dt.Rows[0][4].ToString());
         notification.Status = Convert.ToInt16(dt.Rows[0][6].ToString());
         notification.Title = dt.Rows[0][5].ToString();
     }
     return notification;
 }
コード例 #4
0
        public MessageResource WriteNewNotification(DAL.Notification notification, MessageStatus messageStatus = MessageStatus.Default)
        {
            string          result  = MessageDistributor(messageStatus, notification);
            MessageResource message = null;

            try
            {
                message = MessageResource.Create(
                    body: result,
                    from: new Twilio.Types.PhoneNumber(_PhoneNumber),
                    to: new Twilio.Types.PhoneNumber(notification.Num_Phone)
                    );
            }
            catch (Exception e)
            {
                //Twillio Error
            }

            return(message);
        }
コード例 #5
0
 public bool Update(Notification notification)
 {
     return notificationDAL.Update(notification);
 }
コード例 #6
0
 public void WelcomeUser(DAL.Notification notification)
 {
     messengerApp.WelcomeMessage(notification);
 }
コード例 #7
0
ファイル: MessengerApp.cs プロジェクト: lnxAv/Aeroport-Web
 public void WelcomeMessage(DAL.Notification notification)
 {
     twilloInstance.WriteNewNotification(notification, MessageStatus.Default);
 }
コード例 #8
0
ファイル: Notifier.cs プロジェクト: u2718/HousewifeBot
        private static string GetTorrents(Notification notification, Settings settings)
        {
            string text = string.Empty;
            var torrentGetter = new LostFilmTorrentGetter();
            try
            {
                List<TorrentDescription> torrents = torrentGetter.GetEpisodeTorrents(notification.Episode, settings.SiteLogin, settings.SitePassword);
                if (torrents.Count != 0)
                {
                    text += " (" +
                            torrents.Select(t => t.Quality)
                                .Aggregate(string.Empty, (s, s1) => s + " " + string.Format(DownloadCommand.DownloadCommandFormat, notification.Id, s1))
                            + ")";
                }
            }
            catch (Exception e)
            {
                Logger.Error(e, "SendEpisodesNotifications: An error occured while retrieving torrents for {notification.Episode.Show.Title} - {notification.Episode.Title}");
                text += " (Не удалось получить список торрентов. Возможно указан неверный логин/пароль)";
            }

            text += "\n";
            return text;
        }