private void Check_Passowrd()
        {
            String UsernameStr = UsernameTextBox.Text.ToString();
            String PasswordStr = Password_Box.Password.ToString();

            db = new ERP_DBEntities();
            var LoginQuery = from d in db.user where d.Username == UsernameStr select d.Password;
            //Find password in db
            Boolean IsLoginSuccess = false;
            foreach (String StrInQuery in LoginQuery.ToList())
            {
                if (StrInQuery == PasswordStr)
                {
                    IsLoginSuccess = true;
                    break;
                }
            }
            if (IsLoginSuccess)
            {
                ChoseFuncWindow choseFuncWindow = new ChoseFuncWindow();
                choseFuncWindow.Show();
            }
            else
            {
                MessageBox.Show("用户名和密码错误,请检查。", "登录失败!");
            }
        }
Exemplo n.º 2
0
        private void Check_Passowrd()
        {
            String UsernameStr = UsernameTextBox.Text.ToString();
            String PasswordStr = Password_Box.Password.ToString();

            db = new ERP_DBEntities();
            var LoginQuery = from d in db.user where d.Username == UsernameStr select d.Password;
            //Find password in db
            Boolean IsLoginSuccess = false;
            foreach (String StrInQuery in LoginQuery.ToList())
            {
                if (StrInQuery == PasswordStr)
                {
                    IsLoginSuccess = true;
                    break;
                }
            }
            if (IsLoginSuccess)
            {
                ChoseFuncWindow choseFuncWindow = new ChoseFuncWindow();
                choseFuncWindow.Show();
            }
            else
            {
                MessageBox.Show("用户名和密码错误,请检查。", "登录失败!");
            }
        }