private async Task LoadData(int userID) { IsRefreshing = true; var list = await AppendixHttpClient.GetAppendices(Preferences.Get("CompanyID", 1234), userID); Appendices = new ObservableCollection <Appendix>(list); IsRefreshing = false; return; }
private async Task GetAccounts() { List <Account> accountsFromAPI = await AppendixHttpClient.GetAccounts(Preferences.Get("CompanyID", 1234)); List <string> accountNames = new List <string>(); foreach (Account accountFromAPI in accountsFromAPI) { accountNames.Add($"{accountFromAPI.AccountNo} {accountFromAPI.Name}"); } Accounts = new ObservableCollection <string>(accountNames); }
private async Task ExecuteSaveImageCommand() { Preferences.Set("UserID", GetAccountNumberFromName(Account)); Models.Appendix appendix = new Models.Appendix() { CompanyID = Preferences.Get("CompanyID", 1234), AccountNo = Preferences.Get("UserID", 123), Text = Note, UserID = UserID, ImageFileName = Path.GetFileName(FileName), Date = string.Format("{0:0000}-{1:00}-{2:00}", AppendixDate.Year, AppendixDate.Month, AppendixDate.Day) }; byte[] bytes = null; try { bytes = File.ReadAllBytes(FileName); } catch { } if (bytes != null) { appendix.ImageData = Convert.ToBase64String(bytes); StatusResponse response = await AppendixHttpClient.SendAppendixAsync(appendix); if (response.Status > 0) { await DialogService.Show("Success", "Appendix saved OK", "Close"); } else { await DialogService.Show("Error", response.Message, "Close"); } } }