Пример #1
0
 //Go back button to search page base on user ID type
 private void button1_Click(object sender, EventArgs e)
 {
     if (pid == "AD")
     {
         AdminHomepage adminRestaurant = new AdminHomepage();
         this.Hide();
         adminRestaurant.Closed += (s, args) => this.Close();
         adminRestaurant.Show();
     }
     else if (pid == "US")
     {
         UserHomepage userHomepage = new UserHomepage();
         this.Hide();
         userHomepage.Closed += (s, args) => this.Close();
         userHomepage.Show();
     }
 }
Пример #2
0
        //Login verification Check
        void loginCheck()
        {
            PersonService personService = new PersonService();

            //Check email if exist
            if (personService.GetByEmail(email.Text.ToString()) == "exist")
            {
                //Check password is matched
                if (personService.CheckPassword(password.Text.ToString(), email.Text.ToString()) == "match")
                {
                    //fetch person id
                    String ID = personService.GetID(email.Text.ToString());
                    //Open Admin Homepage
                    if (ID == "AD")
                    {
                        AdminHomepage adminRestaurant = new AdminHomepage();
                        this.Hide();
                        adminRestaurant.Closed += (s, args) => this.Close();
                        adminRestaurant.Show();
                    }
                    //Open User Homepage
                    else
                    {
                        UserHomepage userHomepage = new UserHomepage();
                        this.Hide();
                        userHomepage.Closed += (s, args) => this.Close();
                        userHomepage.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Password Mismatch!!");
                }
            }
            else
            {
                MessageBox.Show("Email does not exist in database");
            }
        }