예제 #1
0
        private bool checkError()
        {
            bool add = true;

            //Note : lỗi trùng ID , dùng database

            if (this.txbProjectName.Text.Trim() == "" || this.txbProjectName.Text == "Nhập tên đề tài")
            {
                listError[0].SetError(this.txbProjectName, " Phải nhập nội dung ");
                add = false;
            }

            // kiểm tra listStudent
            if (this.listboxResultStudent.Items.Count == 0)
            {
                listError[1].SetError(this.txbStudents, "Chưa nhập danh sách sinh viên ");
                add = false;
            }

            // kiểm tra listInstructor
            if (this.listboxResultInstructor.Items.Count == 0)
            {
                listError[2].SetError(this.txbInstructors, " Chưa nhập danh sách GVHD ");
                add = false;
            }

            if (this.cbSubject.Text == "Chọn môn")
            {
                listError[3].SetError(this.cbSubject, " Phải chọn nội dung ");
                add = false;
            }
            if (this.txbID.Text.Trim() == "" || this.txbID.Text == "Nhập mã đề tài")
            {
                listError[4].SetError(this.txbID, "Phải nhập nội dung");
                add = false;
            }

            // Thiếu error cho MGV
            if (this.txbID.Text.Trim() == "" || this.txbID.Text == "Nhập mã đề tài")
            {
                this.listError[5].SetError(this.txbID, "Chưa nhập mã đề tài");
                add = false;
            }

            else if (ProjectController.CheckID(sID, this.txbID.Text, edit) == true)
            {
                this.listError[5].SetError(this.txbID, "Mã đề tài đã tồn tại");
                add = false;
            }
            if (this.cbCourse.SelectedIndex == 0)
            {
                this.listError[6].SetError(this.txbID, "Chưa chọn niên khóa");
                add = false;
            }
            return(add);
        }