Exemplo n.º 1
0
        public void CheckUserRfid(object sender, RFIDTagEventArgs args)
        {
            rfid_Code  = args.Tag;
            dataHelper = new Mysql();
            string userName = dataHelper.GetUserFirstNameWithRfid(rfid_Code);

            if (userName != "")
            {
                List <string> itemsLoaned = dataHelper.GetItemsLoanedByUser(rfid_Code);
                string        items       = "";
                if (itemsLoaned.Count() == 0)
                {
                    lbRfid_Status.Text      = userName + " nothing loaned ";
                    lbRfid_Status.ForeColor = Color.White;
                    Loaned_Items            = false;
                }
                else
                {
                    for (int i = 0; i < itemsLoaned.Count; i += 2)
                    {
                        items += itemsLoaned[i + 1] + " " + itemsLoaned[i] + "s ,";
                    }
                    int    end = items.LastIndexOf(",");
                    string resultOfItemsLoaned = items.Substring(0, end);

                    lbRfid_Status.Text      = userName + " has to return " + resultOfItemsLoaned;
                    lbRfid_Status.ForeColor = Color.Crimson;
                    Loaned_Items            = true;
                }
            }
            else
            {
                lbRfid_Status.Text = rfid_Code;
            }
            rfid.Close();
        }