public StudentProfilePage(StudentDashboard studentDashboard)
 {
     InitializeComponent();
     this.studentDashboard = studentDashboard;
     PopulateAvailabelCourses();
     PopulateYearAndSex();
     SetInformation();
 }
        private void OnCaptured(CaptureResult captureResult)
        {
            try
            {
                if (!fingerprintReader.CheckCaptureResult(captureResult))
                {
                    return;
                }
                DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI);
                if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                {
                    fingerprintReader.CurrentReader.Reset();
                    throw new Exception(captureResult.ResultCode.ToString());
                }

                // See the SDK documentation for an explanation on threshold scores.
                int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000;

                if (isAdminLogin)
                {
                    IdentifyResult identifyResult = Comparison.Identify(resultConversion.Data, 0, AdminFingerPrints.ToArray(), thresholdScore, AdminFingerPrints.Count);
                    if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                    {
                        throw new Exception(identifyResult.ResultCode.ToString());
                    }

                    if (identifyResult.Indexes.Length > 0)
                    {
                        fingerprintReader.CancelCaptureAndCloseReader(this.OnCaptured);
                        Application.Current.Dispatcher.Invoke((Action) delegate
                        {
                            AdminDashboard adminDashboard = new AdminDashboard();
                            adminDashboard.CurrentAdminId = AdminId.ElementAt(identifyResult.Indexes[0][0]);
                            adminDashboard.Show();
                            fingerprintReader.CurrentReader.Dispose();
                            fingerprintReader.CurrentReader = null;
                            this.Close();
                        });
                    }
                }
                else
                {
                    IdentifyResult identifyResult = Comparison.Identify(resultConversion.Data, 0, StudenFingerPrints.ToArray(), thresholdScore, StudenFingerPrints.Count);
                    if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                    {
                        throw new Exception(identifyResult.ResultCode.ToString());
                    }

                    if (identifyResult.Indexes.Length > 0)
                    {
                        fingerprintReader.CancelCaptureAndCloseReader(this.OnCaptured);
                        Application.Current.Dispatcher.Invoke((Action) delegate
                        {
                            StudentDashboard studentDash = new StudentDashboard(StudentId.ElementAt(identifyResult.Indexes[0][0]).ToString(), database);
                            studentDash.Show();
                            fingerprintReader.CurrentReader.Dispose();
                            fingerprintReader.CurrentReader = null;
                            this.Close();
                        });
                    }
                }
            }
            catch (Exception)
            {
                Application.Current.Dispatcher.Invoke((Action) delegate
                {
                    ErrorHeader1.Text     = "Fingerprint device error";
                    ErrorContent1.Text    = "Error while capturing the fingerprint.";
                    DialogMessage1.IsOpen = true;
                });
            }
        }
 public StudentAttendancePage(StudentDashboard studentDashboard)
 {
     InitializeComponent();
     this.studentDashboard = studentDashboard;
     PopulateDataGrid("SELECT b.Name AS 'Activity', DATE_FORMAT(Date, '%M %d, %Y') AS 'Date', b.Time, IF(a.attendance_in = 1, 'Present', 'Absent') AS 'In', IF(a.attendance_out = 1, 'Present', 'Absent') AS 'Out' FROM attendance AS a INNER JOIN activities AS b ON a.activity_id = b.id INNER JOIN students AS c ON a.student_id = c.student_id WHERE c.student_id = '" + studentDashboard.StudentId + "'");
 }