Пример #1
0
 /// <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;
 }
Пример #2
0
        /// <summary>
        /// Constructor with User Window param
        /// </summary>
        /// <param name="userOpen">opens the user window</param>
        public UserViewModel(UserWindow userOpen)
        {
            userWindow = userOpen;
            UserList   = new ObservableCollection <tblUser>(userData.GetAllUsers().ToList());
            locationData.GetAllLocations().ToList();

            bgWorker.DoWork += WorkerOnDoWorkDelete;
        }
        /// <summary>
        /// Converts the parameter value into the location address, city and country
        /// </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)
        {
            LocationData       locData      = new LocationData();
            List <tblLocation> allLocations = locData.GetAllLocations().ToList();

            for (int i = 0; i < allLocations.Count; i++)
            {
                if (allLocations[i].LocationID == (int)value)
                {
                    string name = allLocations[i].LocationAddress + ", " +
                                  allLocations[i].City + ", " + allLocations[i].Country;
                    return(name);
                }
            }

            return(value);
        }