public AddSectionForm(Controller.UserAccount ua, int secId)
 {
     InitializeComponent();
     sectionName = string.Empty;
     section     = new Controller.Section
     {
         sectionID = secId
     };
 }
        String[] name;                             //For names passing in the query

        public AddSectionForm(Controller.UserAccount ua)
        {
            InitializeComponent();
            addSectionForm = this;
            sectionName    = string.Empty;
            section        = new Controller.Section();
            userAccount    = ua;
            MessageBox.Show("Called the User identification constructor.");
        }
 private void CheckFormCall()
 {
     if (this.Owner != null)
     {
         if ((this.Owner is ViewStudentForm))
         {
             LabelAddStudentTitle.Text = "Update Student";
             Controller.Section section = new Controller.Section();
             section.LoadAllSection(userAccount.ua_department_id, Convert.ToInt32(comboBoxSemester.SelectedValue), comboBoxSection);
             student.GetSingleStudent(textBoxStudentName, textBoxCardNumber, textBoxStudentContact, textBoxParentContact, textBoxAddress, textBoxEmail, comboBoxSemester, comboBoxSection);
         }
         if (this.Owner is HomeForm)
         {
             comboBoxSemester.SelectedItem = null;
             comboBoxSection.SelectedItem  = null;
         }
     }
 }
        private void comboBoxSemester_SelectionChangeCommitted(object sender, EventArgs e)
        {
            //MessageBox.Show("SelectionChangeCommitted.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            comboBoxSection.DataSource = null;
            comboBoxSection.Items.Clear();
            comboBoxSubject.DataSource = null;
            comboBoxSubject.Items.Clear();

            //comboBoxSection.Items.Remove(1);
            //for (int i = 0; i < comboBoxSection.Items.Count; i++)
            //{
            //    comboBoxSection.Items.RemoveAt(i);
            //}
            //comboBoxSection.Items.Remove(comboBoxSection.SelectedItem);

            Controller.Section section = new Controller.Section();
            Controller.Subject subject = new Controller.Subject();
            section.LoadAllSection(1, Convert.ToInt32(comboBoxSemester.SelectedValue), comboBoxSection);
            subject.LoadAllSubject(1, Convert.ToInt32(comboBoxSemester.SelectedValue), comboBoxSubject);
        }
        private bool SectionValidation()
        {
            if (comboBoxSemesterName.SelectedItem == null)
            {
                MessageBox.Show("Please select semester.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                comboBoxSemesterName.Focus();
                return(false);
            }

            //Name fields Validation
            int i = 0;

            Controller.Section section = new Controller.Section();
            foreach (Control control in panelSectionTextbox.Controls)
            {
                if (control is TextBox textBox)
                {
                    if (String.IsNullOrWhiteSpace(textBox.Text))
                    {
                        MessageBox.Show("Please fill the Section Name.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        textBox.Focus();
                        return(false);
                    }

                    if (sectionName != textBox.Text || sectionName == string.Empty)
                    {
                        if (section.CheckForSectionName(Convert.ToInt32(comboBoxSemesterName.SelectedValue), textBox.Text, userAccount.ua_department_id))
                        {
                            MessageBox.Show(textBox.Text + " : already exist in " + this.comboBoxSemesterName.GetItemText(this.comboBoxSemesterName.SelectedItem).ToString() + " semester.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            textBox.Focus();
                            return(false);
                        }
                    }
                    //MessageBox.Show("Found " + di + 1.ToString() + " Debit ComboBox.");
                    name[i] = textBox.Text;
                    i++;
                }
            }
            return(true);
        }
 private void comboBoxSemester_SelectionChangeCommitted(object sender, EventArgs e)
 {
     comboBoxSection.SelectedItem = null;
     Controller.Section section = new Controller.Section();
     section.LoadAllSection(userAccount.ua_department_id, Convert.ToInt32(comboBoxSemester.SelectedValue), comboBoxSection);
 }