function method
Implementation
Future<bool> function(
{required String action,
//String guid,
String? userid,
String? pwd,
String? comment}) async {
bool r = false;
//String curguid = _guid;
if (_code != '') {
//if (guid != null && guid != '') curguid = guid;
var url = Oph.curPreset.serverURL! +
Oph.curPreset.rootAccountId! +
'/' +
Oph.curPreset.apiURL! +
'?suba=' +
Oph.curPreset.accountId! +
'&mode=function&code=' +
_code!;
Map<String, String> body = {
'hostguid': Oph.curPreset.hostguid!,
'cfunctionlist': _frm!.guid,
'cfunction': action,
'comment': comment != null ? comment : '',
'approvaluserguid': userid != null ? userid : '',
'pwd': pwd != null ? pwd : ''
};
String value = await httpSvc.getXML(url, body: body);
if (value != '') {
XmlDocument xmlDoc = XmlDocument.parse(value);
List<String> l1 =
xmlDoc.findAllElements("guid").map((node) => node.text).toList();
List<String> l2 =
xmlDoc.findAllElements("message").map((node) => node.text).toList();
// List<String> l3 =
// xmlDoc.findAllElements("unique").map((node) => node.text).toList();
r = true;
if ((l1.length > 0 && l1[0].length > 0) || l2.length == 0) {
//if (guid == null || guid == '') {
//_frm!.guid = l1[0];
//}
r = true;
// if (l3.length > 0 && l3[0].length > 0) {
// unique = l3[0];
// }
} else if (l2.length > 0 && l2[0].length > 0) {
_msg = l2[0];
print(_msg);
}
}
}
return r;
}