public Flat( int number, double area, int floor=1, int countRoom=1, int peopleLiving=0, int peopleRegister=0, Owner owner = null, Account account = null, Tentant tentant = null, Payment payment = null, Counter counter = null, int debt=0) { this.Number = number; this.Area = area; this.Floor = floor; this.CountRoom = countRoom; this.PeopleLiving = peopleLiving; this.PeopleRegister = peopleRegister; this.Owner = owner; this.Debt = debt; if (account != null) { this.Accounts.Add(account); } if (tentant != null) this.Tentants.Add(tentant); if (payment != null) this.Payments.Add(payment); if (counter != null) this.Counters.Add(counter); }
private void BtnCalc_OnClick(object sender, RoutedEventArgs e) { foreach (Flat flat in flatView.SelectedItems) { var account = new Account(06,2013,DateTime.Now); foreach (Service service in serviceView.SelectedItems) { account.Add(new ProvidedService(service)); } account.Calculation(flat); flat.Add(account); } TsContext.SaveChanges(); this.Close(); }
public void Add(Account account) { if (account == null) return; account.Calculation(this); this.Accounts.Add(account); }