Exemplo n.º 1
0
        private void PreviousPage()
        {
            MyBookingsToday previousPage = new MyBookingsToday(PoleSystem);

            this.Hide();
            previousPage.ShowDialog();
            this.Close();
        }
Exemplo n.º 2
0
        // This method checks if the inputs are correct and logs the user in,
        // if that is the case. It also assigns the current users login status
        // to true.
        private void Login()
        {
            string idString    = textBoxMemberID.Text;
            string password    = textBoxPassword.Text;
            bool   LoginStatus = false;
            bool   result      = Int32.TryParse(idString, out int id);

            if (result == false)
            {
                MessageBox.Show("Member ID must be a number");
                textBoxMemberID.Text = "";
                textBoxPassword.Text = "";
            }
            else
            {
                foreach (User u in IPoleSystem.AllUsers)
                {
                    if (id == u.MemberId && password == u.Password)
                    {
                        u.LoginStatus = true;
                        LoginStatus   = true;
                        MyBookingsToday nextPage = new MyBookingsToday(PoleSystem);
                        this.Hide();
                        nextPage.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        u.LoginStatus = false;
                    }
                }
                if (LoginStatus == false)
                {
                    MessageBox.Show("Wrong username or password");
                    textBoxPassword.Text = "";
                }
            }
        }