Example #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtBoxStudentName.Text == "")
     {
         MessageBox.Show("Please Enter the Student Name");
     }
     else if (txtBoxUserName.Text == "")
     {
         MessageBox.Show("Please Enter the User Name");
     }
     else if (txtBoxPassword.Text == "")
     {
         MessageBox.Show("Please Enter New Password for Student");
     }
     else if (!ValidatePassword(txtBoxPassword.Text))
     {
         MessageBox.Show("Please Enter Password with Capital Letters, Small Letters and Digits");
     }
     else if (!IsValidEmail(txtBoxEmailId.Text))
     {
         MessageBox.Show("Please Re-Enter Email Address");
     }
     else
     {
         CreateStudentController csc = new CreateStudentController();
         csc.addStudent(txtBoxStudentName.Text, txtBoxUserName.Text, txtBoxPassword.Text, txtBoxEmailId.Text);
         csc.addStudentToLoginType(txtBoxUserName.Text, txtBoxPassword.Text);
         MessageBox.Show(txtBoxStudentName.Text + " as Student is created");
         resetTexts();
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (comboBoxStudentName.Text == "")
     {
         MessageBox.Show("Please Select a Student");
     }
     else if (txtNewPassWord.Text == "")
     {
         MessageBox.Show("Please Enter New Password for Student");
     }
     else if (!ValidatePassword(txtNewPassWord.Text))
     {
         MessageBox.Show("Please Enter Password with Capital Letters, Small Letters and Digits");
     }
     else
     {
         CreateStudentController csc = new CreateStudentController();
         csc.changeStudentPassword(comboBoxStudentName.Text, txtNewPassWord.Text);
         //csc.changeStudentPasswordForLogin(comboBoxStudentName.Text, txtNewPassWord.Text);
         MessageBox.Show("Password has Changed for " + comboBoxStudentName.Text);
         resetText();
         getStudentNames();
     }
 }