Beispiel #1
0
        private void btnCreateAcc_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFName.Text) | string.IsNullOrEmpty(txtLName.Text) | string.IsNullOrEmpty(txtEmail.Text) | string.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show("Please enter valid data");
            }
            else
            {
                Student newStu = new Student();
                //StudentID is identity and set by the database
                newStu.StudentFName    = txtFName.Text.Trim();
                newStu.StudentLName    = txtLName.Text.Trim();
                newStu.BirthDate       = txtBirthDate.Value;
                newStu.StudentEmail    = txtEmail.Text.Trim();
                newStu.StudentPassword = txtPassword.Text.Trim();

                StudentDB.Add(newStu);
            }
        }
Beispiel #2
0
        private void btnCreateAcc_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFName.Text) | string.IsNullOrEmpty(txtLName.Text) | string.IsNullOrEmpty(txtEmail.Text) | string.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show("Please enter valid data");
            }
            else
            {
                Student newStu = new Student();
                newStu.StudentFName    = txtFName.Text.Trim();
                newStu.StudentLName    = txtLName.Text.Trim();
                newStu.BirthDate       = txtBirthDate.Value;
                newStu.StudentEmail    = txtEmail.Text.Trim();
                newStu.StudentPassword = txtPassword.Text.Trim();

                StudentDB.Add(newStu);
                MessageBox.Show("Account Added" + "\n" + "Your ID is: " + StudentDB.GetNewStudentID());
                this.Close();
            }
        }