public CampingSpot GetASpot(int ID)
        {
            //  String eventnr = Convert.ToString(ID);
            MySqlCommand command     = new MySqlCommand("SELECT * FROM CAMPINGSPOT WHERE CAMPINGSPOTID=" + ID, connection);
            CampingSpot  CampingSpot = null;

            try
            {
                connection.Open();
                MySqlDataReader r = command.ExecuteReader();

                r.Read();

                int    CampingSpotID = Convert.ToInt32(r["CAMPINGSPOTID"]);
                string CAMPSPOT      = Convert.ToString(r["CAMPSPOT"]);
                int    day           = Convert.ToInt32(r["CAMPDAY"]);
                //  string rfid = r["RFID"].ToString();

                int     NumberofParticipants = Convert.ToInt32(r["NUMBEROFPARTICIPANTS"]);
                decimal Price = Convert.ToDecimal(r["PRICE"]);
                //     string email = r["EMAIL"].ToString();

                int isavailabe = Convert.ToInt32(r["ISAVAILABLE"]);

                //bool isavailabel;

                //if (r["ISAVAILABLE"].ToString() == "NO")
                //{
                //    isavailabel = false;
                //}
                //else
                //{// YES
                //    isavailabel = true;
                //}
                int HASPAID = Convert.ToInt32(r["HASPAID"]);
                //bool HASPAID;
                //if (r["HASPAID"].ToString() == "NO")
                //{
                //    HASPAID = false;
                //}
                //else
                //{// YES
                //    HASPAID = true;
                //}



                return(CampingSpot = new CampingSpot(CampingSpotID, CAMPSPOT, day, isavailabe, NumberofParticipants, Price, HASPAID));
            }
            catch
            {
                MessageBox.Show("Error occurred.");
            }
            finally
            {
                connection.Close();
            }

            return(CampingSpot); // no visitor found.
        }
Ejemplo n.º 2
0
        //private string GiveRFID(Visitor visitor, string RFIDTagNr)
        //{
        //    bool updated = visitordata.UpdateRFIDStatus(/*visitor,*/ RFIDTagNr);

        //    if (updated)
        //    {
        //        return "Allowed to enter into Event.";
        //    }
        //    else
        //    {
        //        return "The visitor is already inside the spot!";
        //    }
        //}

        private void btnProcess_Click(object sender, EventArgs e)
        {
            if (tbspotID.Text != "")
            {
                lbRFIDStatus.Text = "";
                lbWarning.Text    = "";
                lbGreetings.Text  = "";

                phidget.RFID.Tag += new RFIDTagEventHandler(AssignARFID);
                CampingSpot spot = CheckForSpotID();
                int         paymentStatus;

                if (spot != null)
                {
                    lbWarning.Text   = "The visitor has made a reserveration.";
                    lbGreetings.Text = "Welcome to VestroVestival campingSpot ";
                    lbday.Text       = "Visitor has made the reservation for\n" + spot.day + " day(s)";
                    paymentStatus    = CheckPaymentStatus(spot);

                    if (RFIDTagNr != null)
                    {
                        lbGreetings.Text = "had a Rfid already";
                        lbWarning.Text   = "";
                    }
                    else
                    {
                        lbRFIDStatus.Text = "";
                    }
                }
            }
        }
Ejemplo n.º 3
0
        //private string GiveRFID(Visitor visitor, string RFIDTagNr)
        //{
        //    bool updated = visitordata.UpdateRFIDStatus(/*visitor,*/ RFIDTagNr);

        //    if (updated)
        //    {
        //        return "Allowed to enter into Event.";
        //    }
        //    else
        //    {
        //        return "The visitor is already inside the spot!";
        //    }
        //}

        private void btnProcess_Click(object sender, EventArgs e)
        {
            if (tbspotID.Text != "")
            {
                lbRFIDStatus.Text = "";
                lbWarning.Text    = "";
                lbGreetings.Text  = "";

                phidget.RFID.Tag += new RFIDTagEventHandler(AssignARFID);
                CampingSpot spot = CheckForSpotID();
                bool        paymentStatus;

                if (spot != null)
                {
                    lbWarning.Text   = "The visitor has made a reserveration.";
                    lbGreetings.Text = "Welcome to VestroVestival campingSpot ";
                    paymentStatus    = CheckPaymentStatus(spot);
                    if (paymentStatus)
                    {
                        if (RFIDTagNr != null)
                        {
                            lbGreetings.Text = "had a Rfid already";
                            lbWarning.Text   = "";
                        }
                        else
                        {
                            lbRFIDStatus.Text = "Scan an RFID .";
                        }
                    }
                    else
                    {
                        lbWarning.Text = "The campingSpot fee is pending or not paid yet!";
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private bool CheckPaymentStatus(CampingSpot spot)
 {
     return(spot.HasPaid);
 }