예제 #1
0
        public int ExistsOfStudent(string IDStudent)
        {
            // tạo ra biến ghi nhận lỗi
            string strError = "";

            try
            {
                Student student = new Student();
                strError     = "Text not number";
                student.MaHS = int.Parse(IDStudent);
                strError     = "value not true";
                return(studentDAO.ExistsOfStudent(student));
            }
            catch (Exception ex)
            {
                switch (strError)
                {
                case "Text not number":
                {
                    MessageBox.Show("Chương trình không nhận rỗng hoặc kí tự chữ", "WARNING ExistsOfStudent");

                    break;
                }

                case "value not true":
                {
                    MessageBox.Show("Học sinh không tồn tại", "WARNING ExistsOfStudent");

                    break;
                }

                default:
                    break;
                }

                return(0);
            }
        }