Ejemplo n.º 1
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (checkTextBox())
            {
                if (checkUserActive())
                {
                    gutil.saveSystemDebugLog(0, "USER = "******" IS ACTIVE");
                    if (checkUserNamePassword())
                    {
                        this.Hide();

                        selectedUserGroupID = getUserGroupID();

                        gutil.setUserID(selectedUserID);
                        gutil.setUserGroupID(selectedUserGroupID);

                        gutil.saveSystemDebugLog(0, "USER ID = " + selectedUserID + " LOGIN SUCCESSFULLY");
                        gutil.saveUserChangeLog(0, globalConstants.CHANGE_LOG_LOGIN, "USER LOGIN FROM LOGIN FORM");

                        if (gutil.userIsCashier() == 1)
                        {
                            cashierLoginForm newCashierForm = new cashierLoginForm(0);
                            gutil.saveSystemDebugLog(0, "DISPLAY CASHIER LOGIN FORM");
                            newCashierForm.ShowDialog(this);
                        }
                        else
                        { 
                            adminForm displayAdminForm = new adminForm(selectedUserID, selectedUserGroupID);
                            gutil.saveSystemDebugLog(0, "DISPLAY ADMIN FORM");
                            displayAdminForm.ShowDialog(this);
                        }

                        gutil.saveSystemDebugLog(0, "USER ID = " + selectedUserID + "LOGOUT");
                        gutil.saveUserChangeLog(0, globalConstants.CHANGE_LOG_LOGOUT, "USER LOGOUT");

                        //logoutForm displayLogOutForm = new logoutForm();
                        //displayLogOutForm.ShowDialog(this);

                        userNameTextBox.Text = "";
                        passwordTextBox.Text = "";
                        errorLabel.Text = "";
                        
                        this.Show();

                        userNameTextBox.Focus();
                    }
                    else
                    {
                        errorLabel.Text = "LOGIN FAILED." + Environment.NewLine + "Please check username or password!";
                    }
                }
                else
                {
                    errorLabel.Text = "USER NON ACTIVE." + Environment.NewLine + "Please contact Administrator!";
                }
            }
            else
            {
                errorLabel.Text = "INPUT ERROR";
            }
        }
Ejemplo n.º 2
0
        private void continueButton_Click(object sender, EventArgs e)
        {
            if (saveData())
            { 
                this.Hide();

                gUtil.saveUserChangeLog(0, globalConstants.CHANGE_LOG_CASHIER_LOGIN, "CASHIER LOGIN");

                if (loginState == 0 || loginState == 2)
                {
                    adminForm displayAdminForm = new adminForm(gUtil.getUserID(), gUtil.getUserGroupID());
                    displayAdminForm.ShowDialog(this);
                }

                if (loginState != 1)
                {
                    loginState = 1;

                    loadLogData();

                    endAmountBox.Focus();
                    this.Show();
                }
                else
                {
                    gUtil.saveUserChangeLog(0, globalConstants.CHANGE_LOG_CASHIER_LOGOUT, "CASHIER LOGOUT");
                    this.Close();
                }

            }
        }