示例#1
0
 private void SaveStudentToDatabase()
 {
     if (studentInfo.IsExist)
     {
         // Update student data
         database.Update("UPDATE students SET fullname='" + studentInfo.Name + "',sex='" + studentInfo.Sex + "',course='" + studentInfo.Course + "',year=" + studentInfo.Year + ",fingerprint='" + fingerprint.SerializeData(studentInfo.Lastfinger) + "',status='Registered' WHERE student_id=" + studentInfo.StudentId + "");
     }
     else
     {
         // Insert student data
         database.Insert("INSERT INTO students(student_id, fullname, sex, course, year, fingerprint, status) VALUES (" + studentInfo.StudentId + ",'" + studentInfo.Name + "','" + studentInfo.Sex + "','" + studentInfo.Course + "'," + studentInfo.Year + ",'" + fingerprint.SerializeData(studentInfo.Lastfinger) + "','Registered')");
     }
 }
 private void btn_submit_Click(object sender, RoutedEventArgs e)
 {
     if (txtBox_fname.Text == "" || txtBox_lname.Text == "" || txtBox_position.Text == "" || txtBox_username.Text == "" || firstFinger == null || secondFinger == null)
     {
         MessageBox.Show("Please complete the registration.", "Registration Info", MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
     else
     {
         SubmitForm(txtBox_fname.Text, txtBox_lname.Text, txtBox_mname.Text, txtBox_position.Text, txtBox_username.Text, fingerprintReader.SerializeData(secondFinger));
     }
 }