public HistoryPresenter(Db db) { this.db = db; nullAccount = new Account(); nullAccount.Name = ""; }
public void ShowAccount(Account account) { if (accountView == null) accountView = IoCContainer.Instance.Resolve<IAccountView>(); accountView.Presenter.Account = account; accountView.Show(); }
private void AddAccount(Account a) { ListViewItem i = new ListViewItem(a.Name, GetGroup(a)); i.SubItems.AddRange(new string[] { a.Balance.ToString(), a.Type == 2 ? a.Target.ToString() : "" }); i.Tag = a; listView1.Items.Add(i); accountsToItems[a] = i; a.PropertyChanged += Account_PropertyChanged; /* XXX ref */ }
public void AddAccount(Account account) { bool added = account.EntityState == EntityState.Added; if (added) Container.AccountSet.AddObject(account); try { Container.SaveChanges(); } catch (Exception e) { Error.Show(e); if (added) Container.Detach(account); return; } if (added && AccountAdded != null) AccountAdded(account, null); }
/// <summary> /// Create a new Account object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="balance">Initial value of the Balance property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="type">Initial value of the Type property.</param> public static Account CreateAccount(global::System.Int32 id, global::System.Decimal balance, global::System.String name, global::System.Int32 type) { Account account = new Account(); account.Id = id; account.Balance = balance; account.Name = name; account.Type = type; return account; }
/// <summary> /// Deprecated Method for adding a new object to the AccountSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAccountSet(Account account) { base.AddObject("AccountSet", account); }
private ListViewGroup GetGroup(Account a) { int groupIndex; switch (a.AccountType) { default: case AccountType.Regular: groupIndex = 1; break; case AccountType.Reserve: groupIndex = 2; break; case AccountType.Target: groupIndex = 0; break; } return listView1.Groups[groupIndex]; }