/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="cyclicOrderTabViewModel">Cyclic order edit window view model</param>
 /// <param name="cyclicOrderEditWindow">Cyclic order edit window</param>
 /// <param name="cyclicOrder">Cyclic order</param>
 public CyclicOrderEditWindowViewModel(CyclicOrdersTabViewModel cyclicOrderTabViewModel,
     CyclicOrderEditWindow cyclicOrderEditWindow, CyclicOrder cyclicOrder)
     : base(cyclicOrderTabViewModel, cyclicOrderEditWindow, cyclicOrder)
 {
     using (var con = new BaudiDbContext())
     {
         BuildingsList = con.Buildings.ToList();
         CompaniesList = con.Companies.ToList();
         MenagersList = con.Menagers.ToList();
         if (Update)
         {
             CyclicOrder = con.CyclicOrders.Find(cyclicOrder.ExpenseTargetID);
             SelectedBuilding = CyclicOrder.Building;
             SelectedCompany = CyclicOrder.Company;
             SelectedMenager = CyclicOrder.Menager;
         }
         else
         {
             CyclicOrder = new CyclicOrder();
             CyclicOrder.LastRealizationDate = DateTime.Now;
         }
     }
 }
Beispiel #2
0
        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="cyclicOrderTabViewModel">Cyclic order tab view model</param>
 /// <param name="cyclicOrder">Cyclic order</param>
 public CyclicOrderEditWindow(CyclicOrdersTabViewModel cyclicOrderTabViewModel, CyclicOrder cyclicOrder)
 {
     InitializeComponent();
     DataContext = new CyclicOrderEditWindowViewModel(cyclicOrderTabViewModel, this, cyclicOrder);
 }