public static List<AttendanceConfirmation> GetAll(string staffUsername, int? eventId,
           bool ShowWithEventDatesOnly)
        {
            List<AttendanceConfirmation> unfiltered = new List<AttendanceConfirmation>();
             using (SqlConnection conn = UtilityDb.GetConnectionESS())
             {
            string sql = "SELECT * FROM REQ_AttendanceToConfirm";
            bool hasUsername = !String.IsNullOrEmpty(staffUsername);
            bool hasEventId = eventId.HasValue;
            if (hasUsername || hasEventId)
               sql += " WHERE ";
            if (hasUsername)
               sql += "UPPER(StaffUsername)='" + staffUsername.ToUpper() + "' ";
            if (hasUsername && hasEventId)
               sql += " AND ";
            if (hasEventId)
               sql += "EventID=" + eventId.Value.ToString() + " ";

            SqlDataReader dr = UtilityDb.GetDataReader(sql, conn);

            while (dr.Read())
            {
               AttendanceConfirmation ac = new AttendanceConfirmation();
               ac.LoadFromReader(dr);

               unfiltered.Add(ac);
            }
            dr.Close();
             }

             // retrieve data objects
             List<AttendanceConfirmation> output = new List<AttendanceConfirmation>();
             foreach (AttendanceConfirmation ac in unfiltered)
             {
            if (ShowWithEventDatesOnly)
            {
               ac.LoadDataObjects();
               if (ac.PrebookedEvent.EventDates.Count > 0)
                  output.Add(ac);
            }
            else
            {
               ac.LoadDataObjects();
               output.Add(ac);
            }
             }

             return output;
        }
        public static AttendanceConfirmation GetFromEventTypeID(string staffUsername, int? eventId)
        {
            using (SqlConnection conn = UtilityDb.GetConnectionESS())
             {

            string sql = "SELECT * FROM REQ_AttendanceToConfirm";
            bool hasUsername = !String.IsNullOrEmpty(staffUsername);
            bool hasEventId = eventId.HasValue;
            if (hasUsername || hasEventId)
               sql += " WHERE ";
            if (hasUsername)
               sql += "UPPER(StaffUsername)='" + staffUsername.ToUpper() + "' ";
            if (hasUsername && hasEventId)
               sql += " AND ";
            if (hasEventId)
               sql += "EventID=" + eventId.Value.ToString() + " ";
            using (SqlDataReader dr = UtilityDb.GetDataReader(sql, conn))
            {
               while (dr.Read())
               {
                  AttendanceConfirmation output = new AttendanceConfirmation();
                  output.LoadFromReader(dr);
                  return output;
               }
            }
             }
             return null;
        }