Ejemplo n.º 1
0
 /// <summary>
 /// 修改脚本节点实例状态
 /// </summary>
 /// <param name="scriptCaseID"></param>
 /// <param name="runStatus"></param>
 /// <param name="err"></param>
 public static void ModifyScriptNodeCase(long?scriptNodeCaseID, PubEnum.RunStatus runStatus, ref ErrorInfo err)
 {
     if (scriptNodeCaseID == null)
     {
         err.IsError = true;
         err.Message = "传入的scriptNodeCaseID不能为空";
         return;
     }
     using (DBEntities db = new DBEntities())
     {
         var scase = db.EM_SCRIPT_NODE_CASE.Find(scriptNodeCaseID);
         scase.RUN_STATUS = (short)runStatus;
         if (runStatus == PubEnum.RunStatus.Wait)
         {
             //状态修改为等待时,设置启动时间
             scase.START_TIME  = DateTime.Now;
             scase.RETURN_CODE = null;
             scase.END_TIME    = null;
         }
         if (runStatus == PubEnum.RunStatus.Excute)
         {
             scase.RETURN_CODE = null;
             scase.END_TIME    = null;
         }
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             err.IsError = true;
             err.Message = e.Message;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 修改脚本流实例状态2
 /// </summary>
 /// <param name="scriptCaseID"></param>
 /// <param name="runStatus"></param>
 /// <param name="returnCode"></param>
 /// <param name="err"></param>
 public static void ModifyScriptCase(long?scriptCaseID, PubEnum.RunStatus runStatus, PubEnum.ReturnCode returnCode, ref ErrorInfo err, PubEnum.IsHaveFail IsHaveFail = 0)
 {
     if (scriptCaseID == null)
     {
         err.IsError = true;
         err.Message = "传入的scriptCaseID不能为空";
         return;
     }
     using (DBEntities db = new DBEntities())
     {
         var scase = db.EM_SCRIPT_CASE.Find(scriptCaseID);
         scase.RETURN_CODE  = (short)returnCode;
         scase.RUN_STATUS   = (short)runStatus;
         scase.END_TIME     = DateTime.Now;
         scase.IS_HAVE_FAIL = (short)IsHaveFail;
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             err.IsError = true;
             err.Message = e.Message;
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 修改脚本节点实例状态
 /// </summary>
 /// <param name="scriptNodeCaseID"></param>
 /// <param name="runStatus"></param>
 /// <param name="returnCode"></param>
 /// <param name="err"></param>
 public static EM_SCRIPT_NODE_CASE ModifyScriptNodeCase(long?scriptNodeCaseID, PubEnum.RunStatus runStatus, PubEnum.ReturnCode returnCode, ref ErrorInfo err)
 {
     if (scriptNodeCaseID == null)
     {
         err.IsError = true;
         err.Message = "传入的scriptNodeCaseID不能为空";
         return(null);
     }
     using (DBEntities db = new DBEntities())
     {
         var scase = db.EM_SCRIPT_NODE_CASE.Find(scriptNodeCaseID);
         scase.RETURN_CODE = (short)returnCode;
         scase.RUN_STATUS  = (short)runStatus;
         scase.END_TIME    = DateTime.Now;
         if (runStatus == PubEnum.RunStatus.Stop && returnCode == PubEnum.ReturnCode.Fail)
         {
             scase.RETRY_TIME = scase.RETRY_TIME == null ? 1 : scase.RETRY_TIME + 1;
         }
         try
         {
             db.SaveChanges();
             return(scase);
         }
         catch (Exception e)
         {
             err.IsError = true;
             err.Message = e.Message;
             return(null);
         }
     }
 }