def dm_updateautomobiledevice(request): message = "successful" try: automobiledevice = DAL_AutoMobileDevice.get_automobiledevice( request.POST["automobiledeviceid"]) automobiledevice = AutoMobileDeviceService.initlize_dm_instance( request, automobiledevice) DAL_AutoMobileDevice.add_automobiledevice(automobiledevice) except Exception as ex: message = str(ex) SimpleLogger.error(message) return message
def disable_automobiledevice(request): message = "successful" try: automobiledevice = DAL_AutoMobileDevice.get_automobiledevice( request.POST["automobiledeviceid"]) automobiledevice.TaskIsActive = 0 DAL_AutoMobileDevice.add_automobiledevice(automobiledevice) except Exception as ex: message = str(ex) SimpleLogger.error(message) return message
def dm_createautomobiledevice(request): ''' create new db model automobiledevice ''' message = "successful" try: automobiledevice = AutoMobileDevice() automobiledevice = AutoMobileDeviceService.initlize_dm_instance( request, automobiledevice) DAL_AutoMobileDevice.add_automobiledevice(automobiledevice) except Exception as ex: message = str(ex) SimpleLogger.error(message) return message
def get_automobiledevice_reserved(automobiledeviceid): result = 1 if automobiledeviceid != 0: automobiledevice = DAL_AutoMobileDevice.get_automobiledevice( automobiledeviceid) result = automobiledevice.AIsReserved return result
def get_automobiledevice_ip(automobiledeviceid): result = "" if automobiledeviceid != 0: automobiledevice = DAL_AutoMobileDevice.get_automobiledevice( automobiledeviceid) result = automobiledevice.AIP return result
def search_automobiledevice_byname(automobiledevicename): result = None try: result = DAL_AutoMobileDevice.get_all().filter( AName__icontains=automobiledevicename) except Exception as ex: print(ex) return result
def search_automobiledevice_byid(automobiledeviceid): automobiledevice = None try: automobiledevice = DAL_AutoMobileDevice.get_all().filter( id=automobiledeviceid) except Exception as ex: SimpleLogger.error(ex.message) return automobiledevice
def copy_automobiledevice(request): message = "successful" try: from_automobiledevice = DAL_AutoMobileDevice.get_automobiledevice( request.POST["automobiledeviceid"]) to_automobiledevice = AutoMobileDevice() to_automobiledevice.AName = from_automobiledevice.AName to_automobiledevice.AOS = from_automobiledevice.AOS to_automobiledevice.AIP = from_automobiledevice.AIP to_automobiledevice.AStatus = 1 to_automobiledevice.AAgentBrowser = from_automobiledevice.AAgentBrowser to_automobiledevice.AIsReserved = from_automobiledevice.AIsReserved DAL_AutoMobileDevice.add_automobiledevice(to_automobiledevice) except Exception as ex: message = str(ex) SimpleLogger.error(message) return message
def search_automobiledevice(searchkeyword): if searchkeyword == "ALL": result = DAL_AutoMobileDevice.get_all().filter(MDIsActive=1) else: result = AutoMobileDeviceService.search_automobiledevice_byid( searchkeyword) if result == None or len(result) == 0: result = AutoMobileDeviceService.search_automobiledevice_byname( searchkeyword.strip()) return result.order_by("-id")
def get_autotestconfig_osversion(autotestconfigid, osid): osname = DAL_DictValue.get_dataname_by_datavalue( "AutoTaskRuntime", osid).DicDataName if osname == "Android": mobiledevice = DAL_AutoMobileDevice.get_device_byos("android") else: mobiledevice = DAL_AutoMobileDevice.get_device_byos("ios") result = list() for device in mobiledevice: temp = dict() temp["text"] = device.MDOSVersion temp["value"] = device.MDOSVersion if autotestconfigid != 0: autotestconfig = DAL_AutoTestConfig.get_autotest_config( autotestconfigid) if device.MDOSVersion == autotestconfig.TCFOSVersion: temp["selected"] = 1 else: temp["selected"] = 0 else: temp["selected"] = 0 result.append(temp) return str(result).replace("u'", "'")
def get_automobiledevice_types(automobiledeviceid): tasktypes = DAL_DictValue.getdatavaluebytype("AutoTaskType") result = list() for tasktype in tasktypes: temp = dict() temp["text"] = tasktype.DicDataName temp["memberid"] = tasktype.DicDataValue if automobiledeviceid != 0: automobiledevice = DAL_AutoMobileDevice.get_automobiledevice( automobiledeviceid) if tasktype.DicDataValue == automobiledevice.TaskTpye: temp["selected"] = 1 else: temp["selected"] = 0 else: temp["selected"] = 0 result.append(temp) return str(result).replace("u'", "'")
def get_automobiledevice_os(automobiledeviceid): all_os = DAL_DictValue.getdatavaluebytype("AgentOSType") result = list() if automobiledeviceid != 0: automobiledevice = DAL_AutoMobileDevice.get_automobiledevice( automobiledeviceid) for os in all_os: temp = dict() temp["text"] = os.DicDataName temp["memberid"] = os.DicDataValue if automobiledeviceid != 0: if os.DicDataValue == automobiledevice.AOS: temp["selected"] = 1 else: temp["selected"] = 0 else: temp["selected"] = 0 result.append(temp) return str(result).replace("u'", "'")
def get_automobiledevice_browsers(automobiledeviceid): all_browsers = DAL_DictValue.getdatavaluebytype( "AutoTaskRuntime").filter(DicDataDesc='WEB') result = list() if automobiledeviceid != 0: automobiledevice = DAL_AutoMobileDevice.get_automobiledevice( automobiledeviceid) for browser in all_browsers: temp = dict() temp["text"] = browser.DicDataName temp["memberid"] = browser.DicDataValue if automobiledeviceid != 0: if browser.DicDataValue in eval( automobiledevice.AAgentBrowser): temp["selected"] = 1 else: temp["selected"] = 0 else: temp["selected"] = 0 result.append(temp) return str(result).replace("u'", "'")
def get_automobiledevice_namelist(): automobiledevicelist = DAL_AutoMobileDevice.get_all() return str([item.TaskName for item in automobiledevicelist]).replace("u'", "'")