Esempio n. 1
0
        private void btnRegist_Click(object sender, EventArgs e)
        {
            string error = "";

            byte[] face       = null;
            byte[] faceresult = null;
            if (this.pbFace.Tag != null)
            {
                face       = BytesHelper.ImageToByte(this.pbFace.Image);
                faceresult = this.pbFace.Tag as byte[];
            }
            bool rslt = ConnectInfo.Regist(
                this.txtUser.Text,
                this.txtPassword.Text,
                this.txtPhone.Text,
                this.txtEmail.Text,
                this.txtAge.Text,
                this.cmbGender.Text,
                face,
                faceresult,
                out error);

            if (rslt)
            {
                DataTable dt = null;
                error = "";
                ConnectInfo.LoadUser(out dt, out error);
                if (dt != null)
                {
                    this.dgvUser.DataSource = dt;
                }
                this.aiFace.Faces = this.LoadFaces(dt);
            }
            else
            {
                MessageBox.Show(error);
                return;
            }
            this.pbFace.Image     = null;
            this.pbFace.Tag       = null;
            this.txtUser.Text     = "";
            this.txtPassword.Text = "";
            this.txtPhone.Text    = "";
            this.txtEmail.Text    = "";
            this.txtAge.Text      = "";
            this.cmbGender.Text   = "";
            this.GoHomePage();
        }