def search_autoagent_byid(autoagentid): autoagent = None try: autoagent = DAL_AutoAgent.get_all().filter(id=autoagentid) except Exception as ex: SimpleLogger.error(ex.message) return autoagent
def search_autoagent_byname(autoagentname): result = None try: result = DAL_AutoAgent.get_all().filter( AName__icontains=autoagentname) except Exception as ex: print(ex) return result
def search_autoagent(searchkeyword): if searchkeyword == "ALL": result = DAL_AutoAgent.get_all().filter(AIsActive=1) else: result = AutoAgentService.search_autoagent_byid(searchkeyword) if result == None or len(result) == 0: result = AutoAgentService.search_autoagent_byname( searchkeyword.strip()) return result.order_by("-id")
def get_autotask_agent(autotaskid): all_agents=DAL_AutoAgent.get_all() result=list() for agent in all_agents: temp=dict() temp["text"]=agent.AName temp["memberid"]=agent.id if autotaskid!=0: autotask=DAL_AutomationTask.get_automation_task(autotaskid) if agent.id==autotask.TaskAgentID: temp["selected"]=1 else: temp["selected"]=0 else: temp["selected"]=0 result.append(temp) return str(result).replace("u'","'")
def get_autoagent_namelist(): autoagentlist = DAL_AutoAgent.get_all() return str([item.TaskName for item in autoagentlist]).replace("u'", "'")