add: last used category
This commit is contained in:
parent
9a8f1289ed
commit
77b4e54734
@ -1,5 +1,6 @@
|
||||
using SQLite;
|
||||
|
||||
using System;
|
||||
|
||||
namespace Billing.Models
|
||||
{
|
||||
public class Category : IIdItem
|
||||
@ -14,6 +15,8 @@ namespace Billing.Models
|
||||
public string Name { get; set; }
|
||||
public long TintColor { get; set; } = TRANSPARENT_COLOR;
|
||||
public int? ParentId { get; set; }
|
||||
public DateTime? LastUsed { get; set; }
|
||||
public int? LastAccountId { get; set; }
|
||||
}
|
||||
|
||||
public enum CategoryType
|
||||
|
@ -170,6 +170,9 @@ namespace Billing.Views
|
||||
Store = Store,
|
||||
Note = Note
|
||||
});
|
||||
|
||||
category.LastAccountId = walletId;
|
||||
category.LastUsed = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,6 +193,14 @@ namespace Billing.Views
|
||||
private void CategorySelectPage_Tapped(object sender, UICategory e)
|
||||
{
|
||||
categoryId = e.Category.Id;
|
||||
if (e.Category.LastAccountId != null)
|
||||
{
|
||||
var wallet = App.Accounts.FirstOrDefault(a => a.Id == e.Category.LastAccountId.Value);
|
||||
if (wallet != null)
|
||||
{
|
||||
SetValue(WalletNameProperty, wallet.Name);
|
||||
}
|
||||
}
|
||||
SetValue(CategoryNameProperty, e.Name);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user