コード例 #1
0
        private void BindingDataToComboBox()
        {
            try
            {
                List <StudentDegree> student_degrees = StudentDegreeController.StudentDegreeSelectAll();
                cmbStudentAdmissionDegree.DataSource    = student_degrees;
                cmbStudentAdmissionDegree.DisplayMember = "DegreeName";
                cmbStudentAdmissionDegree.ValueMember   = "DegreeID";
                cmbStudentAdmissionDegree.Tag           = "DegreeID";
                cmbStudentAdmissionDegree.SelectedIndex = 0;

                List <StudentProgram> selected_programs = StudentProgramController.StudentProgramSelectAll();
                cmbStudentAdmissionProgram.DataSource    = selected_programs;
                cmbStudentAdmissionProgram.DisplayMember = "ProgramName";
                cmbStudentAdmissionProgram.ValueMember   = "ProgramID";
                cmbStudentAdmissionProgram.Tag           = "ProgramID";
                cmbStudentAdmissionProgram.SelectedIndex = 0;

                List <StudentSession> student_Sessions = StudentSessionController.StudentSessionSelectAll();
                cmbStudentSession.DataSource    = student_Sessions;
                cmbStudentSession.DisplayMember = "SessionName";
                cmbStudentSession.ValueMember   = "SessionID";
                cmbStudentSession.Tag           = "SessionID";
                cmbStudentSession.SelectedIndex = 0;

                List <StudentSections> Student_section = StudentSectionsController.StudentSectionsSelectAll();
                cmbStudentSession.DataSource    = Student_section;
                cmbStudentSession.DisplayMember = "SectionName";
                cmbStudentSession.ValueMember   = "SectionID";
                cmbStudentSession.Tag           = "SectionID";
                cmbStudentSession.SelectedIndex = 0;

                List <StudentSubject> student_Subject = StudentSubjectController.StudentSubjectSelectAll();
                cmbMasterMajor.DataSource    = student_Subject;
                cmbMasterMajor.DisplayMember = "SubjectName";
                cmbMasterMajor.ValueMember   = "SubjectID";
                cmbMasterMajor.Tag           = "SubjectID";
                cmbMasterMajor.SelectedIndex = 0;

                List <DAEStudentMajor> student_DAEMajor = DAEStudentMajorController.DAEStudentMajorSelectAll();
                cmbInterStudentDEAMajor.DataSource = student_DAEMajor;
                cmbDAE.DisplayMember = "DAEName";
                cmbInterStudentDEAMajor.ValueMember   = "DAEMajorID";
                cmbInterStudentDEAMajor.Tag           = "DAEMajorID";
                cmbInterStudentDEAMajor.SelectedIndex = 0;

                List <AllReligion> religion = AllReligionController.AllReligionSelectAll();
                cmbRligion.DataSource    = religion;
                cmbRligion.DisplayMember = "ReligionName";
                cmbRligion.ValueMember   = "ReligionID";
                cmbRligion.Tag           = "ReligionID";
                cmbRligion.SelectedIndex = 0;
            }
            catch (Exception) { }
        }
コード例 #2
0
        public void DataBind()
        {
            try
            {
                dataSource = StudentSubjectController.StudentSubjectSelectAll();
                if (dataSource.Count == 0)
                {
                    return;
                }

                int top              = 5;
                int left             = 5;
                int columns_count    = Convert.ToInt32(Math.Round(Convert.ToDouble(this.Width) / 150));
                int column_remaining = columns_count;

                foreach (var drStudentSubject in dataSource)
                {
                    StudentSubject objStudentSubject = new StudentSubject();


                    objStudentSubject.SubjectID      = drStudentSubject.SubjectID;
                    objStudentSubject.SubjectName    = drStudentSubject.SubjectName;
                    objStudentSubject.InsertByID     = drStudentSubject.InsertByID;
                    objStudentSubject.InsertDataTime = drStudentSubject.InsertDataTime;
                    objStudentSubject.LastUpdateID   = drStudentSubject.LastUpdateID;
                    objStudentSubject.LastUpdateTime = drStudentSubject.LastUpdateTime;
                    objStudentSubject.Remarks        = drStudentSubject.Remarks;
                    objStudentSubject.IsEnabeled     = drStudentSubject.IsEnabeled;


                    CheckBox chkSubject = new CheckBox();
                    chkSubject.Text     = drStudentSubject.SubjectName.ToString();
                    chkSubject.Tag      = objStudentSubject;
                    chkSubject.AutoSize = false;
                    chkSubject.Width    = 150;

                    chkSubject.Location = new Point(left, top);
                    this.Controls.Add(chkSubject);
                    column_remaining--;

                    if (column_remaining == 0)
                    {
                        top             += row_height;
                        left             = 5;
                        column_remaining = columns_count;
                    }
                    else
                    {
                        left += 150;
                    }
                }
            }
            catch (Exception ex) { }
        }
コード例 #3
0
 private void SetSemesterForm_Load(object sender, EventArgs e)
 {
     studentSubjects = StudentSubjectController.StudentSubjectSelectAll();
     StudentSubjectDataGridView.DataSource = StudentSubjectController.StudentSubjectSelectAll();
     ShowData();
 }