Esempio n. 1
0
        public static void StartDBProcess()
        {
            List <TblDatabaseManagement> lstDB = DatabaseManagementsDS.GetDBToWork(StatusDB.Received);
            Metaquery rootMQ = Metaquery.GetRootMQ();

            foreach (TblDatabaseManagement db in lstDB)
            {
                //create first level
                Console.WriteLine("start  : {0}:{1}:{2}:{3}", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
                Console.WriteLine(rootMQ.ToString());
                TblMetaquery tblMetaquery = new TblMetaquery()
                {
                    Arity        = rootMQ.Arity,
                    FkDatabaseId = db.Id,
                    FkStatusId   = (int)StatusDB.Received,
                    Metaquery    = rootMQ.ToString()
                };
                MetaqueryDS.Create(tblMetaquery);
                DatabaseManagementsDS.UpdateStatus(db, StatusDB.InProcess);
            }
            //if at least 1 metaquery created - we can start send it to solver
            if (lstDB.Count > 0 && IsAutoRunJobs)
            {
                ThreadPool.QueueUserWorkItem(delegate
                {
                    StartSendMQToSolver();
                });
            }
        }
Esempio n. 2
0
        public static void StartIncreaseDBArity()
        {
            //Update status of the db that this arity is the last
            List <TblDatabaseManagement> lstFinishDB = DatabaseManagementsDS.GetDBThatFinishedProcess();

            foreach (TblDatabaseManagement db in lstFinishDB)
            {
                DatabaseManagementsDS.UpdateStatus(db, StatusDB.Done);
                MQGeneratorMail.SendDBFinishedMail(db);
            }

            //Increase DB Arity in db that finished calculate the current arity
            List <TblDatabaseManagement> lstDB = DatabaseManagementsDS.GetDBToIncreaseArity();

            foreach (TblDatabaseManagement db in lstDB)
            {
                db.CurrentArity++;
                DatabaseManagementsDS.Update(db);
            }
            if (lstDB.Count > 0 && IsAutoRunJobs)
            {
                ThreadPool.QueueUserWorkItem(delegate
                {
                    StartSendMQToSolver();
                });
            }
        }