Beispiel #1
0
 private void CheckValid()
 {
     //所有文本框
     TextBox[] textBoxes =
     {
         txtBox_Age,  txtBox_Folk,
         txtBox_Name, txtBox_Phone, txtBox_WorkTime
     };
     foreach (TextBox tb in textBoxes)
     {
         if (tb.Text == "" || combox_addjob.Text == "")
         {
             throw new Exception("请填写完整信息!");
         }
     }
     //只能输入数字的文本框
     TextBox[] textBoxes_Num =
     {
         txtBox_Age, txtBox_Phone, txtBox_WorkTime
     };
     foreach (TextBox tb in textBoxes_Num)
     {
         if (!ManagerWindow.isInteger(tb.Text))
         {
             throw new Exception("检测到非法输入,请输入数字");
         }
     }
 }
Beispiel #2
0
 private void CheckValid()
 {
     //所有文本框
     TextBox[] textBoxes =
     {
         txtBoxModifyId, txtBoxModifyPre_sal, txtBoxModifyCurrent_sal
     };
     foreach (TextBox tb in textBoxes)
     {
         if (tb.Text == "")
         {
             throw new Exception("信息填写不能为空");
         }
     }
     //只能输入数字的文本框
     TextBox[] textBoxes_Num =
     {
         txtBoxModifyId, txtBoxModifyPre_sal, txtBoxModifyCurrent_sal
     };
     foreach (TextBox tb in textBoxes_Num)
     {
         if (!ManagerWindow.isInteger(tb.Text))
         {
             throw new Exception("检测到非法输入,请输入数字");
         }
     }
 }
Beispiel #3
0
 //检测输入的合法性
 private void CheckValid()
 {
     //所有文本框
     TextBox[] textBoxes =
     {
         txtBoxAge,  txtBoxFolk,  txtBoxJob,
         txtBoxName, txtBoxPhone, txtBoxWorkTime
     };
     foreach (TextBox tb in textBoxes)
     {
         if (tb.Text == "")
         {
             throw new Exception("信息填写不能为空");
         }
     }
     //只能输入数字的文本框
     TextBox[] textBoxes_Num =
     {
         txtBoxAge, txtBoxPhone, txtBoxWorkTime
     };
     foreach (TextBox tb in textBoxes_Num)
     {
         if (!ManagerWindow.isInteger(tb.Text))
         {
             throw new Exception("检测到非法输入,请输入数字");
         }
     }
 }
 private void CheckValid()
 {
     //所有文本框
     TextBox[] textBoxes =
     {
         txtBoxNo,  txtBoxRpName,
         txtBoxSal, txtBoxUserId,
     };
     foreach (TextBox tb in textBoxes)
     {
         if (tb.Text == "")
         {
             throw new Exception("请填写完整信息!");
         }
     }
     //只能输入数字的文本框
     TextBox[] textBoxes_Num =
     {
         txtBoxNo, txtBoxUserId
     };
     foreach (TextBox tb in textBoxes_Num)
     {
         if (!ManagerWindow.isInteger(tb.Text))
         {
             throw new Exception("检测到非法输入,请输入数字");
         }
     }
     //奖金罚金可能为负数,特殊处理
     if (txtBoxSal.Text[0] == '-')
     {
         if (!ManagerWindow.isInteger(txtBoxSal.Text.Substring(
                                          1, txtBoxSal.Text.Length - 1)))
         {
             throw new Exception("检测到非法输入,请输入数字");
         }
     }
     else
     {
         if (!ManagerWindow.isInteger(txtBoxSal.Text))
         {
             throw new Exception("检测到非法输入,请输入数字");
         }
     }
 }