/// <summary> /// Constructor /// </summary> /// <param name="companiesTabViewModel">Company tab view Model </param> /// <param name="companyEditWindow"> Company edit window</param> /// <param name="company">Company</param> public CompanyEditWindowViewModel(CompaniesTabViewModel companiesTabViewModel, CompanyEditWindow companyEditWindow, Company company) : base(companiesTabViewModel, companyEditWindow, company) { using (var con = new BaudiDbContext()) { SpecializationList = con.Specializations.ToList(); if (Update) { Company = con.Companies.Find(company.CompanyID); Company.Specializations.ForEach(s => s.IsSelected = true); } else { Company = new Company(); } } }
private void Load() { TabsViewModels = new List<TabViewModel>(); BuildingsTabViewModel = new BuildingsTabViewModel(); CompaniesTabViewModel = new CompaniesTabViewModel(); CyclicOrdersTabViewModel = new CyclicOrdersTabViewModel(); EmployeesTabViewModel = new EmployeesTabViewModel(); ExpensesTabViewModel = new ExpensesTabViewModel(); LocalsTabViewModel = new LocalsTabViewModel(); NotificationsTabViewModel = new NotificationsTabViewModel(); OrdersTabViewModel = new OrdersTabViewModel(); OrderTypesTabViewModel = new OrderTypesTabViewModel(); OwnershipsTabViewModel = new OwnershipsTabViewModel(); PeopleTabViewModel = new PeopleTabViewModel(); OwningCompaniesTabViewModel = new OwningCompaniesTabViewModel(); RentsTabViewModel = new RentsTabViewModel(); ReportsTabViewModel = new ReportsTabViewModel(); SalariesTabViewModel = new SalariesTabViewModel(); SpecializationsTabViewModel = new SpecializationsTabViewModel(); TabsViewModels.Add(BuildingsTabViewModel); TabsViewModels.Add(CompaniesTabViewModel); TabsViewModels.Add(CyclicOrdersTabViewModel); TabsViewModels.Add(EmployeesTabViewModel); TabsViewModels.Add(ExpensesTabViewModel); TabsViewModels.Add(NotificationsTabViewModel); TabsViewModels.Add(LocalsTabViewModel); TabsViewModels.Add(OrdersTabViewModel); TabsViewModels.Add(OrderTypesTabViewModel); TabsViewModels.Add(OwnershipsTabViewModel); TabsViewModels.Add(PeopleTabViewModel); TabsViewModels.Add(OwningCompaniesTabViewModel); TabsViewModels.Add(RentsTabViewModel); TabsViewModels.Add(SalariesTabViewModel); TabsViewModels.Add(SpecializationsTabViewModel); TabsViewModels.ForEach(vm => vm.PropertyChanged += OnMemberViewModelPropertyChanged); }
/// <summary> /// Constructor /// </summary> /// <param name="companiesTabViewModel"> Companies tab view Model</param> /// <param name="company">Company</param> public CompanyEditWindow(CompaniesTabViewModel companiesTabViewModel, Company company) { InitializeComponent(); DataContext = new CompanyEditWindowViewModel(companiesTabViewModel, this, company); }