示例#1
0
        public static bool InsertTaskTree(PTR3Core core, IDatabase dbPTRConfig, DelGetConfig getXmlDynamicConfig
      , int rootTaskRunningId, bool parallel, int taskToInsertId, ref int lastInsertedTaskRunningId
      , out string message, MsgStatusEnum logStatus)
        {
            message = "";
              dbPTRConfig.BeginTransaction();
              try
              {
            // wstaw do konfiguracji dynamicznej i dodaj graf procesow do running tasks
            DbParameter OUT_INSERTED_TASK_RI_ID = dbPTRConfig.GetIntParamOut("@OUT_INSERTED_TASK_RI_ID");
            DbParameter OUT_LAST_INSERTED_TASK_RI_ID = dbPTRConfig.GetIntParamOut("@OUT_LAST_INSERTED_TASK_RI_ID");

            int prevTaskId = (parallel ? rootTaskRunningId : lastInsertedTaskRunningId);

            PTR3Core.LOG.Log(logStatus, "Dynamic tasks graph inserting (root running task id: {0}, preview running task id: {1}, task to insert id {2}) ..."
              , rootTaskRunningId, prevTaskId, taskToInsertId);

            dbPTRConfig.ExecuteSp("SP_INSERT_TASK_TREE",
            dbPTRConfig.GetIntParamIn("@IN_ROOF_TASK_RI_ID", rootTaskRunningId),
            dbPTRConfig.GetIntParamIn("@IN_PREV_TASK_RI_ID", prevTaskId),
            dbPTRConfig.GetIntParamIn("@IN_TASK_ID", taskToInsertId),
            OUT_INSERTED_TASK_RI_ID,
            OUT_LAST_INSERTED_TASK_RI_ID);

            int firstInsertedTaskRunningId = (int)OUT_INSERTED_TASK_RI_ID.Value;
            lastInsertedTaskRunningId = (int)OUT_LAST_INSERTED_TASK_RI_ID.Value;

            core.UpdateTaskDynamicConfiguration(dbPTRConfig, getXmlDynamicConfig(firstInsertedTaskRunningId));

            dbPTRConfig.CommitTransaction();

            return true;
              }
              catch(Exception ex)
              {
            dbPTRConfig.RollbackTransaction();
            message = "Error while dynamic task graph inserting: " + ex.Message + "\r\n" + ex.StackTrace + ".";
            return false;
              }
        }
示例#2
0
   public static bool InsertTaskTree(PTR3Core core, IDatabase dbPTRConfig, DelGetConfig getXmlDynamicConfig
 , int rootTaskRunningId, bool parallel, int taskToInsertId, ref int prevTaskRunningId, out string message)
   {
       return InsertTaskTree(core, dbPTRConfig, getXmlDynamicConfig
         , rootTaskRunningId, parallel, taskToInsertId, ref prevTaskRunningId, out message, MsgStatusEnum.MS_Deb1);
   }