Пример #1
0
        //function that finds a specific spot by transversing a certain
        //number of times and marks it as taken
        public bool select_spot(int where_to, string the_cust_id)
        {
            //set current equal to the head
            Spot currentS = spothead;
            int  i        = 0;

            //while loop for transversal
            while (currentS != null)
            {
                //check if it is the correct spot
                if (i == where_to)
                {
                    //set the flag to show spot is taken
                    currentS.set_taken(the_cust_id);
                    //remove the spot from list of non hidden spots (make it hidden)
                    this.non_hidden_spots -= 1;
                    return(true);
                }
                else
                {
                    //if the spot isnt flagged, then its still available so add to the
                    //non hidden counter
                    if (currentS.taken == false)
                    {
                        i += 1;
                    }
                    //transverse
                    currentS = currentS.nextspot;
                }
            }

            return(false);
        }
Пример #2
0
        private void Purchase_Button_Click(object sender, EventArgs e)
        {
            Search NewForm = new Search(ActDB, EvtDB, user);

            NewForm.Show();
            NewForm.Left = this.Left;
            NewForm.Top  = this.Top;
            NewForm.Size = this.Size;
            if (EvtDB.check_spot(user.get_email()) == false)
            {
                Spot view = EvtDB.get_holdee_spot(this.label7.Text);
                view.set_taken(user.get_email());
                NewForm.label5.Show();
            }
            else
            {
                NewForm.label7.Show();
            }

            this.Hide();
        }