public AnnualEmployeeViaProduct() { //FÖR TESTNING SÅ SKICKAS DEPARTMENTID MED SOM UF InitializeComponent(); DataContext = this; Logic_Layer.Cost_Budgeting_Logic.ExpenseBudgetManagement.Instance.DoesExpenseBudgetExist(); MyList = new ObservableCollection <DataItemProduct>(); ProductPlacementList = new ObservableCollection <ProductPlacement>(); SelectedProducts = new ObservableCollection <Product>(); //EmployeeList = new ObservableCollection<Employee>(); Logic_Layer.Cost_Budgeting_Logic.ExpenseBudgetManagement.Instance.DoesExpenseBudgetExist(); Logic_Layer.UserAccount userAccount = null; userAccount = UserManagement.Instance.GetUserAccountByUsername(System.Threading.Thread.CurrentPrincipal.Identity.Name); switch (userAccount.PermissionLevel) { //Drift Chef case 4: DepartmentID = "DA"; cbDepartments.Visibility = Visibility.Collapsed; lblChooseDepartment.Visibility = Visibility.Collapsed; LoadEmployees(); break; //Utveckling Chef case 7: DepartmentID = "UF"; cbDepartments.Visibility = Visibility.Collapsed; lblChooseDepartment.Visibility = Visibility.Collapsed; LoadEmployees(); break; //System Admin case 5: DepartmentID = "DA"; break; //Ekonomichef case 1: DepartmentID = "DA"; btnLock.Visibility = Visibility.Collapsed; btnSave.Visibility = Visibility.Collapsed; dgProductPlacements.IsReadOnly = true; btnChooseProduct.IsEnabled = false; break; } LockedSettings(); }
/// <summary> /// Standard constructor /// </summary> public DirectCostsPerActivityDepartment() { InitializeComponent(); DataContext = this; Logic_Layer.Cost_Budgeting_Logic.ExpenseBudgetManagement.Instance.DoesExpenseBudgetExist(); Logic_Layer.Cost_Budgeting_Logic.ExpenseBudgetManagement.Instance.DoesExpenseBudgetExist(); Logic_Layer.UserAccount userAccount = null; userAccount = UserManagement.Instance.GetUserAccountByUsername(System.Threading.Thread.CurrentPrincipal.Identity.Name); switch (userAccount.PermissionLevel) { //Administrativ Chef case 0: DepartmentID = "AO"; cbDepartments.Visibility = Visibility.Collapsed; lblChooseDepartment.Visibility = Visibility.Collapsed; break; //Försäljning Chef case 2: DepartmentID = "FO"; cbDepartments.Visibility = Visibility.Collapsed; lblChooseDepartment.Visibility = Visibility.Collapsed; break; //System Admin case 5: DepartmentID = "AO"; break; //Ekonomichef case 1: DepartmentID = "AO"; btnLock.Visibility = Visibility.Collapsed; btnAddActivity.Visibility = Visibility.Collapsed; dgDCPAD.IsReadOnly = true; break; } LockedSettings(); }