Пример #1
0
        public VerificationForm(AppWindow owner)
        {
            InitializeComponent();

            this.Dock      = DockStyle.Fill;
            this.BackColor = owner.LightColor;

            verificationControl = new DPFP.Gui.Verification.VerificationControl()
            {
                Size = new Size(100, 100)
            };
            verificationControl.ReaderSerialNumber = serial;
            verificationControl.OnComplete        += VerificationControl_OnComplete;
            this.Controls.Add(verificationControl);

            picBox = new PictureBox()
            {
                Size = new Size(300, 300)
            };
            this.Controls.Add(picBox);

            btnCard = new Button()
            {
                BackColor = owner.DarkColor,
                ForeColor = owner.LightColor,
                Font      = new Font(this.Font.FontFamily, 16.0f, FontStyle.Bold),
                Size      = new Size(picBox.Width, 50),
                Text      = "Show Card",
                Visible   = false,
            };
            this.Controls.Add(btnCard);
            btnCard.Click += delegate
            {
                if (FoundPerson != null)
                {
                    IdCardWindow idCardWin = new TestForm1.IdCardWindow(FoundPerson);
                    idCardWin.ShowDialog();
                }
            };

            lblName = new Label()
            {
                AutoSize  = false,
                Font      = new Font(this.Font.FontFamily, 16.0f, FontStyle.Regular),
                TextAlign = ContentAlignment.MiddleLeft,
                Width     = 500
            };
            this.Controls.Add(lblName);

            lblAge = new Label()
            {
                AutoSize  = lblName.AutoSize,
                Font      = lblName.Font,
                TextAlign = lblName.TextAlign,
                Width     = lblName.Width
            };
            this.Controls.Add(lblAge);

            lblGender = new Label()
            {
                AutoSize  = lblName.AutoSize,
                Font      = lblName.Font,
                TextAlign = lblName.TextAlign,
                Width     = lblName.Width
            };
            this.Controls.Add(lblGender);

            lblMaritalStatus = new Label()
            {
                AutoSize  = lblName.AutoSize,
                Font      = lblName.Font,
                TextAlign = lblName.TextAlign,
                Width     = lblName.Width
            };
            this.Controls.Add(lblMaritalStatus);

            lblState = new Label()
            {
                AutoSize  = lblName.AutoSize,
                Font      = lblName.Font,
                TextAlign = lblName.TextAlign,
                Width     = lblName.Width
            };
            this.Controls.Add(lblState);

            lblLGA = new Label()
            {
                AutoSize  = lblName.AutoSize,
                Font      = lblName.Font,
                TextAlign = lblName.TextAlign,
                Width     = lblName.Width
            };
            this.Controls.Add(lblLGA);

            this.SizeChanged += delegate
            {
                verificationControl.Location = new Point((this.Width - verificationControl.Width) / 2, 20);
                picBox.Location           = new Point(verificationControl.Left - picBox.Width, verificationControl.Bottom + 20);
                btnCard.Location          = new Point(picBox.Left, picBox.Bottom + 20);
                lblName.Location          = new Point(picBox.Right + 50, picBox.Top);
                lblAge.Location           = new Point(lblName.Left, lblName.Bottom + 20);
                lblGender.Location        = new Point(lblName.Left, lblAge.Bottom + 20);
                lblMaritalStatus.Location = new Point(lblName.Left, lblGender.Bottom + 20);
                lblState.Location         = new Point(lblName.Left, lblMaritalStatus.Bottom + 20);
                lblLGA.Location           = new Point(lblName.Left, lblState.Bottom + 20);
            };
        }
Пример #2
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            Idp person = new Idp();

            person.Photo           = camControl.CapturedBitmap;
            person.FirstName       = txtFirstname.Text;
            person.LastName        = txtLastName.Text;
            person.OtherNames      = txtOtherNames.Text;
            person.FingerTemplates = capturedTemplates;
            if (btnDob.Checked)
            {
                person.DoB = datePicker.Value;
            }
            if (btnYoB.Checked)
            {
                int currentYear = DateTime.Now.Year;
                person.YoB = currentYear - (int)txtAge.Value;
            }
            if (genderList.SelectedItem != null)
            {
                person.Gender = genderList.SelectedItem.ToString();
            }
            if (maritalStatusList.SelectedItem != null)
            {
                person.MaritalStatus = maritalStatusList.SelectedItem.ToString();
            }
            if (statesList.SelectedItem != null)
            {
                person.State = statesList.SelectedItem.ToString();
            }
            if (lgaList.SelectedItem != null)
            {
                person.LGA = lgaList.SelectedItem.ToString();
            }

            //QRCodeGenerator qrGenerator = new QRCodeGenerator();
            //var content = "IDP-BOR-001";
            //QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(content, QRCodeGenerator.ECCLevel.M);
            //Image img = qrCode.GetGraphic(20);
            //img.Save(@"C:\Users\frank\Pictures\IDP-BOR-001.jpg");

            IdpDb  db = new IdpDb();
            string id;

            if (db.SavePerson(person, out id))
            {
                person.ID = id;

                camControl.Reset();
                txtFirstname.ResetText();
                txtFirstname.ShowHint();
                txtLastName.ResetText();
                txtLastName.ShowHint();
                txtOtherNames.ResetText();
                txtOtherNames.ShowHint();
                datePicker.Value               = DateTime.Now;
                txtAge.Value                   = txtAge.Minimum;
                genderList.SelectedItem        = null;
                genderList.Text                = "select gender";
                maritalStatusList.SelectedItem = null;
                maritalStatusList.Text         = "select marital status";
                statesList.SelectedItem        = null;
                statesList.Text                = "select state";
                lgaList.SelectedItem           = null;
                lgaList.Text                   = "select LGA";
                lgaList.Items.Clear();
                RecreateEnrollmentControl();

                capturedTemplates = null;
                capturedTemplates = new DPFP.Template[10];

                IdCardWindow idCardWin = new TestForm1.IdCardWindow(person);
                idCardWin.ShowDialog();
            }
            else
            {
                MessageBox.Show("Could not save data successfully!");
            }
        }