Esempio n. 1
0
        } //makes the btnAssign and tbTagValue visible

        private void FillTextBoxInfo(int ticketId)
        {
            string name       = connection.GetVisitorName(ticketId);
            int    visitorId  = connection.GetVisitorIdFromTicketId(ticketId);
            int    campspotId = 0;

            tbVisitorTicketId.Text = tbQrValue.Text;
            string rfidValue = connection.VisitorHasRfidAssigned(ticketId);

            if (connection.IsCamper(ticketId))
            {
                //hasCampspot = "Yes";
                campspotId = connection.GetCampspotIdFromTicketId(ticketId);
            }
            else
            //hasCampspot = "No";
            if (rfidValue == "")
            {
                tbRfidAlreadyAssigned.Text = "Not assigned";
            }
            else
            {
                tbRfidAlreadyAssigned.Text = rfidValue;
            }

            byte[]       pic  = connection.getVisitorPicture(visitorId);
            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;
            }

            tbVisitorName.Text = name;
            tbVisitorId.Text   = visitorId.ToString();
            //tbVisitorHasCamp.Text = hasCampspot;
            tbVisitorCampspot.Text = campspotId.ToString();
        }//fills the textboxes that give visitor information when the QR is scanned