protected void btnCreateStudent_Click(object sender, EventArgs e) { try { UserDetail ud = new UserDetail(); string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtRollNumber.Text, "SHA1"); ud.AddStudent(txtStudentID.Text, txtStudentName.Text, txtRollNumber.Text, txtRollNumber.Text, hashedPassword, ddlFaculty.SelectedItem.Value, ddlSemester.SelectedItem.Value, txtEmail.Text, "Student/" + FileUpload1.FileName); FileUpload1.SaveAs(Server.MapPath("~/Student/" + FileUpload1.FileName)); ltrMessage.Text = "Saved Successfully!"; txtStudentID.Text = ""; txtStudentName.Text = ""; txtRollNumber.Text = ""; txtEmail.Text = ""; txtStudentID.Focus(); } catch(Exception){ ltrMessage.Text = "Student Already Exists"; } }
protected void btnCreateStudent_Click(object sender, EventArgs e) { try { UserDetail ud = new UserDetail(); string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtRollNumber.Text, "SHA1"); ud.AddStudent(txtStudentID.Text, txtStudentName.Text, txtRollNumber.Text, txtRollNumber.Text, hashedPassword, ddlFaculty.SelectedItem.Value, ddlSemester.SelectedItem.Value, txtEmail.Text, "Student/" + FileUpload1.FileName); FileUpload1.SaveAs(Server.MapPath("~/Student/" + FileUpload1.FileName)); ltrMessage.Text = "Saved Successfully!"; txtStudentID.Text = ""; txtStudentName.Text = ""; txtRollNumber.Text = ""; txtEmail.Text = ""; txtStudentID.Focus(); } catch (Exception) { ltrMessage.Text = "Student Already Exists"; } }