コード例 #1
0
        /// <summary>
        /// Load Form_SelectStudent.
        /// </summary>
        /// <param name="sender">Object sender.</param>
        /// <param name="e">Contains event argument.</param>
        private void Form_SelectStudent_Load(object sender, EventArgs e)
        {
            int courseId   = this.UpdateSemesters.CourseId;
            int year       = this.UpdateSemesters.StartYear;
            int semesterId = this.UpdateSemesters.SemesterId;

            Admissions admissions    = new Admissions();
            DataTable  studentsTable = admissions.GetStudentsWithFees(courseId, year, semesterId, out string errorMsg);

            if (studentsTable.Rows.Count > 0)
            {
                if (errorMsg != string.Empty)
                {
                    MessageBox.Show(
                        errorMsg,
                        "Select Students",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
                else
                {
                    this.dataGridViewSelectStudents.DataSource = studentsTable;
                    this.dataGridViewSelectStudents.ClearSelection();
                }
            }
            else
            {
                MessageBox.Show(
                    "No Students Found",
                    "Select Student",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                this.Close();
            }
        }
コード例 #2
0
        /// <summary>
        /// Populate the student data in the labels.
        /// </summary>
        /// <param name="admissionId">Contains the admission id.</param>
        private void PopulateStudentDetails(int admissionId)
        {
            Admissions admission      = new Admissions();
            DataTable  studentDetails = admission.GetStudentDetails(admissionId, out string errorMsg);

            if (errorMsg != string.Empty)
            {
                MessageBox.Show(
                    errorMsg,
                    "Populate Stdent Details",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            else
            {
                if (studentDetails.Rows.Count == 1)
                {
                    DataRow studentDetailsRow = studentDetails.Rows[0];

                    this.labelRegistrationId.Text = studentDetailsRow.ItemArray[0].ToString();
                    this.firstFirstName.Text      = studentDetailsRow.ItemArray[1].ToString();
                    this.labelLastName.Text       = studentDetailsRow.ItemArray[2].ToString();
                    this.labelGender.Text         = studentDetailsRow.ItemArray[3].ToString();
                    this.labelDateOfBirth.Text    = DateTime.Parse(studentDetailsRow.ItemArray[4].ToString()).Date.ToString("dd.MM.yyyy");
                    this.labelMobilePhone.Text    = studentDetailsRow.ItemArray[5].ToString();
                    this.labelEmail.Text          = studentDetailsRow.ItemArray[6].ToString();
                    this.labelSemester.Text       = studentDetailsRow.ItemArray[7].ToString();
                    this.labelCourse.Text         = studentDetailsRow.ItemArray[8].ToString();
                    this.labelSchoolName.Text     = studentDetailsRow.ItemArray[9].ToString();
                    this.labelEnlistDate.Text     = DateTime.Parse(studentDetailsRow.ItemArray[10].ToString()).Date.ToString("dd.MM.yyyy");
                    this.labelAddress.Text        = studentDetailsRow.ItemArray[11].ToString();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Load Form_SelectAdmission.
        /// </summary>
        /// <param name="sender">Object sender.</param>
        /// <param name="e">Contains event argument.</param>
        private void FormSelectAdmission_Load(object sender, EventArgs e)
        {
            Admissions admission       = new Admissions();
            DataTable  admissionsTable = admission.GetAdmissionsData(out string errorMsg);

            if (errorMsg != string.Empty)
            {
                MessageBox.Show(
                    errorMsg,
                    "Select All Admissions",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            else
            {
                this.dataGridViewAdmissions.DataSource = admissionsTable;
                this.dataGridViewAdmissions.ClearSelection();
            }
        }