public Task <string> CheckLocationCode(string code) { var tcs = new TaskCompletionSource <string>(); string rv = ""; Task.Run(async() => { try { if (!string.IsNullOrEmpty(code)) { string code1 = code.Trim().ToUpper(); int exist = await NAV.GetLocationCount(code1, false, ACD.Default); if (exist > 0) { rv = AppResources.LocationNewPage_CodeAlreadyExist; } } tcs.SetResult(rv); } catch { tcs.SetResult(rv); } }); return(tcs.Task); }
public async Task CheckLocationCode() { if (CreateMode) { CodeWarningText = ""; if (Code != "") { int exist = await NAV.GetLocationCount(Code, false, ACD.Default); if (exist > 0) { CodeWarningText = AppResources.LocationNewPage_CodeAlreadyExist; } } } }