/** * Retrieve all users */ public Dictionary <int, User> getAllUser() { // Get all users from the identity map Dictionary <int, User> users = UserIdentityMap.getInstance().findAll(); // Get all users in the database Dictionary <int, Object[]> result = tdgUser.getAll(); // If it's empty, simply return those from the identity map if (result == null) { return(users); } // Loop through each of the result: foreach (KeyValuePair <int, Object[]> record in result) { // The user is not in the identity map. Create an instance, add it to identity map and to the return variable if (!users.ContainsKey(record.Key)) { User user = UserCatalog.getInstance().makeNewUser((int)record.Key, (String)record.Value[1], (String)record.Value[2], (String)record.Value[3]); UserIdentityMap.getInstance().addTo(user); users.Add(user.userID, user); } } return(users); }
void catalogServiceGetUserListCompleted(object sender, UserCatalog.GetUserListCompletedEventArgs e) { if (e.Error == null) { Users.ItemsSource = e.Result; } }
/** * Set user attributes */ public void setUser(int userID, string name) { User user = UserCatalog.getInstance().modifyUser(userID, name); // We've modified something in the object so we Register the instance as Dirty in the UoW. UnitOfWork.getInstance().registerDirty(user); }
public async void Login(object s) { try { UserCatalog UserCatalog = new UserCatalog(); if (UserCatalog != null) { foreach (var user in UserCatalog.Users) { if (user.AdminCpr.Trim() == AdminCpr.Trim() && user.Password.Trim() == Password.Trim()) { Type typeProfile = typeof(NewsView); FrameNavigation.ActivateFrameNavigation(typeProfile); AllowLogin = true; break; } } if (AllowLogin == false) { var dialog = new MessageDialog("Wrong email or password!"); await dialog.ShowAsync(); } } } catch (Exception) { } }
public void Register(object s) { UserCatalog UserCatalog = new UserCatalog(); UserCatalog.GetData(User); UserCatalog.Post(); Type type = typeof(LoginView); FrameNavigation.ActivateFrameNavigation(type); }
private DomainModel() { _contactCatalog = new ContactCatalog(); _customerCatalog = new CustomerCatalog(); _leadCatalog = new LeadCatalog(); _locationCatalog = new LocationCatalog(); _offerCatalog = new OfferCatalog(); _pipelineCatalog = new PipelineCatalog(); _productCatalog = new ProductCatalog(); _userCatalog = new UserCatalog(); }
/** * Initialize the list of users, used for instantiating console * */ public void initializeDirectory() { // Get all users in the database Dictionary <int, Object[]> result = tdgUser.getAll(); //Loop through each of the result: foreach (KeyValuePair <int, Object[]> record in result) { User user = UserCatalog.getInstance().makeNewUser((int)record.Key, (String)record.Value[1], (String)record.Value[2], (String)record.Value[3]); UserIdentityMap.getInstance().addTo(user); } }
//Action /// <summary> /// En metode der opretter en ny bruger /// </summary> public void AddUser() { try { UserCatalog.AddUser(SelectedUser); Save(); ConfirmText2 = "Du er nu oprettet som bruger"; OnPropertyChanged(nameof(ConfirmText2)); } catch (IdExceptions adex) { MessageDialogHelper.Show(adex.Message, "Du har fået en AddExeption"); } catch (EmptyInputException eiex) { MessageDialogHelper.Show(eiex.Message, "Du har fået en EiexException"); } catch (UserNameAlreadyUsedException adex) { MessageDialogHelper.Show(adex.Message, "Du har fået en UserNameException"); } }
/// <summary> /// En metode der fjerner en bruger /// </summary> public void RemoveUser() { UserCatalog.RemoveAt(SelectedIndex); Save(); }
public List <User> getListOfUsers() { return(UserCatalog.getInstance().registeredUsers); }