//remove all tasks that have already been aggregated from the task table
        public static void PurgeAllAggregatedTasks()
        {
            SatyamTaskTableAccess taskDB = new SatyamTaskTableAccess();
            //List<int> IDList = taskDB.getAllIDs();
            List <SatyamTaskTableEntry> taskList = taskDB.getAllEntries();

            SatyamAggregatedResultsTableAccess aggDB = new SatyamAggregatedResultsTableAccess();
            List <int> AggIDList = aggDB.getAllTaskIDs();

            //List<SatyamAggregatedResultsTableEntry> aggEntreis = aggDB.getAllEntries();

            foreach (SatyamTaskTableEntry t in taskList)
            {
                int id = t.ID;
                if (!AggIDList.Contains(id))
                {
                    continue;
                }

                //int LatestNumberAggregated = aggDB.getLatestNoResultsAggregatedByTaskID(id);
                //int MinResults = TaskConstants.getMinResultsByTemplate(t.JobTemplateType);

                //if(LatestNumberAggregated >= MinResults)
                //{
                taskDB.DeleteEntry(id);
                //}
            }
            aggDB.close();
            taskDB.close();
        }
Beispiel #2
0
        public static void Run([TimerTrigger("0 */1 * * * *")] TimerInfo myTimer, TraceWriter log)
        {
            DateTime start = DateTime.Now;
            SatyamTaskTableAccess taskDB = new SatyamTaskTableAccess();
            List <int>            IDList = taskDB.getAllIDs();

            taskDB.close();

            SatyamAggregatedResultsTableAccess aggDB = new SatyamAggregatedResultsTableAccess();
            List <int> AggIDList = aggDB.getAllTaskIDs();

            aggDB.close();

            foreach (int id in IDList)
            {
                if (AggIDList.Contains(id))
                {
                    taskDB = new SatyamTaskTableAccess();
                    taskDB.DeleteEntry(id);
                    taskDB.close();
                    if ((DateTime.Now - start).TotalSeconds > 280)
                    {
                        break;
                    }
                }
            }
        }