예제 #1
0
        /// <summary>
        /// Read csv file;
        /// </summary>
        /// <param name="context"></param>
        public void Execute(IJobExecutionContext context)
        {
            // Read list from Database.
            var listImagesCSV = ReadWriteCSV.ReadCSV(pathCSV);

            // Change Active For LockScreen
            foreach (var item in listImagesCSV.Where(x => x.Type == "LockScreen").ToList())
            {
                // Check TimeTo duedate to change default images to active
                if (item.TimeTo > DateTime.Now)
                {
                    StartMove(-item.ID, item.TimeTo, Directory.GetFiles(pathDefaultLockScreen)[0], pathLockScreen + "default.jpg", item.Type);
                }
                // Check TimeForm to change images list to active images
                if (item.TimeFrom > DateTime.Now)
                {
                    StartMove(item.ID, item.TimeFrom, pathImages + item.Name, pathLockScreen + "default.jpg", item.Type);
                }
            }
            // Change Activ For ScreenSaver
            foreach (var item in listImagesCSV.Where(x => x.Type == "ScreenSaver").ToList())
            {
                // Check TimeTo duedate to change default images to active
                if (item.TimeTo > DateTime.Now)
                {
                    StartRemove(-item.ID, item.TimeTo, pathScreenSaver, item.Name);
                }
                // Check TimeStart to change images list to active images
                if (item.TimeFrom > DateTime.Now)
                {
                    StartMove(item.ID, item.TimeFrom, pathImages + item.Name, pathScreenSaver + item.Name, item.Type);
                }
            }
        }
예제 #2
0
 public ActionResult Index()
 {
     try
     {
         if (ReadWriteCSV.ReadCSV(pathCSV).Count != 0)
         {
             Session["Images"] = ReadWriteCSV.ReadCSV(pathCSV);
         }
         else
         {
             Session["Images"] = null;
         }
     }
     catch (Exception ex)
     {
         Notification("Error", "Can't read CSV file!, " + ex.ToString(), MyConstants.NOTIFY_ERROR);
     }
     return(View());
 }