private void StartUp()
        {
            LbNotReturned.Items.Clear();
            LbInfoReturned.Items.Clear();
            try
            {
                foreach (string item in SQLItemsControl.GetProductLoanersReturned())
                {
                    LbInfoReturned.Items.Add(item).ToString();
                }

                foreach (string item in SQLItemsControl.GetProductLoanersNotReturned())
                {
                    LbNotReturned.Items.Add(item).ToString();
                }
            }
            catch (MySqlException)
            {
                MessageBox.Show("Database problem");
                SQLItemsControl.Disconnect();
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong");
                SQLItemsControl.Disconnect();
            }
        }
        private void BtnCheck_Click(object sender, EventArgs e)
        {
            int UserID = Convert.ToInt32(tBUserId.Text);

            try
            {
                LbEvenstatus.Text    = sqlVisitorControl.GetVisitorEventStatus(UserID);
                LbFirstName.Text     = sqlVisitorControl.GetVisitorFirstName(UserID);
                LbLastName.Text      = sqlVisitorControl.GetVisitorLastName(UserID);
                LbBalance.Text       = sqlVisitorControl.GetVisitorBalance(UserID);
                LbCampingStatus.Text = sqlVisitorControl.GetVisitorCampingStatus(UserID);
                LbBuy.Text           = Convert.ToString(sqlVisitorControl.GetSpecificPersonNumberOfProduct(UserID));
                LbProductLoaned.Text = Convert.ToString(sqlVisitorControl.GetSpecificPersonNumberOfLoaned(UserID));

                LbVisitorHistory.Items.Clear();
                foreach (string item in sqlVisitorControl.GetProductSpecificUserBuy(UserID))
                {
                    LbVisitorHistory.Items.Add(item);
                }
                foreach (string item in sqlVisitorControl.GetProductSpecificUserLoaned(UserID))
                {
                    LbVisitorHistory.Items.Add(item);
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Please type User ID ");
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Please type User ID ");
            }
            catch (MySqlException)
            {
                MessageBox.Show("Something went wrong");
            }
            catch (InvalidCastException)
            {
                LbVisitorHistory.Items.Clear();
                LbEvenstatus.Text    = "";
                LbFirstName.Text     = "";
                LbLastName.Text      = "";
                LbBalance.Text       = "";
                LbCampingStatus.Text = "";
                LbBuy.Text           = "";
                LbProductLoaned.Text = "";
                MessageBox.Show("User didnt checked yet and dont have a Rfid");
                sqlVisitorControl.Disconnect();
                LbVisitorHistory.Items.Clear();
            }
        }
Beispiel #3
0
        private void btnCheck_Click(object sender, EventArgs e)
        {
            int CampID = Convert.ToInt32(tBCampID.Text);

            try
            {
                LbStartDate.Text = sqlControl.GetStardDateOfCamping(CampID);
                LbEndDate.Text   = sqlControl.GetEndDateOfCamping(CampID);
                int AvailableSpots = 6 - sqlControl.NumberOfBookedSpots(CampID);
                LbSpotsAvailable.Text = Convert.ToString(AvailableSpots);
                LbCampInfo.Items.Clear();
                foreach (string item in sqlControl.GetUserFirstNameCamping(CampID))
                {
                    LbCampInfo.Items.Add(item);
                }
            }
            catch (MySqlException)
            {
                LbStartDate.Text      = "";
                LbEndDate.Text        = "";
                LbSpotsAvailable.Text = "";
                LbCampInfo.Items.Clear();

                MessageBox.Show("Camp id " + CampID.ToString() + " has no bookings");
                sqlControl.Disconnect();
            }
            catch (NullReferenceException)
            {
                LbStartDate.Text      = "";
                LbEndDate.Text        = "";
                LbSpotsAvailable.Text = "";
                LbCampInfo.Items.Clear();
                sqlControl.Disconnect();
                MessageBox.Show("Please type a correct Camp ID");
                sqlControl.Disconnect();
            }
            catch (FormatException)
            {
                LbStartDate.Text      = "";
                LbEndDate.Text        = "";
                LbSpotsAvailable.Text = "";
                LbCampInfo.Items.Clear();
                sqlControl.Disconnect();
                MessageBox.Show("Please type a correct Camp ID");
                sqlControl.Disconnect();
            }
        }