protected virtual void Save() { var transaction = new Transaction { Comment = Comment, Date = DateTime, Name = Name, Value = Amount }; var success = DebtsManager.AddDebt(new Debt { Name = Name, ToMe = InterfaceUpdateManager.IsTabToMe, Transactions = new List <Transaction> { transaction } }); if (!success) { ShowAlert(); return; } NavigationService.GoBack(); }
void Merge() { var transaction = new Transaction { Comment = Comment, Date = DateTime, Value = Amount, Name = Name }; var success = DebtsManager.MergeDebt(new Debt { Name = Name, ToMe = InterfaceUpdateManager.IsTabToMe, Transactions = new List <Transaction> { transaction } }); if (!success) { ShowMergeFailedAlert(); return; } NavigationService.GoBack(); }
public void UpdateInfo(string name) { var newDebt = DebtsManager.GetDebt(name); if (newDebt != null) { Debt = newDebt; TotalText = GetTotalText(Debt); } }
protected override void Save() { var transaction = new Transaction { Comment = Comment, Date = DateTime, Name = Name, Value = Positive ? Amount : -Amount }; var success = DebtsManager.AddTransaction(transaction); if (!success) { ShowAlert(); return; } NavigationService.GoBack(); InterfaceUpdateManager.InvokeUpdateMainScreen(); }
internal bool ChangeName(string text) { if (Debt.Name == text) { return(true); } //check if the name already exists if (DebtsManager.GetDebt(text) != null) { return(false); } //rename var oldName = Debt.Name; Debt.Name = text; //save changes DebtsManager.RenameDebt(oldName, Debt.Name); InterfaceUpdateManager.InvokeUpdateMainScreen(); return(true); }
public void Dispose() { DebtsManager.RemoveTransaction(this); InterfaceUpdateManager.InvokeItemRemoved(); }
public List <Debt> GetItems(bool myDebts) { _debts = DebtsManager.ReadDebts().Select(item => item.Value).ToList(); return(_debts.Where(item => item.ToMe == !myDebts).ToList()); }