/// <summary> /// Constructor with edit user window opening /// </summary> /// <param name="addUserOpen">opens the add user window</param> /// <param name="userEdit">gets the user info that is being edited</param> public AddUserViewModel(AddUserWindow addUserOpen, tblUser userEdit) { user = userEdit; sector = new tblSector(); addUserWindow = addUserOpen; LocationList = locationData.GetAllLocations().ToList(); SectorList = sectorData.GetAllSectors().ToList(); ManagerList = userData.GetAllManagers(User.UserID).ToList(); LocationIDList = locationData.GetAllLocationIDs().ToList(); bgWorker.DoWork += WorkerOnDoWorkUpdate; }
/// <summary> /// Converts the parameter value into the sector name /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="parameter"></param> /// <param name="culture"></param> /// <returns></returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { SectorData sectorData = new SectorData(); List <tblSector> allSectors = sectorData.GetAllSectors().ToList(); for (int i = 0; i < allSectors.Count; i++) { if (allSectors[i].SectorID == (int)value) { return(allSectors[i].SectorName); } } return(value); }