public void ShowIncome(Income income) { CreateView(); view.Presenter.Income = income; view.Show(); }
private static void SetItems(Income i, ListViewItem li) { li.SubItems.Clear(); li.SubItems.Add(i.Amount.ToString()); li.SubItems.Add(i.Period2.Format); li.SubItems.Add(i.Account.Name); li.Text = i.Name; }
private void AddIncome(Income i) { ListViewItem li = new ListViewItem(); SetItems(i, li); li.Tag = i; listView1.Items.Add(li); items[i] = li; i.PropertyChanged += new PropertyChangedEventHandler(Income_PropertyChanged); }
public void Start(DateTime now) { nextEvent = DateTime.MaxValue; foreach (Income i in db.Container.IncomeSet) { if ((nextEvents[i] = i.Period2.GetNearestEvent(now)) < nextEvent) { nextEvent = nextEvents[i]; nextEventIncome = i; } } //System.Windows.Forms.MessageBox.Show(nextEvent.ToString()); SetupTimer(); }
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (DateTime.Now < nextEvent) { SetupTimer(); return; } db.CreateIncomeTx(nextEventIncome, nextEvent); nextEvents[nextEventIncome] = nextEventIncome.Period2.GetNearestEvent(nextEvent); nextEvent = DateTime.MaxValue; foreach (Income i in nextEvents.Keys) if (nextEvents[i] < nextEvent) { nextEvent = nextEvents[i]; nextEventIncome = i; } SetupTimer(); }
public void CreateIncome() { CreateView(); Account a = null; try { a = view.Presenter.Accounts.First(); } catch (Exception e) { Error.Show(e); return; } Income i = new Income(); i.Account = a; i.StartDate = DateTime.Now; i.EndDate = DateTime.Now.AddYears(1); i.Period = ""; i.Name = ""; ShowIncome(i); }
private void UpdateNextEvent(Income income) { nextEvents[income] = income.Period2.GetNearestEvent(DateTime.Now); if (nextEvents[income] >= nextEvent) return; nextEvent = nextEvents[income]; nextEventIncome = income; timer.Stop(); SetupTimer(); }
public void OnIncomeChanged(Income income) { UpdateNextEvent(income); }
public void OnIcomeAdded(Income income) { UpdateNextEvent(income); }
public void CreateIncomeTx(Income income, DateTime datetime) { History h = new History(); h.AccountDest = income.Account; h.AccountSrc = null; h.Amount = income.Amount; h.Date = datetime; h.Description = ""; h.Income = income; AddHistory(h); }
public void AddIncome(Income income) { bool added = income.EntityState == EntityState.Added; if (added) Container.IncomeSet.AddObject(income); try { Container.SaveChanges(); } catch (Exception e) { Error.Show(e); if (added) Container.Detach(income); return; } if (player != null) { if (added) player.OnIcomeAdded(income); else player.OnIncomeChanged(income); } if (added && IncomeAdded != null) IncomeAdded(income, null); }
/// <summary> /// Create a new Income object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="amount">Initial value of the Amount property.</param> /// <param name="period">Initial value of the Period property.</param> /// <param name="startDate">Initial value of the StartDate property.</param> /// <param name="endDate">Initial value of the EndDate property.</param> /// <param name="name">Initial value of the Name property.</param> public static Income CreateIncome(global::System.Int32 id, global::System.Decimal amount, global::System.String period, global::System.DateTime startDate, global::System.DateTime endDate, global::System.String name) { Income income = new Income(); income.Id = id; income.Amount = amount; income.Period = period; income.StartDate = startDate; income.EndDate = endDate; income.Name = name; return income; }
/// <summary> /// Deprecated Method for adding a new object to the IncomeSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToIncomeSet(Income income) { base.AddObject("IncomeSet", income); }