private void btn_enter_Click(object sender, RoutedEventArgs e) { User currentUser = UserContract.GetUsers().FirstOrDefault(x => x.Login.Trim().ToLower() == tb_login.Text.Trim().ToLower()); if (currentUser == null) { MessageBox.Show("Неверный логин"); return; } if (CryptoHelper.VerifyMd5Hash(pass.Password, currentUser.Password)) { GlobalSettings.CurrentUser = currentUser; new MainWindow().Show(); this.Close(); } else { MessageBox.Show("Неверный пароль"); return; } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { userContract = ChannelFactory <IUserContract> .CreateChannel(new NetTcpBinding() { MaxBufferSize = 64000000, MaxReceivedMessageSize = 64000000 }, new EndpointAddress("net.tcp://localhost:9000/IUserContract")); UserList = userContract.GetUsers().ToList(); tree.ItemsSource = new List <User>() { UserList.FirstOrDefault(x => x.IsBoss) }; //Построить дерево foreach (User user in UserList) { if (user.Manager != null) { User manager = UserList.FirstOrDefault(x => x.ID == user.ManagerID); manager.AddChildUser(user); user.Manager = manager; } } }
private void RefreshData() { userCollection = new ObservableCollection <User>(userContract.GetUsers()); list_user.ItemsSource = userCollection; }