protected async override void OnAppearing() { if (await helper.UpdateSQLiteDbWithPayAndDelTypes()) { try { paymentTypes = await _connection.Table <PaymentTypeModel>().ToListAsync(); deliveryTypes = await _connection.Table <DeliveryTypeModel>().ToListAsync(); PaymentTypeModel p = paymentTypes.Where(d => d.PaymentTypeID == delivery.PaymentTypeID).FirstOrDefault(); if (p != null) { PaymentType.Text = p.PaymentTypeName; } DeliveryTypeModel D = deliveryTypes.Where(d => d.DeliveryTypeID == delivery.DeliveryTypeID).FirstOrDefault(); if (D != null) { DeliveryType.Text = D.DeliveryTypeName; } if (delivery.DeliveryStatus == 4) { directionsBtn.IsVisible = false; } } catch (Exception ex) { await DisplayAlert("error", ex.Message + ">||<" + ex.InnerException, "ok"); } } else { throw new Exception("No internet or bad request to server"); } base.OnAppearing(); }
protected async override void OnAppearing() { try { paymentTypes = await _connection.Table <PaymentTypeModel>().ToListAsync(); deliveryTypes = await _connection.Table <DeliveryTypeModel>().ToListAsync(); PaymentTypeModel p = paymentTypes.Where(d => d.PaymentTypeID == delivery.PaymentTypeID).FirstOrDefault(); if (p != null) { PaymentType.Text = p.PaymentTypeName; } DeliveryTypeModel D = deliveryTypes.Where(d => d.DeliveryTypeID == delivery.DeliveryTypeID).FirstOrDefault(); if (D != null) { DeliveryType.Text = D.DeliveryTypeName; } } catch (Exception ex) { await DisplayAlert("error", ex.Message + ">||<" + ex.InnerException, "ok"); } base.OnAppearing(); }
public static RecordModel FromRecord(Record record) { return(new RecordModel { Id = record.Id, Note = record.Note, Account = AccountModel.FromAccount(record.Account), RecordType = record.RecordType, PaymentType = PaymentTypeModel.FromPaymentType(record.PaymentType), Category = CategoryModel.FromCategory(record.Category), DateAdded = record.DateAdded, Amount = record.Amount, }); }