// 验证是否能够通过
 private void FormMain_Load(object sender, EventArgs e)
 {
     try
     {
         toolStripStatusLabel1.Text = "    欢饮您!" + username;
         if (usertype == "普通用户")
         {
             //toolStripButton4.Visible = false;
             toolStripButton5.Visible = false;
             //toolStripLabel5.Visible = false;
             toolStripLabel4.Visible = false;
         }
         DataSet ds = ClassDB.getDataSet("select * from 用户表");
         // 没有用户  用户密码错误 用户次数小于1
         if (ds.Tables[0].Rows.Count < 1 || ClassDB.Decrypt(ds.Tables[0].Rows[0]["用户密码"].ToString()) != "55555" || long.Parse(ClassDB.Decrypt(ds.Tables[0].Rows[0]["次数期限"].ToString())) < 1)
         {
             // 验证不通过
             FormPassowrd pass = new FormPassowrd();  // 锁定
             pass.ShowDialog();
         }
         else
         {
             string sql = "update 用户表 set 次数期限='" + ClassDB.Encrypt((long.Parse(ClassDB.Decrypt(ds.Tables[0].Rows[0]["次数期限"].ToString())) - 1).ToString()) + "'";
             ClassDB.ExcuteSql(sql);
         }
     }
     catch
     {
         FormPassowrd pass = new FormPassowrd();  // 锁定
         pass.ShowDialog();
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text.Trim() != "55555")
         {
             MessageBox.Show("密码错误");
             textBox1.Focus();
             textBox1.SelectAll();
             return;
         }
         if (ClassDB.getDataSet("select * from 用户表").Tables[0].Rows.Count > 0)
         {
             ClassDB.ExcuteSql("update 用户表 set 用户密码='" + ClassDB.Encrypt(textBox1.Text.Trim()) + "',次数期限='" + ClassDB.Encrypt(textBox2.Text.Trim()) + "'");
         }
         else
         {
             ClassDB.ExcuteSql("insert into 用户表(用户密码,次数期限) values('" + ClassDB.Encrypt(textBox1.Text.Trim()) + "','" + ClassDB.Encrypt(textBox2.Text.Trim()) + "')");
         }
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }