Esempio n. 1
0
        private void lblCandidateID_TextChanged(object sender, EventArgs e)
        {
            resetButtons();
            lblAuthanticity.Text = "";
            string candi_ID = "";
            int seatNo = 0;

            Candidate candi = new Candidate();
            //populate candidate information
            try
            {
                canyInformation = candi.getCandidateInfo(Convert.ToInt32(lblCandidateID.Text));
            }
            catch (Exception ex)
            {

            }
            try
            {
                foreach (DataRow rowCan in canyInformation.Tables[0].Rows)
                {
                    //get candidate Id
                    candi_ID = rowCan[0].ToString();

                    lblFullName.Text = rowCan[0].ToString();
                    lblInitName.Text = rowCan[1].ToString();
                    lbltitle.Text = rowCan[2].ToString();
                }
            }
            catch (Exception ex)
            {

            }

            //show seat allocation
            foreach (DataRow row in nameList.Tables[0].Rows)
            {
                //get candidate Id
                candi_ID = row[0].ToString();

                if (lblCandidateID.Text == candi_ID)
                {
                    seatNo = Convert.ToInt32(row[1]);
                }
            }

            switch (seatNo)
            {
                case 0:
                    break;
                case 1:
                    HighlightChair(chair01);
                    break;
                case 2:
                    HighlightChair(chair02);
                    break;
                case 3:
                    HighlightChair(chair03);
                    break;
                case 4:
                    HighlightChair(chair04);
                    break;
            }

            if (lblCandidateID.Text == "" || lblCandidateID.Text == "unknown")
            {
                lblAuthanticity.ForeColor = Color.Red;
                lblAuthanticity.Text = "Unauthorized";
            }
            else
            {
                lblAuthanticity.ForeColor = Color.Green;
                lblAuthanticity.Text = "Authorized";
            }
        }
Esempio n. 2
0
        public void populateLists()
        {
            labels.Clear();
            trainingImages.Clear();

            //unknown detection
            for (int a = 1; a < 5; a++)
            {
                //fill lables list 4 times with id
                labels.Add("unknown");

                string LoadFaces = "face_" + "unknown" + "_" + a + ".bmp";
                try
                {
                    trainingImages.Add(new Image <Gray, byte>(Application.StartupPath + "/TrainedFaces/" + LoadFaces));
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Images not exist");
                }
            }


            string studentID;
            //get list of candidates on examination
            Candidate candi = new Candidate();
            string    sub   = cmbExam.SelectedValue.ToString();

            //Get Student Details

            nameList = candi.getCandidateList(Convert.ToInt32(sub));

            try
            {
                canyInformation = candi.getCandidateInfo(Convert.ToInt32(lblCandidateID));
            }
            catch (Exception e)
            {
            }


            ///---------------------------Face Detection--------------------------------------
            //number of students
            string stCount = nameList.Tables[0].Rows.Count.ToString();

            //run iteration for each candidate
            foreach (DataRow row in nameList.Tables[0].Rows)
            {
                //get candidate Id
                studentID = row[0].ToString();


                //fill trainedImages list from disk on id
                for (int a = 1; a < 5; a++)
                {
                    //fill lables list 4 times with id
                    labels.Add(studentID);

                    string LoadFaces = "face_" + studentID + "_" + a + ".bmp";
                    try
                    {
                        trainingImages.Add(new Image <Gray, byte>(Application.StartupPath + "/TrainedFaces/" + LoadFaces));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Images not exist");
                        break;
                    }
                }
            }

            MessageBox.Show("Found : " + stCount + " students for " + cmbExam.SelectedText.ToString() + " examination", "Data Population is Completed");
        }
Esempio n. 3
0
        public void populateLists()
        {
            labels.Clear();
            trainingImages.Clear();

            //unknown detection
            for (int a = 1; a < 5; a++)
            {
                //fill lables list 4 times with id
                labels.Add("unknown");

                string LoadFaces = "face_" + "unknown" + "_" + a + ".bmp";
                try
                {
                    trainingImages.Add(new Image<Gray, byte>(Application.StartupPath + "/TrainedFaces/" + LoadFaces));
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Images not exist");
                }
            }

            string studentID;
            //get list of candidates on examination
            Candidate candi = new Candidate();
            string sub = cmbExam.SelectedValue.ToString();
            //Get Student Details

            nameList = candi.getCandidateList(Convert.ToInt32(sub));

            try
            {
                canyInformation = candi.getCandidateInfo(Convert.ToInt32(lblCandidateID));
            }
            catch (Exception e)
            {

            }

            ///---------------------------Face Detection--------------------------------------
            //number of students
            string stCount = nameList.Tables[0].Rows.Count.ToString();
            //run iteration for each candidate
            foreach (DataRow row in nameList.Tables[0].Rows)
            {
                //get candidate Id
                studentID = row[0].ToString();

                //fill trainedImages list from disk on id
                for (int a = 1; a < 5; a++)
                {
                    //fill lables list 4 times with id
                    labels.Add(studentID);

                    string LoadFaces = "face_"+studentID+"_"+ a + ".bmp";
                    try
                    {
                        trainingImages.Add(new Image<Gray, byte>(Application.StartupPath + "/TrainedFaces/" + LoadFaces));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Images not exist");
                        break;
                    }
                }

            }

            MessageBox.Show("Found : " + stCount+" students for "+cmbExam.SelectedText.ToString()+" examination","Data Population is Completed");
        }
Esempio n. 4
0
        private void lblCandidateID_TextChanged(object sender, EventArgs e)
        {
            resetButtons();
            lblAuthanticity.Text = "";
            string candi_ID = "";
            int    seatNo   = 0;


            Candidate candi = new Candidate();

            //populate candidate information
            try
            {
                canyInformation = candi.getCandidateInfo(Convert.ToInt32(lblCandidateID.Text));
            }
            catch (Exception ex)
            {
            }
            try
            {
                foreach (DataRow rowCan in canyInformation.Tables[0].Rows)
                {
                    //get candidate Id
                    candi_ID = rowCan[0].ToString();

                    lblFullName.Text = rowCan[0].ToString();
                    lblInitName.Text = rowCan[1].ToString();
                    lbltitle.Text    = rowCan[2].ToString();
                }
            }
            catch (Exception ex)
            {
            }

            //show seat allocation
            foreach (DataRow row in nameList.Tables[0].Rows)
            {
                //get candidate Id
                candi_ID = row[0].ToString();

                if (lblCandidateID.Text == candi_ID)
                {
                    seatNo = Convert.ToInt32(row[1]);
                }
            }

            switch (seatNo)
            {
            case 0:
                break;

            case 1:
                HighlightChair(chair01);
                break;

            case 2:
                HighlightChair(chair02);
                break;

            case 3:
                HighlightChair(chair03);
                break;

            case 4:
                HighlightChair(chair04);
                break;
            }

            if (lblCandidateID.Text == "" || lblCandidateID.Text == "unknown")
            {
                lblAuthanticity.ForeColor = Color.Red;
                lblAuthanticity.Text      = "Unauthorized";
            }
            else
            {
                lblAuthanticity.ForeColor = Color.Green;
                lblAuthanticity.Text      = "Authorized";
            }
        }