예제 #1
0
 // after putting the workpackage to STREAM web service, update last execution time using the function below:
 public void update_exec_times()
 {
     try
     {
         using (var _context = new streamlogEntities())
         {
             var logSetting = _context.TRAXPILT_SET.FirstOrDefault(i => i.ID == 1);
             logSetting.LAST_EXECUTION_TIME = DateTime.Now;
             _context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         WriteToFile("Could not update exec times" + ex.Message);
     }
 }
예제 #2
0
        private void OnElapsedTime(object sender, ElapsedEventArgs e)
        {
            using (var _context = new streamlogEntities())
            {
                exec_time      = _context.TRAXPILT_SET.Select(i => i.EX_TIME).First().GetValueOrDefault();
                last_exec_time = _context.TRAXPILT_SET.Select(i => i.LAST_EXECUTION_TIME).First();
            }

            TimeSpan timeSpan = DateTime.Now - last_exec_time;

            if (timeSpan.TotalMilliseconds > exec_time)
            {
                PutWorkPackage();
                update_exec_times();
            }
            else
            {
                WriteToFile("Not enough time passed " + DateTime.Now);
            }
        }
예제 #3
0
 // Write to the log database in oracle, calling oracle stored procedure for inserting values
 public void WriteLog(string xmlSource, string response, int status)
 {
     try
     {
         using (var _context = new streamlogEntities())
         {
             TRAXPILT_LOG logEntry = new TRAXPILT_LOG
             {
                 XML_SOURCE   = xmlSource,
                 XML_RESPONSE = response,
                 STATUS       = status,
                 CREATE_DATE  = DateTime.Now
             };
             _context.TRAXPILT_LOG.Add(logEntry);
             _context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         WriteToFile("Could not write to log " + ex.ToString());
     }
 }