private void login(object sender, RoutedEventArgs e)
        {
            using (MmsContext context = new MmsContext())
            {
                if (String.IsNullOrEmpty(tbUserName.Text.Trim()))
                {
                    MessageBox.Show("请输入员工号!");
                }

                if (String.IsNullOrEmpty(pbPwd.Password))
                {
                    MessageBox.Show("请输入登录密码!");
                }

                user userLogin = context.user.Where(u => u.emplyee_id == tbUserName.Text.Trim().ToString() &&
                                                    u.user_pwd == pbPwd.Password.Trim().ToString())
                                 .FirstOrDefault();
                if (userLogin != null)
                {
                    Account.Instance.Login(userLogin);
                    loginCallback.Login(userLogin);
                    Close();
                }
                else
                {
                    // 登录失败,清空密码栏
                    pbPwd.Password = "";
                    MessageBox.Show("员工号码或密码错,请重新登录!");
                }
            }
        }
 // 点击领料。检查登录状态。
 private void GetMaterials(object sender, RoutedEventArgs e)
 {
     using (MmsContext context = new MmsContext())
     {
         if (!Account.Instance.IsLogin())
         {
             LoginCallback callback = new LoginCallback();
             callback.LoginEvent += LoginResult;
             LoginWindow loginWindow = new LoginWindow(callback);
             loginWindow.Show();
         }
         else
         {
             GetWindow getWindow = new GetWindow();
             getWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
             getWindow.Show();
         }
     }
 }