issue fix
This commit is contained in:
@ -167,18 +167,8 @@ namespace Billing.Views
|
||||
|
||||
private async void OnBillChecked(object sender, Bill e)
|
||||
{
|
||||
if (e.Id < 0)
|
||||
if (e.Id <= 0)
|
||||
{
|
||||
int maxId;
|
||||
if (App.Bills.Count > 0)
|
||||
{
|
||||
maxId = App.Bills.Max(b => b.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
maxId = -1;
|
||||
}
|
||||
e.Id = maxId + 1;
|
||||
App.Bills.Add(e);
|
||||
var bills = Bills;
|
||||
bills.Add(Helper.WrapBill(e));
|
||||
@ -189,7 +179,21 @@ namespace Billing.Views
|
||||
var bill = Bills.FirstOrDefault(b => b.Bill == e);
|
||||
if (bill != null)
|
||||
{
|
||||
UpdateBill(bill);
|
||||
if (bill.DateCreation != e.CreateTime)
|
||||
{
|
||||
var bills = App.Bills.Where(b => Helper.IsSameDay(b.CreateTime, SelectedDate));
|
||||
Bills = new List<UIBill>(bills.OrderBy(b => b.CreateTime).Select(b => Helper.WrapBill(b)));
|
||||
RefreshBalance(Bills);
|
||||
|
||||
RankPage.Instance?.SetNeedRefresh();
|
||||
|
||||
await StoreHelper.SaveBillItemAsync(e);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBill(bill);
|
||||
}
|
||||
}
|
||||
}
|
||||
RefreshBalance(Bills);
|
||||
@ -203,6 +207,7 @@ namespace Billing.Views
|
||||
public class UIBill : BindableObject
|
||||
{
|
||||
public static readonly BindableProperty IconProperty = Helper.Create<string, UIBill>(nameof(Icon));
|
||||
public static readonly BindableProperty TintColorProperty = Helper.Create<Color, UIBill>(nameof(TintColor));
|
||||
public static readonly BindableProperty NameProperty = Helper.Create<string, UIBill>(nameof(Name));
|
||||
public static readonly BindableProperty DateCreationProperty = Helper.Create<DateTime, UIBill>(nameof(DateCreation));
|
||||
public static readonly BindableProperty AmountProperty = Helper.Create<decimal, UIBill>(nameof(Amount));
|
||||
@ -213,6 +218,11 @@ namespace Billing.Views
|
||||
get => (string)GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
public Color TintColor
|
||||
{
|
||||
get => (Color)GetValue(TintColorProperty);
|
||||
set => SetValue(TintColorProperty, value);
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get => (string)GetValue(NameProperty);
|
||||
|
Reference in New Issue
Block a user