コード例 #1
0
ファイル: FrmEditRoom.cs プロジェクト: wrj0823/RMS
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         errorProvider1.SetError(textBox1, "房间名称不允许为空");
         return;
     }
     if (textBox2.Text == "")
     {
         errorProvider1.SetError(textBox2, "容纳人数不允许为空");
         return;
     }
     try
     {
         if (RoomTypeMDL.ui == 1)
         {
             RoomTypeMDL rt = new RoomTypeMDL();
             rt.rtname  = textBox1.Text;
             rt.rtmount = int.Parse(textBox2.Text);
             RoomTypeBLL.insertroom(rt);
             this.Close();
         }
         else
         {
             List <RoomTypeMDL> list = new List <RoomTypeMDL>();
             RoomTypeMDL        rt   = new RoomTypeMDL();
             rt.rtname  = textBox1.Text;
             rt.rtmount = int.Parse(textBox2.Text);
             rt.rtid    = RoomTypeMDL.tid;
             RoomTypeBLL.updateroom(rt);
             this.Close();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("发生未只的异常,请联系开发者", "未知异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }