예제 #1
0
        private async void ShowFINGER_Completed(object sender, object e)
        {
            FingerStatusText.Text = gloablvalue.checksend(gloablvalue.RecivedText);
            gloablvalue.attendid  = gloablvalue.checksend(gloablvalue.RecivedText);

            if (gloablvalue.attendid == "F")
            {
                FingerStatusText.Text = "Put your finger!";
            }
            else
            {
                FingerStatusText.Text = gloablvalue.attendid;
                await DatabaseManagement.SearchStudentFingerPrint(studentid, Acadimicid, studentname, fingerprintid); //get fingerprint was get from fingerprint and search on student id if found return it

                if (studentid.Text == "NULL")
                {
                    FingerStatusText.Text = "An error occured!";
                }
                else if (studentid.Text == "Not Found")
                {
                    FingerStatusText.Text = "Id = " + gloablvalue.attendid + " not stored!";
                }
                else
                {
                    await DatabaseManagement.CheckAttend(state);

                    if (state.Text == "Not Found")
                    {
                        DatabaseManagement.InsertAllStudentsInLecData(gloablvalue.NewLecId, studentid.Text, Acadimicid.Text, studentname.Text, fingerprintid.Text);
                        FingerStatusText.Text = "Done id = " + gloablvalue.attendid;
                    }
                    else if (state.Text == "Found")
                    {
                        FingerStatusText.Text = "Id = " + gloablvalue.attendid + " Attend Before";
                    }
                    else
                    {
                        FingerStatusText.Text = "An error occured!";
                    }
                }
                //try
                //{
                await BluetoothConnection.SendCommand("-");

                //}
                //catch (Exception)
                //{
                //    var dialo2g = new MessageDialog("error in start device, click again.");
                //    await dialo2g.ShowAsync();
                //}
            }
            HideFINGER.Begin();
        }