Exemplo n.º 1
0
        public HistoryPresenter(Db db)
        {
            this.db = db;

            nullAccount = new Account();
            nullAccount.Name = "";
        }
Exemplo n.º 2
0
        public void ShowAccount(Account account)
        {
            if (accountView == null)
                accountView = IoCContainer.Instance.Resolve<IAccountView>();

            accountView.Presenter.Account = account;
            accountView.Show();
        }
Exemplo n.º 3
0
        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 */
        }
Exemplo n.º 4
0
Arquivo: Db.cs Projeto: qwer/budget
        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);
        }
Exemplo n.º 5
0
 /// <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;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the AccountSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAccountSet(Account account)
 {
     base.AddObject("AccountSet", account);
 }
Exemplo n.º 7
0
 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];
 }