Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Admin admin = SqlLogin.findAdminById(textBox1.Text.Trim());
            if (admin == null)
            {
                MessageBox.Show("用户名不存在,请重新输入!");
                textBox2.Text = "";
                textBox1.Text = "";
            }
            else if (admin.getPassword().Trim() == textBox2.Text.Trim())
            {
                String loginTime = DateTime.Now.ToLocalTime().ToString();
                ClassUse.Login login = new ClassUse.Login(admin.getID(), loginTime);

                SqlLogin.addLogin(login);

                MessageBox.Show("系统登录成功,正在跳转主页面...");
                Cinema cinemaView = new Cinema();
                cinemaView.Show();

                this.Hide();
            }
            else
            {
                MessageBox.Show("密码错误!请再次输入!");
                textBox2.Text = "";
            }
        }
Beispiel #2
0
 public static void addLogin(Login login)
 {
     String loginsql = "insert  into Login_record values('" + login.getID().Trim() + "','" + login.getTime()+ "')";
     DbHelperSQL.ExecuteSql(loginsql);
 }