Пример #1
0
        public frmSettings()
        {
            InitializeComponent();
            // bật tắt button
            this.btnAdd.Enabled        = false;
            this.btnAddSubject.Enabled = false;
            ID = this.cbSubject.Items.Count + 1;

            faculty = FacultyController.GetAllFaculty();

            if (faculty.Count != 0)
            {
                foreach (Faculty item in faculty)
                {
                    this.cbFaculty.Items.Add(item.name);
                }
            }

            add = false;


            subject = SubjectController.GetListSubject();
            foreach (Subject item in subject)
            {
                this.cbSubject.Items.Add(item.subject);
                ID++;
            }
            index = 0;
        }
Пример #2
0
        private void cbFaculty_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cbMajor.Items.Clear();
            this.cbMajor.Items.Add("Chọn ngành");

            try
            {
                string faculty = this.cbFaculty.SelectedItem.ToString();
                if (faculty != "Chọn khoa")
                {
                    string[] str = FacultyController.GetListMajor(faculty).Split('\n');
                    foreach (string item in str)
                    {
                        this.cbMajor.Items.Add(item);
                    }
                }
                else
                {
                    foreach (Faculty item in FacultyController.GetAllFaculty())
                    {
                        string[] str = item.listMajor.Split('\n');

                        foreach (string major in str)
                        {
                            this.cbMajor.Items.Add(major);
                        }
                    }
                }
            }
            catch
            {
            }
        }
Пример #3
0
        private void frmQuanLySinhVien_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 11; i++)
            {
                listError.Add(new ErrorProvider());
            }

            faculty = FacultyController.GetAllFaculty();
            foreach (Faculty item in faculty)
            {
                this.cbFaculty.Items.Add(item.name);
                string[] str = item.listMajor.Split('\n');
                foreach (string major in str)
                {
                    this.cbMajor.Items.Add(major);
                }
            }
            if (edit == true)    // chế độ chỉnh sửa
            {
                this.btnAdd.Text      = "Lưu";
                this.txbName.Text     = student.name.ToString();
                this.txbMSSV.Text     = student.MSSV.ToString();
                this.txbAddress.Text  = student.address.ToString();
                this.dpBirthday.Value = DateTime.Parse(student.birthday.ToString());
                this.cbFaculty.Text   = student.faculty;
                this.cbMajor.Text     = student.major.ToString();
                this.txbClass.Text    = student.Class.ToString();
                this.cbGender.Text    = student.gender.ToString();
                this.cbCourse.Text    = student.course.ToString();
                this.txbPhone.Text    = student.numberPhone.ToString();
            }
            else
            {
                //chế độ add
                // Thiết lập text hướng dẫn cho các combobox
                this.cbFaculty.SelectedIndex = 0;
                this.cbMajor.SelectedIndex   = 0;
                this.cbCourse.SelectedIndex  = 0;
                this.cbGender.SelectedIndex  = 0;
            }
        }