Esempio n. 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!editable)
     {
         editable                = true;
         panel1.Enabled          = true;
         textBox5.Enabled        = false;
         textBox10.Enabled       = false;
         textBox11.Enabled       = false;
         dateTimePicker1.Enabled = false;
         this.Text               = this.Text + "[修改信息]";
         button1.Text            = "完成修改";
     }
     else
     {
         editable       = false;
         panel1.Enabled = false;
         this.Text      = "读者详细信息";
         button1.Text   = "修改用户信息";
         Reader rd;
         {
             rd            = new Reader();
             rd.rdID       = int.Parse(textBox1.Text);
             rd.rdUsername = textBox5.Text;
             rd.rdName     = textBox3.Text;
             rd.rdSex      = comboBox2.Text;
             rd.rdType     = int.Parse(comboBox1.Text);
             rd.rdDept     = textBox6.Text;
             rd.rdPhone    = textBox7.Text;
             rd.rdEmail    = textBox8.Text;
             rd.rdDateReg  = dateTimePicker1.Value;
             rd.rdStatus   = textBox10.Text;
             //rd.rdHaveBorrowNum = textBox11.Text;
         }
         try {
             int rst = ReaderDAL.UpdateInfo(rd);
             if (rst <= 0)
             {
                 MessageBox.Show("修改信息失败!");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("修改信息失败!");
         }
     }
 }