コード例 #1
0
 private void btn_create_user_Click(object sender, EventArgs e)
 {
     panel_add_edit_user.Show();
     if (listview_users.SelectedItems.Count == 1)
     {
         User selectedUser = user_service.GetUser(listview_users.SelectedItems[0].SubItems[1].Text);
         //fill text box with listview data
         lbl_user_management_original_email.Text = listview_users.SelectedItems[0].SubItems[1].Text;
         txtbox_user_management_email.Text       = listview_users.SelectedItems[0].SubItems[1].Text;
         txtbox_user_management_name.Text        = listview_users.SelectedItems[0].SubItems[2].Text;
         //get password from database beceause not stored in listview
         txtbox_user_management_password.Text = selectedUser.Password;
         txtbox_user_management_status.Text   = listview_users.SelectedItems[0].SubItems[3].Text;
         //user is selected for edit, so add not allowed
         btn_user_management_add.Enabled = false;
     }
     else if (listview_users.SelectedItems.Count > 1)
     {
         MessageBox.Show("Oops, you are not able to edit multiple users at the same time. please make sure you have one user selected.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         btn_user_management_edit.Enabled = false;
     }
 }
コード例 #2
0
        private void btn_tableOverview_Click(object sender, EventArgs e)
        {
            User_Service     userService = new User_Service();
            Employee         user        = userService.GetUser(lbl_UserName.Text);
            TablesOverviewUI overview    = new TablesOverviewUI(user);

            Hide();
            overview.ShowDialog();
        }
コード例 #3
0
ファイル: TablesOverviewUI.cs プロジェクト: shukerb/Chapeau
        // this is only available for user type Manager
        private void btn_Back_Click(object sender, EventArgs e)
        {
            User_Service userService = new User_Service();
            Employee     user        = userService.GetUser(lbl_UserName.Text);
            ManagerUI    manager     = new ManagerUI(user);

            Hide();
            manager.ShowDialog();
        }
コード例 #4
0
ファイル: LoginForm.cs プロジェクト: shukerb/Chapeau
        private void btn_Login_Click(object sender, EventArgs e)
        {
            User_Service userService = new User_Service();

            if (txt_Name.Text == "" || txt_Password.Text == "")
            {
                MessageBox.Show("Please enter Name and Password");
            }
            else
            {
                user = userService.GetUser(txt_Name.Text);
                bool logedIn = false;
                if (user.Name == txt_Name.Text.ToUpper() && user.Password == int.Parse(txt_Password.Text))
                {
                    logedIn = true;
                    Hide();
                    //here to decide to where you want to go depending on the position of the user
                    // user types are MANAGER, WAITER any extra still need to be added.
                    if (user.Position == Enum_Employee.Waiter)
                    {
                        TablesOverviewUI overview = new TablesOverviewUI(user);
                        overview.ShowDialog();
                    }
                    else if (user.Position == Enum_Employee.Manager)
                    {
                        ManagerUI overview = new ManagerUI(user);
                        overview.ShowDialog();
                    }
                    else if (user.Position == Enum_Employee.Chef)
                    {
                        OrderList kitchen = new OrderList("Kitchen");
                        kitchen.Text = "Kitchen Order List";
                        kitchen.ShowDialog();
                    }
                    else if (user.Position == Enum_Employee.Barman)
                    {
                        OrderList bar = new OrderList("Bar");
                        bar.Text = "Bar Order List";
                        bar.ShowDialog();
                    }
                    Close();
                }
                if (!logedIn)
                {
                    MessageBox.Show("Username or password is not correct please try again!");
                }
            }
        }