Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            ConfirmationForm Confirmation = new ConfirmationForm();

            Confirmation.ShowDialog();
        }
Exemplo n.º 2
0
        protected override void Process(DPFP.Sample Sample)
        {
            //base.Process(Sample);

            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            // Check quality of the sample and start verification if it's good
            // TODO: move to a separate task

            if (features != null)
            {
                // Compare the feature set with our template
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();


                //Indexes ,
                //string connstring = "Host=192.168.100.20;Username=postgres;Password=postgres;Database=Serenity";
                string connstring = "Host=localhost;Username=sgeede_fingerprint;Password=;Database=SERENITY_PRODUCTION";
                // Making connection with Npgsql provider
                NpgsqlConnection conn = new NpgsqlConnection(connstring);
                conn.Open();
                string sql = "select id,name_related,fingerprint from hr_employee where is_referral = True and fingerprint is not null;";
                // data adapter making request from our connection
                NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, conn);

                string spa_order = "";
                using (var cmd = new NpgsqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = "select id from paid_off_commission_referral_wizard order by id desc limit 1;";

                    var reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        for (int i = 0; i < reader.FieldCount; i++)
                        {
                            spa_order = reader[i].ToString();
                        }
                    }
                }
                ds.Reset();
                // filling DataSet with result from NpgsqlDataAdapter
                da.Fill(ds);
                // since it C# DataSet can handle multiple tables, we will select first
                dt = ds.Tables[0];

                foreach (DataRow dr in dt.Rows)
                {
                    byte[]        _img     = (byte[])dr["fingerprint"];
                    MemoryStream  ms       = new MemoryStream(_img);
                    DPFP.Template Template = new DPFP.Template();
                    Template.DeSerialize(ms);
                    DPFP.Verification.Verification Verificator = new DPFP.Verification.Verification();

                    base.Process(Sample);

                    DPFP.FeatureSet features2 = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);
                    if (features2 != null)
                    {
                        DPFP.Verification.Verification.Result result2 = new DPFP.Verification.Verification.Result();
                        Verificator.Verify(features2, Template, ref result2);
                        UpdateStatus(result2.FARAchieved);
                        if (result2.Verified)
                        {
                            MakeReport("The fingerprint was VERIFIED.");
                            MakeReport(dr["name_related"].ToString());

                            //MessageBox.Show(spa_order);
                            //MessageBox.Show(dr["name_related"].ToString());
                            using (var cmd = new NpgsqlCommand())
                            {
                                cmd.Connection  = conn;
                                cmd.CommandText = "update paid_off_commission_referral_wizard set referral_id = (@p) where id = (@q);";
                                cmd.Parameters.AddWithValue("p", dr["id"]);
                                cmd.Parameters.AddWithValue("q", spa_order);

                                //cmd.Parameters.AddWithValue("p", "Hello world");
                                cmd.ExecuteNonQuery();
                            }
                            string message = "Referral is set to ";
                            message += dr["name_related"].ToString();
                            //MessageBox.Show(message);
                            //confirmation
                            referral = dr["name_related"].ToString();
                            MakeName(referral);
                            ConfirmationForm Confirmation = new ConfirmationForm();
                            //Confirmation.Text += message;
                            Confirmation.TopMost = true;
                            Confirmation.ShowDialog();
                        }
                        else
                        {
                            //MakeReport("The fingerprint was NOT VERIFIED.");
                        }
                    }
                }
            }
        }