コード例 #1
0
        private void button3_Click_1(object sender, EventArgs e)
        {
            //SqlCommand cmd = new SqlCommand();
            //cmd = new SqlCommand("SELECT Student_RegNo FROM Total_Attendance_db  WHERE Student_RegNo = '" + txtReg.Text.Trim() + "'");
            //cmd.ExecuteNonQuery();

            ////SqlDataAdapter SD = new SqlDataAdapter(query, sqlcon);
            ////DataTable dtb = new DataTable();
            ////SDA.Fill(dtb);
            sqlcon.Open();
            //string query1 = "SELECT * FROM Total_Student_db WHERE Student_RegNo ='" + txtReg.Text.Trim() + "' ";
            //SqlDataAdapter SDA1 = new SqlDataAdapter(query1, sqlcon);
            //DataTable dtb1 = new DataTable();
            //SDA1.Fill(dtb1);

            string         query = "SELECT * FROM Total_Attendance_db WHERE Student_RegNo ='" + txtReg.Text.Trim() + "' ";
            SqlDataAdapter SDA   = new SqlDataAdapter(query, sqlcon);
            DataTable      dtb   = new DataTable();

            SDA.Fill(dtb);
            sqlcon.Close();



            if (dtb.Rows.Count > 0)
            {
                sqlcon.Open();
                string     name = label6.Text;
                SqlCommand cmd  = new SqlCommand();
                cmd = new SqlCommand("UPDATE Total_Attendance_db set " + name + " = '1' WHERE Student_RegNo = '" + txtReg.Text.Trim() + "'", sqlcon);
                cmd.ExecuteNonQuery();
                sqlcon.Close();
                //MessageBox.Show("Attendance Recorded");



                string fullname   = dtb.Rows[0]["Student_Fullname"].ToString();
                string Number     = dtb.Rows[0]["Student_RegNo"].ToString();
                string attendance = dtb.Rows[0]["Percentage"].ToString();
                string total      = dtb.Rows[0]["Total"].ToString();


                string paths = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10));
                picBox.Image = Image.FromFile(paths + dtb.Rows[0]["SImagePath"].ToString());

                Image picture = picBox.Image;
                ATTP  att     = new ATTP(fullname, Number, attendance, total, picture);
                att.Show();


                //StudentPopup SPO = new StudentPopup(fullname, Number, attendance, total, picture);
                //SPO.Show();


                //"INSERT INTO Total_Attendance_db(" + colName + ") VALUES ('1') WHERE Student_RegNo = '" + txtReg.Text.Trim() + "' ";
                //SqlDataAdapter SDA = new SqlDataAdapter(query, sqlcon);
                //SDA.SelectCommand.ExecuteNonQuery();
            }
        }
コード例 #2
0
        protected void Process(DPFP.Sample Sample)
        {
            DrawPicture(FingerPrintUtility.ConvertSampleToBitmap(Sample));

            DPFP.FeatureSet features = FingerPrintUtility.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);


            if (features != null)
            {
                //try {
                bool verified = false;
                foreach (DPFP.Template template in this.Samples.Keys)
                {
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();

                    Verificator.Verify(features, template, ref result);

                    if (result.Verified)
                    {
                        this.VerifiedObject = Samples[template];
                        verified            = true;



                        sqlcon.Open();
                        string     name = sessionName.Text;
                        SqlCommand cmd  = new SqlCommand();
                        cmd = new SqlCommand("UPDATE Total_Attendance_db set " + name + " = '1' WHERE Student_RegNo = '" + txtRegNo.Text.Trim() + "'", sqlcon);
                        int N = cmd.ExecuteNonQuery();
                        sqlcon.Close();


                        string         query = "SELECT * FROM Total_Attendance_db WHERE Student_RegNo ='" + txtRegNo.Text.Trim() + "' ";
                        SqlDataAdapter SDA   = new SqlDataAdapter(query, sqlcon);
                        DataTable      dtb   = new DataTable();
                        SDA.Fill(dtb);

                        if (dtb.Rows.Count > 0)
                        {
                            string fullname   = dtb.Rows[0]["Student_Fullname"].ToString();
                            string Number     = dtb.Rows[0]["Student_RegNo"].ToString();
                            string attendance = dtb.Rows[0]["Percentage"].ToString();
                            string total      = dtb.Rows[0]["Total"].ToString();


                            string paths = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10));
                            picBox.Image = Image.FromFile(paths + dtb.Rows[0]["SImagePath"].ToString());


                            //MessageBox.Show("Attendance Recorded. Press key c to clear!");

                            Image picture = picBox.Image;
                            ATTP  att     = new ATTP(fullname, Number, attendance, total, picture);
                            att.Show();
                        }
                    }
                }


                this.IsVerificationComplete = verified;
                if (!verified)
                {
                    MessageBox.Show("Fingerprint not recognised.");
                }
            }
            else
            {
                MessageBox.Show("Cant recognize as a fingerprint.");
            }
        }