Esempio n. 1
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     StudentDetails studentDetails = new StudentDetails();
     studentDetails.MdiParent = this;
     studentDetails.Show();
 }
Esempio n. 2
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            //Insert Student Objects to a List
            Student student = new Student();
            string name = textBoxName.Text;
            bool validrangegpa=false;
            student.Dob = dateTimePickerDateOfBirth.Value;
            student.StudentId =Convert.ToInt32(textBoxStudentID.Text);
            string gpa = textBoxGradePoint.Text;

            if (!string.IsNullOrEmpty(name) & !string.IsNullOrEmpty(gpa))
            {
                bool validegpa = validateNumbers(gpa);
                if (validegpa)
                {
                    float gpaValue=(float)Convert.ToDouble(gpa);
                    if (gpaValue <= 4.0 & gpaValue > 0)
                    {
                        validrangegpa=true;
                        student.GradePointAvg = gpaValue;
                    }
                    else
                    {
                        MessageBox.Show("Enter Valid GPA");
                    }

                }
                else
                {
                    MessageBox.Show("Gpa is not Valid");
                }

                bool valideName = IsName(name);
                if (valideName)
                {
                    student.Name = name;
                }
                else
                {
                    MessageBox.Show("Name is Not Valid");
                }

                bool activeValue = checkBoxActive.Checked;
                if (activeValue == true)
                {
                    student.Active = true;
                }
                else
                {
                    student.Active = false;
                }

                if (valideName & validrangegpa)
                {
                    st.Add(student);
                    this.Close();
                    StudentDetails stud = new StudentDetails();
                   // stud.MdiParent = MdiParentHome.ActiveForm;
                    stud.Show();

                    if (newNumber == 0)
                    {
                        newNumber = loadnumber;
                        ++newNumber;
                    }
                    else
                    {
                        ++newNumber;
                    }
                }
            }
            else
            {

                MessageBox.Show("Please Enter Details");
            }
        }