Exemple #1
0
 def dm_updateautorunresult(request):
     message = "successful"
     try:
         autorunresult=DAL_AutoRunResult.get_autorunresult(request.POST["autorunresultid"])
         autorunresult = AutoRunResultService.initlize_dm_instance(request,autorunresult)
         DAL_AutoRunResult.add_autorunresult(autorunresult)
     except Exception as ex:
         message = str(ex)
         SimpleLogger.error(message)
     return message
Exemple #2
0
 def disable_autorunresult(request):
     
     message = "successful"
     try:
         autorunresult=DAL_AutoRunResult.get_autorunresult(request.POST["autorunresultid"])
         autorunresult.TaskIsActive=0
         DAL_AutoRunResult.add_autorunresult(autorunresult)
     except Exception as ex:
         message = str(ex)
         SimpleLogger.error(message)
     return message
Exemple #3
0
 def dm_createautorunresult(request):
     ''' create new  db model autorunresult
     '''
     message = "successful"
     try:
         autorunresult = AutoRunResult()
         autorunresult = AutoRunResultService.initlize_dm_instance(request,autorunresult)
         DAL_AutoRunResult.add_autorunresult(autorunresult)
     except Exception as ex:
         message = str(ex)
         SimpleLogger.error(message)
     return message
Exemple #4
0
 def search_autorunresult_byname(autorunresultname):
     result = None
     try:
         result = DAL_AutoRunResult.get_all().filter(AName__icontains=autorunresultname)
     except Exception as ex:
         print(ex)
     return result
Exemple #5
0
 def search_autorunresult_byid(autorunresultid):
     autorunresult = None
     try:
         autorunresult = DAL_AutoRunResult.get_all().filter(id=autorunresultid)
     except Exception as ex:
         SimpleLogger.error(ex.message)
     return autorunresult
Exemple #6
0
 def copy_autorunresult(request):
     message = "successful"
     try:
         from_autorunresult=DAL_AutoRunResult.get_autorunresult(request.POST["autorunresultid"])
         to_autorunresult=AutoRunResult()
         to_autorunresult.AName=from_autorunresult.AName
         to_autorunresult.AOS=from_autorunresult.AOS
         to_autorunresult.AIP=from_autorunresult.AIP
         to_autorunresult.AStatus=1
         to_autorunresult.AAgentBrowser=from_autorunresult.AAgentBrowser
         to_autorunresult.AIsReserved=from_autorunresult.AIsReserved
         DAL_AutoRunResult.add_autorunresult(to_autorunresult)
     except Exception as ex:
         message = str(ex)
         SimpleLogger.error(message)
     return message
 def get_autorunresult_reserved(autorunresultid):
     result = 1
     if autorunresultid != 0:
         autorunresult = DAL_AutoRunResult.get_autorunresult(
             autorunresultid)
         result = autorunresult.AIsReserved
     return result
 def get_autorunresult_ip(autorunresultid):
     result = ""
     if autorunresultid != 0:
         autorunresult = DAL_AutoRunResult.get_autorunresult(
             autorunresultid)
         result = autorunresult.AIP
     return result
 def get_autorunresult_name(autorunresultid):
     result = ""
     if autorunresultid != 0:
         autorunresult = DAL_AutoRunResult.get_autorunresult(
             autorunresultid)
         result = autorunresult.AName
     return result
Exemple #10
0
 def search_autorunresult(searchkeyword):
     if searchkeyword == "ALL":
         result = DAL_AutoRunResult.get_all()
     else:
         result = AutoRunResultService.search_autorunresult_byid(searchkeyword)
         if  result ==None or len(result)==0:
             result = AutoRunResultService.search_autorunresult_byname(searchkeyword.strip())
     return result.order_by("-id")
Exemple #11
0
 def get_autorunresult_types(autorunresultid):
     tasktypes = DAL_DictValue.getdatavaluebytype("AutoTaskType")
     result=list()
     for tasktype in tasktypes:
         temp=dict()
         temp["text"]=tasktype.DicDataName
         temp["memberid"]=tasktype.DicDataValue
         if autorunresultid!=0:
             autorunresult=DAL_AutoRunResult.get_autorunresult(autorunresultid)
             if tasktype.DicDataValue==autorunresult.TaskTpye:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemple #12
0
 def get_autorunresult_browsers(autorunresultid):
     all_browsers=DAL_DictValue.getdatavaluebytype("AutoTaskRuntime").filter(DicDataDesc='WEB')
     result=list()
     if autorunresultid!=0:
         autorunresult=DAL_AutoRunResult.get_autorunresult(autorunresultid)
     for browser in all_browsers:
         temp=dict()
         temp["text"]=browser.DicDataName
         temp["memberid"]=browser.DicDataValue
         if autorunresultid!=0:
             if browser.DicDataValue in eval(autorunresult.AAgentBrowser):
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemple #13
0
 def get_autorunresult_os(autorunresultid):
     all_os=DAL_DictValue.getdatavaluebytype("AgentOSType")
     result=list()
     if autorunresultid!=0:
         autorunresult=DAL_AutoRunResult.get_autorunresult(autorunresultid)
     for os in all_os:
         temp=dict()
         temp["text"]=os.DicDataName
         temp["memberid"]=os.DicDataValue
         if autorunresultid!=0:
             if os.DicDataValue==autorunresult.AOS:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemple #14
0
 def get_autorunresult_namelist():
     autorunresultlist = DAL_AutoRunResult.get_all()
     return str([item.TaskName for item in autorunresultlist]).replace("u'","'")