예제 #1
0
        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;
            }
        }
예제 #2
0
        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;
                }
            }
        }
예제 #3
0
 private void RefreshData()
 {
     userCollection        = new ObservableCollection <User>(userContract.GetUsers());
     list_user.ItemsSource = userCollection;
 }