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
private void tbRfidTag_TextChanged(object sender, TextChangedEventArgs e) { ShowInfo(); if (tbRfidTag.Text != "") { int ticketID = connection.GetTicketIdFromRfid(tbRfidTag.Text); string hasTicket = connection.VisitorHasRfidAssigned(ticketID); ObservableCollection <StoreRentItem> tempRentalReturnList = connection.ShowReturnItems(tbRfidTag.Text); if (tempRentalReturnList.Count == 0) { int ticketStatus = connection.GetTicketStatus(hasTicket); if (ticketStatus == 2) { connection.SetTicketStatusOutside(hasTicket); lbFestivalCheckOutStatus.Content = "You can leave"; lbFestivalCheckOutStatus.Background = Brushes.Green; } else if (ticketStatus == 3) { lbFestivalCheckOutStatus.Content = "Check out of the camping area first"; lbFestivalCheckOutStatus.Background = Brushes.Red; } else { lbFestivalCheckOutStatus.Content = "Already out"; lbFestivalCheckOutStatus.Background = Brushes.Red; } } else { foreach (var item in tempRentalReturnList) { //this.rentalReturnList.Add(item); rentalReturnList.Add(item); } lbFestivalCheckOutStatus.Content = "Return all loaned items!"; lbFestivalCheckOutStatus.Background = Brushes.Red; } } }