Exemple #1
0
        private void ShowInfo()
        {
            int    ticketId  = connection.GetTicketIdFromRfid(tbRfidTag.Text);
            string name      = connection.GetVisitorNameRfid(tbRfidTag.Text);
            int    accountId = connection.GetVisitorIdFromRfid(tbRfidTag.Text);
            double balance   = connection.GetBalanceByRfid(tbRfidTag.Text);

            byte[]       pic  = connection.getVisitorPicture(accountId);
            MemoryStream strm = new MemoryStream();

            if (pic != null)
            {
                strm.Write(pic, 0, pic.Length);
                strm.Position = 0;
                System.Drawing.Image img = System.Drawing.Image.FromStream(strm);
                BitmapImage          bi  = new BitmapImage();
                bi.BeginInit();
                MemoryStream ms = new MemoryStream();
                img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
                ms.Seek(0, SeekOrigin.Begin);
                bi.StreamSource = ms;
                bi.EndInit();
                pbPicture.Source = bi;
            }
            else
            {
                BitmapImage image = new BitmapImage(new Uri("img/no-profile.jpg", UriKind.Relative));
                pbPicture.Source = image;
            }


            tbTicketNum.Text = ticketId.ToString();
            tbName.Text      = name;
            tbID.Text        = accountId.ToString();
            tbBalance.Text   = "\u20AC" + balance.ToString();
        } //Fills all the info when an rfid is scanned