public void SetUserInfo()
        {
            try
            {
            DataTable dt;
            ErmTsPersonalInfoLinq Userinfo = new ErmTsPersonalInfoLinq();
               // TransactionDB trans = new TransactionDB();

            dt = Userinfo.GetDataList("replace(mobile_no,'-','')='" +  txtNumber.Text + "'", "", null);
             //   trans.CommitTransaction();
            if (dt.Rows.Count > 0)
            {
                LiveFaceScan.userinfo.id = dt.Rows[0]["id"] + "";
                if (Convert.IsDBNull(dt.Rows[0]["first_name"]) == false && Convert.IsDBNull(dt.Rows[0]["last_name"]) == false) {
                    LiveFaceScan.userinfo.fullname = "คุณ" + dt.Rows[0]["first_name"] + " " + dt.Rows[0]["last_name"];
                }
                if (Convert.IsDBNull(dt.Rows[0]["email"]) == false)
                {
                    LiveFaceScan.userinfo.email = dt.Rows[0]["email"] + "";
                }

                if (Convert.IsDBNull(dt.Rows[0]["company_name"]) == false)
                {
                    LiveFaceScan.userinfo.companyname = dt.Rows[0]["company_name"] + "";
                }

                this.Visible = false;
                //this.Close();
                frmSelectBrochures f = new frmSelectBrochures();
                f.ShowDialog();
            }
            else {
                Dialog.frmDialogMsg f = new Dialog.frmDialogMsg();
                f.lblText.Text = "ไม่พบข้อมูล";
                f.ShowDialog();
            }
            }
            catch (Exception exUserinfo) {
                Dialog.frmDialogMsg f = new Dialog.frmDialogMsg();
                f.lblText.Text = "ไม่พบข้อมูล";
                f.ShowDialog();
            }
        }
        private void pictureSearch_Click(object sender, EventArgs e)
        {
            //string strapppath = "D:\\Kiosk_Image_Search\\imagecompare.jpg";// System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\imagesearch\\imagecompare.jpg";
            //if (System.IO.File.Exists(strapppath.Replace("\\", "/")))
            //{
            //    System.IO.File.Delete(strapppath.Replace("\\", "/"));
            //}

            //pictureBox1.Image.Save(strapppath.Replace("\\", "/"), ImageFormat.Jpeg);
            //pictureBox1.Dispose();
            //pictureBox1.Refresh();
            needClose = true;
            Image img;
            string file = LiveFaceScan.CameraSetting.Drive + ":\\Kiosk_Image_Search\\imagecompare.jpg";
            using (Bitmap bmp = new Bitmap(file))
            {
                img = new Bitmap(bmp);
                // pictureBox1.Image = img;
            }
            if (System.IO.File.Exists(file))
            {
                System.IO.File.Delete(file);
                pictureBox1.Image.Save(file, ImageFormat.Jpeg);
            }
            else
            pictureBox1.Image.Save(file, ImageFormat.Jpeg);

            if (CheckFile() == true)
            {
                pictureSearch.Visible = false;

                Progresss();

            }
            else {
                Dialog.frmDialogMsg msg = new Dialog.frmDialogMsg();
                msg.lblText.Text = "ไม่พบข้อมูล";
                msg.ShowDialog();
                //needClose = false;
                //PopulateData();
                this.Visible = false;
                this.Close();
                frmCameraDetect f = new frmCameraDetect();
                f.ShowDialog();
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //Image img;
            //string file = @"D:\Kiosk_Image_Search\imagecompare.jpg";
            //using (Bitmap bmp = new Bitmap(file))
            //{
            //    img = new Bitmap(bmp);
            //    // pictureBox1.Image = img;
            //}
            //if (System.IO.File.Exists(file))
            //{
            //    System.IO.File.Delete(file);
            //    pictureBox1.Image.Save(file, ImageFormat.Jpeg);
            //}
            //else
            //    pictureBox1.Image.Save(file, ImageFormat.Jpeg);

            //if (CheckFile() == true)
            //{
            //    pictureSearch.Visible = false;

            //    Progresss();

            //}
            //else
            //{
            //    MessageBox.Show("กรุณาถ่ายรูปใหม่ค่ะ");
            //    //needClose = false;
            //    //PopulateData();
            //    this.Visible = false;
            //    this.Close();
            //    frmCameraDetect f = new frmCameraDetect();
            //    f.ShowDialog();
            //}

            needClose = true;
            Image img;
            string file = LiveFaceScan.CameraSetting.Drive + ":\\Kiosk_Image_Search\\imagecompare.jpg";
            using (Bitmap bmp = new Bitmap(file))
            {
                img = new Bitmap(bmp);
                // pictureBox1.Image = img;
            }
            if (System.IO.File.Exists(file))
            {
                System.IO.File.Delete(file);
                pictureBox1.Image.Save(file, ImageFormat.Jpeg);
            }
            else
                pictureBox1.Image.Save(file, ImageFormat.Jpeg);

            if (CheckFile() == true)
            {
                pictureSearch.Visible = false;

                Progresss();

            }
            else
            {
                Dialog.frmDialogMsg msg = new Dialog.frmDialogMsg();
                msg.lblText.Text = "ไม่พบข้อมูล";
                msg.ShowDialog();
                //needClose = false;
                //PopulateData();
                this.Visible = false;
                this.Close();
                frmCameraDetect f = new frmCameraDetect();
                f.ShowDialog();
            }
        }