public Contractor(Enums.WindowType windowType, [Optional] int contractorId) { InitializeComponent(); if (windowType == Enums.WindowType.Show || windowType == Enums.WindowType.Edit) { contractorController = new ContractorController(windowType, contractorId); } else { contractorController = new ContractorController(windowType); } DataContext = contractorController; if (windowType == Enums.WindowType.Show) { buttonSave.Visibility = Visibility.Hidden; textBoxCompanyName.IsEnabled = false; textBoxNip.IsEnabled = false; textBoxOthersInfo.IsEnabled = false; DatePickerDateOfAppointment.IsEnabled = false; DatePickerDateOfContract.IsEnabled = false; textBoxTelNumber.IsEnabled = false; textBoxVoivodeship.IsEnabled = false; textBoxTariff.IsEnabled = false; textBoxAdress.IsEnabled = false; DatePickerContact.IsEnabled = false; DatePickerLaunchDate.IsEnabled = false; } }
public User(Enums.WindowType windowType) { InitializeComponent(); userController = new UserController(windowType); DataContext = userController; }
public ContractorController(Enums.WindowType windowType, [Optional] int contractorId) { this.windowType = windowType; contractorService = new ContractorService(); if (windowType == Enums.WindowType.Create) { Contractor.DateOfAppointment = DateTime.Now; Contractor.DateOfContract = DateTime.Now; Contractor.Contact = DateTime.Now; Contractor.LaunchDate = DateTime.Now; } else if (windowType == Enums.WindowType.Edit || windowType == Enums.WindowType.Show) { Contractor = contractorService.GetContractor(contractorId).Result; } }
public UserController([Optional] Enums.WindowType windowType) { this.windowType = windowType; userService = new UserService(); }