예제 #1
0
        private void radButton2_Click(object sender, EventArgs e)
        {
            //int id = int.Parse(txtID.Text.ToString());
            string fullName = txtFullName.Text.ToString();
            string nameInitials = txtNameInitials.Text.ToString();

            int titleId = int.Parse(ddlTitle.SelectedItem.Value.ToString());

               // DataSet dsTitleId = DB_Connect.ExecuteQuery("SELECT title_id FROM title_tab WHERE title_name = '"+ titleName +"'");
               //int titleId = int.Parse(dsTitleId.Tables[0].Rows[0][0].ToString());

            string nationality = txtNationality.Text.ToString();
            DateTime dob = dtpDOB.Value;
            string nic = txtNIC.Text.ToString();
            string addr_l1 = txtAddrL1.Text.ToString();
            string addr_l2 = txtAddrL2.Text.ToString();
            string addr_l3 = txtAddrL3.Text.ToString();
            string telNo = txtTelNo.Text.ToString();
            string email = txtEmail.Text.ToString();
            string img = file;

            char gender;

            bool isChecked = rbFemale.IsChecked;
            if (isChecked)
                gender = 'F';
            else
                gender = 'M';

            Candidate c = new Candidate(fullName, nameInitials, titleId, nationality, nic, dob, gender, addr_l1, addr_l2, addr_l3, telNo, email, img);

            try
            {
                c.insertCandidate(c);
                MessageBox.Show("Success");
                resetFields();
            }
            catch
            {
                MessageBox.Show("Error");
            }
        }
예제 #2
0
파일: Candidate.cs 프로젝트: neonmax/cdap
 public void insertCandidate(Candidate c)
 {
     DB_Connect.InsertQuery("INSERT INTO candidate_tab(candidate_full_name,candidate_name_initials,candidate_title,candidate_nationality_id,candidate_nic,candidate_dob,candidate_gender,candidate_addr_l1,candidate_addr_l2, candidate_addr_l3, candidate_telno,candidate_email) VALUES('" + c.fullName + "', '" + c.nameInitials + "', '" + c.title + "', '" + c.nationality + "', '" + c.nic + "', '" + c.dob + "','" + c.gender + "','" + c.addr_l1 + " ','" + c.addr_l2 + " ','" + c.addr_l3 + " ', '" + c.telNo + "', '" + c.email + "');");
 }
예제 #3
0
파일: Candidate.cs 프로젝트: neonmax/cdap
 public void updateCandidate(Candidate c)
 {
     DB_Connect.ExecuteQuery("UPDATE candidate_tab SET candidate_full_name = '" + c.fullName + "',candidate_name_initials = '" + c.nameInitials + "',candidate_title = '" + c.title + "',candidate_nationality_id = '" + c.nationality + "',candidate_nic = '" + c.nic + "',candidate_dob = '" + c.dob + "',candidate_gender = '" + c.gender + "',candidate_address = '" + c.addr_l1 + "',candidate_address = '" + c.addr_l2 + "',candidate_address = '" + c.addr_l3 + "',candidate_telno = '" + c.telNo + "',candidate_email = '" + c.email + "',candidate_img = '" + c.img + "' WHERE candidate_id = " + c.id + ";");
 }
예제 #4
0
파일: Candidate.cs 프로젝트: neonmax/cdap
        public Candidate getCandidate(int id)
        {
            //int c_id = 2;
            DataSet ds = DB_Connect.ExecuteQuery("SELECT * FROM candidate_tab WHERE candidate_id = " + id + ";");

            int cid = int.Parse(ds.Tables[0].Rows[0][0].ToString());
            string cfullName = ds.Tables[0].Rows[0][1].ToString();
            string cnameInitials = ds.Tables[0].Rows[0][2].ToString();

            int ctitleId = int.Parse(ds.Tables[0].Rows[0][3].ToString());

            string cnationality = ds.Tables[0].Rows[0][4].ToString();
            string cnic = ds.Tables[0].Rows[0][5].ToString();
            DateTime cdob = (DateTime)ds.Tables[0].Rows[0][6];
            char cgender = Convert.ToChar(ds.Tables[0].Rows[0][7].ToString());
            string caddr_l1 = ds.Tables[0].Rows[0][8].ToString();
            string caddr_l2 = ds.Tables[0].Rows[0][9].ToString();
            string caddr_l3 = ds.Tables[0].Rows[0][10].ToString();
            string ctelNo = ds.Tables[0].Rows[0][11].ToString();
            string cemail = ds.Tables[0].Rows[0][12].ToString();
            string cimg = ds.Tables[0].Rows[0][13].ToString();

            Candidate c = new Candidate(cfullName, cnameInitials, ctitleId, cnationality, cnic, cdob, cgender, caddr_l1, caddr_l2, caddr_l3, ctelNo, cemail, cimg);

            return c;
        }
예제 #5
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";
            }
        }
예제 #6
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");
        }
예제 #7
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");
        }
예제 #8
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";
            }
        }