public void Attend_Click(Button ab)
		{
			Program.TimerReset();
			var c = list[(int)ab.Tag];
			if (c.lastpress.HasValue && DateTime.Now.Subtract(c.lastpress.Value).TotalSeconds < 1)
				return;

			if (c.access == "restricted") {
				Program.attendant.AddHistoryString("-- " + DateTime.Now.ToString("MM-dd-yy hh:mm tt") + " Check-in rejected for " + c.name + " because they are not permitted to use the facility.");
				MessageBox.Show("An access error has occurred. Please check with the attendant.", "Access Error");
				return;
			} else if (c.access == "timer") {
				Program.attendant.AddHistoryString("-- " + DateTime.Now.ToString("MM-dd-yy hh:mm tt") + " Check-in rejected for " + c.name + " because they have logged in recently.");
				MessageBox.Show("An access error has occurred. Please check with the attendant.", "Access Error");
				return;
			} else if (c.access == "true") {
				c.accesstype = 1;
			} else {
				if (c.visitcount < Program.BuildingInfo.maxvisits && Program.addguests == null) {
					MessageBox.Show("Welcome " + c.name + "! This is visit number " + (c.visitcount + 1) + " of " + Program.BuildingInfo.maxvisits + ".", "Guest Information");
					c.accesstype = 2;
				} else {
					if (Program.addguests == null) {
						Program.attendant.AddHistoryString("-- " + DateTime.Now.ToString("MM-dd-yy hh:mm tt") + " Check-in rejected for " + c.name + " because they are not a member.");
						MessageBox.Show("Only members may check-in. You will need to be a guest of a member to check-in.", "Members Only Error");
						return;
					}

					if (Program.BuildingInfo.maxguests > -1) {
						var p = Program.GuestOf();

						if (p != null && Util.GetGuestCount(p.pid) >= Program.BuildingInfo.maxguests) {
							Program.attendant.AddHistoryString("-- " + DateTime.Now.ToString("MM-dd-yy hh:mm tt") + " Check-in rejected for " + c.name + " because " + p.name + " reached the guest limit.");
							MessageBox.Show("No additional guests are permitted for today.", "Guest Limit Error");
							return;
						}

						c.accesstype = 3;
					}
				}
			}

			var pb = Program.attendant.pictureBox1;
			pb.SetPropertyThreadSafe(() => pb.Image, Util.GetImage(c.pid));
			var na = Program.attendant.NameDisplay;
			na.SetPropertyThreadSafe(() => na.Text, c.name);
			var notes = Program.attendant.notes;
			notes.SetPropertyThreadSafe(() => notes.Text, c.notes);

			activities = new BuildingChooseActivities();
			activities.ControlBox = false;
			activities.Tag = ab.Tag;
			activities.StartPosition = FormStartPosition.Manual;
			activities.Location = new Point(Program.baseform.Location.X + 100, Program.baseform.Location.Y + 100);
			activities.Text = "Choose Activities for " + c.name;

			activities.list.Items.Clear();
			foreach (var i in Program.BuildingInfo.Activities)
				activities.list.Items.Add(i);
			activities.ok.Tag = ab;
			activities.cancel.Tag = ab;
			activities.AcceptButton = activities.ok;
			activities.CancelButton = activities.cancel;
			activities.ok.Click += ok_Click;
			activities.cancel.Click += cancel_Click;

			mask = new Label();
			mask.BackColor = BackColor;
			mask.Size = Size;
			//mask.Location = this.Location;
			mask.Parent = this;
			mask.BringToFront();
			var nam = this.Controls[this.Controls.IndexOfKey("name" + ab.Tag.ToString())] as Button;
			var org = this.Controls[this.Controls.IndexOfKey("org" + ab.Tag.ToString())] as Label;
			nam.BringToFront();
			org.BringToFront();

			mask.Show();
			nam.Enabled = false;
			activities.ShowDialog();
			activities.BringToFront();
		}
        public void Attend_Click(Button ab)
        {
            Program.TimerReset();
            var c = list[(int)ab.Tag];

            if (c.lastpress.HasValue && DateTime.Now.Subtract(c.lastpress.Value).TotalSeconds < 1)
            {
                return;
            }

            if (c.access == "restricted")
            {
                Program.attendant.AddHistoryString("-- " + DateTime.Now.ToString("MM-dd-yy hh:mm tt") + " Check-in rejected for " + c.name + " because they are not permitted to use the facility.");
                MessageBox.Show("An access error has occurred. Please check with the attendant.", "Access Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (c.access == "timer")
            {
                Program.attendant.AddHistoryString("-- " + DateTime.Now.ToString("MM-dd-yy hh:mm tt") + " Check-in rejected for " + c.name + " because they have logged in recently.");
                MessageBox.Show("An access error has occurred. Please check with the attendant.", "Access Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (c.access == "true")
            {
                c.accesstype = 1;
            }
            else
            {
                if (c.visitcount < Program.BuildingInfo.maxvisits && Program.addguests == null)
                {
                    MessageBox.Show("Welcome " + c.name + "! This is visit number " + (c.visitcount + 1) + " of " + Program.BuildingInfo.maxvisits + ".", "Guest Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    c.accesstype = 2;
                }
                else
                {
                    if (Program.addguests == null)
                    {
                        Program.attendant.AddHistoryString("-- " + DateTime.Now.ToString("MM-dd-yy hh:mm tt") + " Check-in rejected for " + c.name + " because they are not a member.");
                        MessageBox.Show("Only members may check-in. You will need to be a guest of a member to check-in.", "Members Only", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    if (Program.BuildingInfo.maxguests > -1)
                    {
                        var p = Program.GuestOf();

                        if (p != null && Util.GetGuestCount(p.pid) >= Program.BuildingInfo.maxguests)
                        {
                            Program.attendant.AddHistoryString("-- " + DateTime.Now.ToString("MM-dd-yy hh:mm tt") + " Check-in rejected for " + c.name + " because " + p.name + " reached the guest limit.");
                            MessageBox.Show("No additional guests are permitted for today.", "Guest Limit Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        c.accesstype = 3;
                    }
                }
            }

            var pb = Program.attendant.pictureBox1;

            pb.SetPropertyThreadSafe(() => pb.Image, Util.GetImage(c.pid));
            var na = Program.attendant.NameDisplay;

            na.SetPropertyThreadSafe(() => na.Text, c.name);
            var notes = Program.attendant.notes;

            notes.SetPropertyThreadSafe(() => notes.Text, c.notes);

            activities               = new BuildingChooseActivities();
            activities.ControlBox    = false;
            activities.Tag           = ab.Tag;
            activities.StartPosition = FormStartPosition.Manual;
            activities.Location      = new Point(Program.baseform.Location.X + 100, Program.baseform.Location.Y + 100);
            activities.Text          = "Choose Activities for " + c.name;

            activities.list.Items.Clear();
            foreach (var i in Program.BuildingInfo.Activities)
            {
                activities.list.Items.Add(i);
            }
            activities.ok.Tag        = ab;
            activities.cancel.Tag    = ab;
            activities.AcceptButton  = activities.ok;
            activities.CancelButton  = activities.cancel;
            activities.ok.Click     += ok_Click;
            activities.cancel.Click += cancel_Click;

            mask           = new Label();
            mask.BackColor = BackColor;
            mask.Size      = Size;
            //mask.Location = this.Location;
            mask.Parent = this;
            mask.BringToFront();
            var nam = this.Controls[this.Controls.IndexOfKey("name" + ab.Tag.ToString())] as Button;
            var org = this.Controls[this.Controls.IndexOfKey("org" + ab.Tag.ToString())] as Label;

            nam.BringToFront();
            org.BringToFront();

            mask.Show();
            nam.Enabled = false;
            activities.ShowDialog();
            activities.BringToFront();
        }