Example #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            OwnerPage op = new OwnerPage(this.user);

            this.Hide();
            op.Show();
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OwnerPage mp = new OwnerPage(user);

            this.Hide();
            mp.Show();
        }
Example #3
0
        private void loginbutton_Click(object sender, EventArgs e)
        {
            LoginService loginService = new LoginService();

            try
            {
                if (Phonetext.Text == string.Empty || passtext.Text == string.Empty)
                {
                    MessageBox.Show("Username or Password can not be empty.");
                }

                else
                {
                    User ur = new User();
                    ur.Phone    = Convert.ToInt32(Phonetext.Text);
                    ur.Password = passtext.Text;
                    User result = loginService.LoginValidation(ur);
                    if (result.UserType != null)
                    {
                        if (result.UserType == "customer")
                        {
                            CustomerPage cp = new CustomerPage(result);
                            this.Hide();
                            cp.Show();
                        }
                        else if (result.UserType == "salesman")
                        {
                            SalesmanPage sp = new SalesmanPage(result);
                            this.Hide();
                            sp.Show();
                        }
                        else if (result.UserType == "manager")
                        {
                            ManagerPage mp = new ManagerPage(result);
                            this.Hide();
                            mp.Show();
                        }
                        else if (result.UserType == "owner")
                        {
                            OwnerPage op = new OwnerPage();
                            this.Hide();
                            op.Show();
                        }
                        else
                        {
                            MessageBox.Show("User does not exist.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid Username or Password");
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Phone number or Password invalid.");
            }
        }