예제 #1
0
        /// <summary>
        /// Gets the RemindMe messages from the database, sent by the creator of RemindMe
        /// </summary>
        public static Database.Entity.RemindMeMessages GetRemindMeMessageById(int id)
        {
            //Don't do anything without internet
            if (!BLIO.HasInternetAccess())
            {
                return(null);
            }

            Data_Access_Layer.RemindMeMessages dbObject = DLOnlineDatabase.GetRemindMeMessageById(id);

            if (dbObject == null)
            {
                return(null);
            }

            Database.Entity.RemindMeMessages message = new Database.Entity.RemindMeMessages();

            message.Id = dbObject.Id;
            message.MeantForSpecificVersion = dbObject.MeantForSpecificVersion;
            message.Message = dbObject.Message;
            message.NotificationDuration = dbObject.NotificationDuration;
            message.NotificationOnTop    = dbObject.NotificationOnTop;
            message.NotificationType     = dbObject.NotificationType;
            message.ReadByAmountOfUsers  = dbObject.ReadByAmountOfUsers;
            message.DateOfCreation       = dbObject.DateOfCreation;

            return(message);
        }
예제 #2
0
        /// <summary>
        /// Adds another count to the amount of times a message is read
        /// </summary>
        /// <param name="id"></param>
        public static void UpdateRemindMeMessageCount(int id)
        {
            RemindMeMessages mess = db.RemindMeMessages.Where(m => m.Id == id).FirstOrDefault();

            mess.ReadByAmountOfUsers++;
            db.SaveChanges();
        }
예제 #3
0
 /// <summary>
 /// Adds another count to the amount of times a message is read
 /// </summary>
 /// <param name="id"></param>
 public static void UpdateRemindMeMessageCount(int id)
 {
     using (remindmesqldbEntities db = new remindmesqldbEntities())
     {
         int attemptCount = 0;
         while (!terminateDatabaseAccess && !CanConnect(db))
         {
             Thread.Sleep(500);
             if (attemptCount > MAX_ATTEMPTS)
             {
                 break;
             }
         }
         RemindMeMessages mess = db.RemindMeMessages.Where(m => m.Id == id).FirstOrDefault();
         mess.ReadByAmountOfUsers++;
         db.SaveChanges();
     }
 }