private async void btn_biometry_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Image SelectedFingerPrint = null;
            OpenFileDialog       dlg = new OpenFileDialog
            {
                InitialDirectory = "c:\\Pictures",
                Filter           = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png",
                RestoreDirectory = true
            };

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string selectedFileName = dlg.FileName;
                SelectedFingerPrint = System.Drawing.Image.FromFile(selectedFileName);



                FingerPrintData fingerDataBase   = new FingerPrintData();
                var             resultComparison = await new ImageController().CompareDatabase(SelectedFingerPrint);

                if (resultComparison != 0)
                {
                    var        user      = await new DataController().GetUserInfo(resultComparison);
                    MainSystem newSystem = new MainSystem(user.User);
                    newSystem.Show();
                    this.Close();
                }
                else
                {
                    System.Windows.MessageBox.Show("Não foi possivel realizar o login");
                }
            }
            else
            {
                System.Windows.MessageBox.Show("Não foi possivel realizar o login");
            }
        }
        public HttpResponseMessage Getall([FromBody] filter filter)
        {
            if (filter.startdate == null || filter.enddate == null)
            {
                return(null);
            }

            List <KTX0050> list   = new List <KTX0050>();
            DataTable      dt     = new DataTable();
            string         iptemp = "";

            filter.ip.ToList().ForEach(fff =>
            {
                iptemp += "'" + fff.ip + "'" + ",";
                FingerPrintData.Getdata(new FingerPrintData.filter()
                {
                    commkey   = fff.commkey,
                    enddate   = DateTime.Parse(filter.enddate.ToString()).ToString("yyyy-MM-dd HH:mm:ss"),
                    ip        = fff.ip,
                    port      = fff.port,
                    startdate = DateTime.Parse(filter.startdate.ToString()).ToString("yyyy-MM-dd HH:mm:ss")
                }, ref dt, list
                                        );
            });

            using (DB db = new DB())
            {
                do
                {
                    string startdate = DateTime.Parse(filter.startdate.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                    string enddate   = DateTime.Parse(filter.enddate.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                    var    temp      = db.Database.SqlQuery <count>("select count( User_ID ) as counts from KTX0050 where Verify_Date>='" + startdate + "' and  Verify_Date<='" + enddate + "' and ip in (" + iptemp.TrimEnd(',') + ")");
                    object data      = null;
                    if (filter.style == 2)
                    {
                        data = db.Database.SqlQuery <getdataOnDB>(@"DECLARE @ip ListIP;
INSERT INTO @ip ( ip ) VALUES (" + iptemp.TrimEnd(',').Replace(",", "),(") + @")
EXECUTE Getravaocong2 @List=@ip,@startdate='" + startdate + "',@enddate='" + enddate + "'").ToList();
                    }
                    else if (filter.style == 1)
                    {
                        data = db.Database.SqlQuery <getdataOnDB2>(@"DECLARE @ip ListIP;
INSERT INTO @ip ( ip ) VALUES (" + iptemp.TrimEnd(',').Replace(",", "),(") + @")
EXECUTE getxuatan @List=@ip,@startdate='" + startdate + "',@enddate='" + enddate + "'").AsEnumerable().Select(p => new
                        {
                            p.buasang,
                            p.buatoi,
                            p.buatrua,
                            p.User_ID,
                            p.thanhtienbuasang,
                            p.thanhtienbuatoi,
                            p.thanhtienbuatrua,
                            ngayvao = db.Database.SqlQuery <Nullable <DateTime> >("execute getngayvao @id='" + p.User_ID + "'").FirstOrDefault(),
                            phong   = db.Database.SqlQuery <string>("execute Getphong @id='" + p.User_ID + "'").FirstOrDefault()
                        }).ToList();
                    }
                    int kkkk = temp.FirstOrDefault().counts;
                    if (list.Count > kkkk)
                    {
                        FingerPrintData.Syncdata(new FingerPrintData.datasync()
                        {
                            KTX0050 = list.ToArray(), type = 1
                        });
                    }
                    else
                    {
                        return(REST.GetHttpResponseMessFromObject(data));
                    }
                }while (true);
            }
        }