예제 #1
0
        /// <summary>
        /// Returns a GroupMember object if it exists in the databse otherwise it returns a null. If the 
        /// email exists in the database as in the GroupMember table in database the method will return a GroupMember 
        /// object otherwise it will return an empty GroupMember object.
        /// </summary>
        /// <param >int CampResNo</param>
        /// <returns>List of GroupMemeber</returns>
        public GroupMember GetGroupMembers(string coEmail)
        {
            GroupMember selectedMember = null;
            EventAccountDataHelper groupMembergetter = new EventAccountDataHelper();
            //selectedMember=groupMembergetter
            String sql = String.Format("SELECT * FROM GROUPMEMBERS WHERE Co_email='{0}'",coEmail);
            MySqlCommand command = new MySqlCommand(sql, connection);
            try
            {
                connection.Open();
                MySqlDataReader reader = command.ExecuteReader();

                int groupId; string coEMail; int campResNo; bool checkIn;

                while (reader.Read())
                {
                    coEMail = Convert.ToString(reader["Co_email"]);
                    campResNo = Convert.ToInt32(reader["CampRes_No"]);
                    checkIn = Convert.ToBoolean(reader["Check_in"]);

                    selectedMember = new GroupMember(coEMail, campResNo);
                    selectedMember.CheckIn = checkIn;
                }
            }
            catch { MessageBox.Show("error while loading from database."); }
            finally { connection.Close(); }
            return selectedMember;
        }
예제 #2
0
        //DataGridViewRow newrow = new DataGridViewRow();
        private void ChangeTagOnForm(object sender, TagEventArgs e)
        {
            label20.Text = phidgetScanner.RFIDtagNr;
            if (phidgetScanner.RFIDtagNr != null)
            {
                rfid = phidgetScanner.RFIDtagNr;
                currentAccount = accountHelper.GetEventAccountFromRFID(rfid);
                if (currentAccount != null)
                {
                    eID = accountHelper.GetEventIdFromRFID(rfid);
                    email = accountHelper.GetAccountEmailFromRFID(rfid);
                    if (email != "")
                    {
                        scannedMember = groupHelper.GetGroupMembers(email);
                        if (scannedMember != null)
                        { reservation = campDatHelper.GetCampRes(scannedMember.CampResNo); }
                    }

                    if (reservation != null)
                    {
                        DataGridViewRow newrow = new DataGridViewRow();
                        //try
                        //{
                            newrow.CreateCells(dataGridView1);
                            newrow.Cells[0].Value = scannedMember.CampResNo;
                            newrow.Cells[1].Value = reservation.EndDate;
                            newrow.Cells[2].Value = reservation.StartDate;
                            newrow.Cells[3].Value = reservation.CampId;
                            newrow.Cells[4].Value = scannedMember.Co_Email;
                            newrow.Cells[5].Value = eID;
                            newrow.Cells[6].Value = scannedMember.CheckIn;
                            dataGridView1.Rows.Clear();
                            dataGridView1.Rows.Add(newrow);
                            //row++;
                        //}
                        //catch { MessageBox.Show("This reservation information is already displayed."); }
                    }
                    else { MessageBox.Show("This accountId does not have a camping reservation."); }
                }
                else { MessageBox.Show("The scanned RFID code does not exist in database."); }
            }
        }