예제 #1
0
        private void fillTextBoxInfo(string rfidTag)
        {
            int    ticketId   = connection.GetTicketIdFromRfid(rfidTag);
            string name       = connection.GetVisitorNameRfid(rfidTag);
            int    accountId  = connection.GetVisitorIdFromRfid(rfidTag);
            int    campspotId = connection.GetCampspotIdFromRfid(rfidTag);

            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;
            tbAccountId.Text  = accountId.ToString();
            tbCampspotId.Text = campspotId.ToString();
        } // gets TicketID, Name, AccountId and campspotID