예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            lb.username = username.Text.Trim();
            lb.password = password.Text.Trim();
            lb.usertype = userType.Text.Trim();

            bool success = ld.loginCheck(lb);

            if (success == true)
            {
                try
                {
                    AdminDashboard adm = new AdminDashboard();
                    adm.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error");
                    clear();
                }
            }
            else
            {
                MessageBox.Show("Please enter valid login details");
                clear();
            }
        }
예제 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //write the code to login
            //get the username and password
            l.username = textBoxUsername.Text;
            l.password = textBoxPassword.Text;

            //check the login credentials
            bool isSuccess = dal.loginCheck(l);

            //check if the login was success
            if (isSuccess == true)
            {
                //login success
                MessageBox.Show("Login successful.");

                //save the username in loggedInUser method
                loggedInUser = l.username;

                //display home form
                frameHome home = new frameHome();
                home.Show();
                this.Hide();
            }
            else
            {
                //login failed
                MessageBox.Show("Login failed.");
            }
        }
예제 #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUserName.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUsertype.Text.Trim();

            bool issuccess = dal.loginCheck(l);

            if (issuccess == true)
            {
                Mymessage msg = new Mymessage("Logged In Successfull!");
                msg.Show();
                loggedInUser = txtUserName.Text;
                if (cmbUsertype.Text.Trim() == "admin")
                {
                    AdminDashboard adminDashboard = new AdminDashboard();
                    adminDashboard.Show();
                }
                else
                {
                    UserDashboard userDashboard = new UserDashboard();
                    userDashboard.Show();
                }
            }
            else
            {
                Mymessage mymessage = new Mymessage("Login Failed");
                mymessage.Show();
            }
        }
예제 #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //Write the Code to Login our Application
            //1. Get the username and password from login form
            l.username = txtUsername.Text;
            l.password = txtPassword.Text;

            //Check the Login Credentials
            bool isSuccess = dal.loginCheck(l);

            //Check whehter the login is success or not
            //If login is success then isSuccess will be true else it will be false
            if (isSuccess == true)
            {
                //Login Success
                //Display Success Message
                MessageBox.Show("Login Successful.");

                //Save the username in loggedInuser Stattic MEthod
                loggedInUser = l.username;

                //Display home Form
                frmHome home = new frmHome();
                home.Show();
                this.Hide(); //To CLose Login Form
            }
            else
            {
                //Login Failed
                //Display the Error Message
                MessageBox.Show("Login Failed. Try Again.");
            }
        }
예제 #5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text == "high" || txtPassword.Text == "high") // This line of Code Is added by me for automatic login .
            {
                frmAdminDashboard high = new frmAdminDashboard();
                high.Show();

                this.Hide();
            }                                                              //And it End here
            // else
            // {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            //Checking the user credential
            bool success = dal.loginCheck(l);

            if (success == true)
            {
                //Login successfull
                MessageBox.Show("Login successful.");
                loggedIn = l.username;
                //Need to open respective form base on user_type
                switch (l.user_type)
                {
                case "Admin":
                {
                    // Display Admin Dashboard
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    // Display User Dashboard
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    // Display an error message
                    MessageBox.Show("Invalid User Type");
                }
                break;
                }
            }
            else
            {
                //Login failed
                MessageBox.Show("Login Failed. Try Again");
            }
            // }
        }
예제 #6
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUserName.Text.Trim();
            l.password  = txtPasword.Text.Trim();
            l.user_type = cmbUserType.selectedValue.Trim();

            bool success = dal.loginCheck(l);

            if (success == true)
            {
                loggedIn = l.username;
                switch (l.user_type)
                {
                case "Admin":
                {
                    rfmAdminDashboard admin = new rfmAdminDashboard();
                    admin.adlg = this;
                    admin.Show();
                    this.Hide();
                }
                break;

                case "Cashier":
                {
                    frmUserDashboard user = new frmUserDashboard();
                    user.uslg = this;
                    user.Show();
                    this.Hide();
                }
                break;

                case "StoreKeeper":
                {
                    frmStKeeperDashboard stk = new frmStKeeperDashboard();
                    stk.stlg = this;
                    stk.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MassageBox mb = new MassageBox("Invalid User Type", MsgType.clear);
                    mb.Show();
                    //MessageBox.Show("Invalid User Type!!!");
                }
                break;
                }
            }
            else
            {
                MassageBox mb = new MassageBox("Login Failed\nRetry", MsgType.retry);
                mb.Show();
                //MessageBox.Show("Login Fail !!!....Try Again");
            }
        }
예제 #7
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUserName.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            // checking the login credentials

            bool success = dal.loginCheck(l);

            if (success == true)
            {
                //loging Successful
                MessageBox.Show("Login Successful");

                // here we will refer that logged in User. we need to display this in admin dashboard also.
                loggedIn = l.username;


                // Need to open respective form
                switch (l.user_type)
                {
                case "Admin":
                    // this Admin should be Same spelling as Admin in Our Design of Combo Box
                {
                    // Display Admin Dashboard
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    // Display User Dashboard
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    //Display an error message
                    MessageBox.Show("Invalid User Type. Neither Admin Nor User");
                }
                break;
                }
            }
            else
            {
                //login Failed
                MessageBox.Show("Login Failed and Not-Successful. Please Try Again");
            }
        }
예제 #8
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text == "" || txtPassword.Text == "" || cmbUserType.Text == "")
            {
                MessageBox.Show("Please enter complete information");
            }
            else
            {
                l.username  = txtUsername.Text.Trim();
                l.password  = txtPassword.Text.Trim();
                l.user_type = cmbUserType.Text.Trim();

                //Checking the login credentials
                bool sucess = dal.loginCheck(l);
                if (sucess == true)
                {
                    //Login Successfull
                    MessageBox.Show("Login Successful.");
                    loggedIn = l.username;
                    //Need to open Respective Forms based on User Type
                    switch (l.user_type)
                    {
                    case "Admin":
                    {
                        //Display Admin Dashboard
                        frmAdminDashboard admin = new frmAdminDashboard();
                        admin.Show();
                        this.Hide();
                    }
                    break;

                    case "User":
                    {
                        //Display User Dashboard
                        frmUserDashboard user = new frmUserDashboard();
                        user.Show();
                        this.Hide();
                    }
                    break;

                    default:
                    {
                        //Display an error message
                        MessageBox.Show("Invalid User Type.");
                    }
                    break;
                    }
                }
                else
                {
                    //login Failed
                    MessageBox.Show("Login Failed. Try Again");
                }
            }
        }
예제 #9
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            //checking the login credentials
            bool success = dal.loginCheck(l);

            if (success == true)
            {
                //login successfull
                MessageBox.Show("Login successfull! ");
                loggedIn = l.username;

                //need to open respective form based on user type

                switch (l.user_type)
                {
                case "Admin":
                {
                    //display admin dashboard
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    //display user dashboard
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    //display error message
                    MessageBox.Show("Invalid user type!");
                }
                break;
                }
            }
            else
            {
                //login failed
                MessageBox.Show("Login failed! Try again!");
            }
        }
예제 #10
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            //Checking login Credentials
            bool sucess = dal.loginCheck(l);

            if (sucess == true)
            {
                //Login Sucessful
                MessageBox.Show("Login Successful.");
                //for username
                loggedIn = l.username;
                //Open respective form based on user_type
                switch (l.user_type)
                {
                case "Admin":
                {
                    //Display admin Dashboard
                    FirmAdminDashboard admin = new FirmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    //Display User Dashboard
                    firmUserDashboard user = new firmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    //Display an error Message
                    MessageBox.Show("Invalid User Type.");
                }
                break;
                }
            }
            else
            {
                //Login Failed
                MessageBox.Show("Login Failed. Please Try again.");
            }
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            //Checking the login credentials
            bool success = dal.loginCheck(l);

            if (success == true)
            {
                MessageBox.Show("Login Successfull");
                loggedIn = l.username;

                //Need to open forms based on usertype
                switch (l.user_type)
                {
                case "Admin":
                {
                    AdminDashboard admin = new AdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    UserDashboard user = new UserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MessageBox.Show("Invalid User Type");
                }
                break;
                }
            }
            else
            {
                MessageBox.Show("Login Failed.Try again");
            }
        }
예제 #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            l.username  = txtUser.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            bool success = dal.loginCheck(l);

            if (success == true)
            {
                MessageBox.Show("login Succesfull");
                loggedIn = l.username;
                //open Respective forms based on user type
                switch (l.user_type)
                {
                case "Admin":
                {
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MessageBox.Show("Invalid user type");
                }
                break;
                }
            }

            else
            {
                MessageBox.Show("Login Failed. Try again");
            }
        }
예제 #13
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            bool success = dal.loginCheck(l);

            if (success == true)
            {
                MessageBox.Show("Login Successfull.");
                loggedIn = l.username;

                switch (l.user_type)
                {
                case "Admin":
                {
                    AdminDashboard admin = new AdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    UserDashboard user = new UserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MessageBox.Show("Invalid user type!");
                }
                break;
                }
            }
            else
            {
                MessageBox.Show("Login failed. Try again!!");
            }
        }
예제 #14
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (IsValidLoginInfo())
            {
                bool success = dal.loginCheck(txtEmail.Text.Trim(), txtPassword.Text.Trim());
                if (success == true)
                {
                    // MessageBox.Show("Login Successful.");

                    this.Hide();
                    frmMain obj = new frmMain();
                    obj.Show();
                }
                else
                {
                    MessageBox.Show(@"Email/Password is Wrong.Try Again..!");
                }
            }
        }
예제 #15
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtusername.Text.Trim();
            l.password  = txtsenha.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            bool Success = dal.loginCheck(l);

            if (Success == true)
            {
                MessageBox.Show("ACESSO PERMITIDO");
                loggedIn = l.username;
                switch (l.user_type)
                {
                case "Administrador":
                {
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "Usuario":
                {
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MessageBox.Show("FAVOR CONFERIR USUÁRIO E SENHA");
                }
                break;
                }
            }
            else
            {
                MessageBox.Show("NÃO FOI POSSÍVEL CADASTRAR USUARIO");
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            l.username  = textBox1.Text.Trim();
            l.password  = textBox2.Text.Trim();
            l.user_type = comboBox1.Text.Trim();
            bool success = dal.loginCheck(l);

            if (success == true)
            {
                MessageBox.Show(" Login Succesfull..!! ");
                //need to code what happen when login is sucesffull
                loggedIn = l.username;

                switch (l.user_type)
                {
                case "Admin":
                {
                    //show admin dashboard
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                } break;

                case "User":
                {
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                } break;

                default:
                {
                    // display un error message
                    MessageBox.Show("Invalid user type ");
                } break;
                }
            }
            else
            {
                MessageBox.Show(" Login Failed ..!! ");
            }
        }
예제 #17
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();
            bool sucess = dal.loginCheck(l);

            if (sucess == true)
            {
                MessageBox.Show("ลงชื่อเข้าใช้งานสำเร็จ!");
                loggedIn = l.username;
                switch (l.user_type)
                {
                case "Admin":
                {
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MessageBox.Show("กรุณาเลือกชนิดของผู้ใช้งาน!");
                }
                break;
                }
            }
            else
            {
                MessageBox.Show("ไม่สามารถลงชื่อเข้าใช้งานได้! กรุณาลองอีกครั้ง");
            }
        }
예제 #18
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUserName.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();

            bool sucess = dal.loginCheck(l);

            MessageBox.Show(sucess ? "Login dul i suksesshum" : "Login deshtoi. Provo serish");
            if (sucess)
            {
                loggedIn = l.username;

                switch (l.user_type)
                {
                case "Admin":
                {
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    UserDashBoard user = new UserDashBoard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                    MessageBox.Show("User Type nuk eshte valid");
                    break;
                }
            }
        }
예제 #19
0
파일: fLogin.cs 프로젝트: kylelw23/WabiSabi
        private void btnLogin_Click(object sender, EventArgs e)
        {
            loginBLL.username = txbUsername.Text.Trim();
            loginBLL.password = txbPassword.Text.Trim();

            //Checking the login credentials
            int success = loginDAL.loginCheck(loginBLL);

            if (success == 1)
            {
                //login success
                MessageBox.Show("Đăng nhập thành công. Loại tài khoản quản trị");
                logged_in = loginBLL.username;
                //Need to open Respecive Forms based on user type
                fAdminDashboard admin = new fAdminDashboard();
                this.Hide();
                admin.ShowDialog();
                this.Show();
            }
            else if (success == 2)
            {
                MessageBox.Show("Đăng nhập thành công. Loại tài khoản nhân viên");
                //Need to open Respecive Forms based on user type
                logged_in = loginBLL.username;
                fUserDashBoard admin = new fUserDashBoard();

                this.Hide();
                admin.ShowDialog();
                this.Show();
            }
            else
            {
                // login fail
                MessageBox.Show("Đăng nhập thất bại. Xin vui lòng thử lại!");
            }
        }
예제 #20
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            #region Throw Error Message

            if (txtUsername.Text == "" && txtPassword.Text == "" && cmbUserType.Text == "")
            {
                MessageBox.Show(" Please Fill All The Details..... !! ");
            }

            else if (txtPassword.Text == "" && cmbUserType.Text == "")
            {
                MessageBox.Show(" Please Enter Passsword & Select UserType ... !! ");
            }

            else if (txtUsername.Text == "")
            {
                MessageBox.Show(" Please Enter Username.... !! ");
            }

            else if (txtPassword.Text == "")
            {
                MessageBox.Show(" Please Enter Password ... !! ");
            }

            else if (cmbUserType.Text == "")
            {
                MessageBox.Show(" Please Select Usertype ... !! ");
            }

            #endregion

            else
            {
                l.username  = txtUsername.Text.Trim();
                l.password  = txtPassword.Text.Trim();
                l.user_type = cmbUserType.Text.Trim();

                //Checking the login credentials
                bool success = dal.loginCheck(l);
                if (success == true)
                {
                    MessageBox.Show("Login Successfull");
                    loggedIn = l.username;

                    //Need to open forms based on usertype
                    switch (l.user_type)
                    {
                    case "Admin":
                    {
                        AdminDashboard admin = new AdminDashboard();
                        admin.Show();
                        this.Hide();
                    }
                    break;

                    case "User":
                    {
                        UserDashboard user = new UserDashboard();
                        user.Show();
                        this.Hide();
                    }
                    break;

                    default:
                    {
                        MessageBox.Show("Invalid User Type");
                    }
                    break;
                    }
                }
                else
                {
                    MessageBox.Show("Login Failed.Try again");
                }
            }
        }
예제 #21
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            var username = tbUsername.Text.Trim();
            var password = tbPassword.Text.Trim();
            var userType = cbUserType.Text.Trim();

            l.userName = username;
            l.password = password;
            l.userType = userType;

            /*Validate input at the application level*/

            if (username == "")
            {
                String theusername = String.Empty;
                MessageBox.Show("The Users' Name is required");
            }
            else if (password == "")
            {
                String thepassword = String.Empty;
                MessageBox.Show("The Password is required");
            }
            else if (userType == "")
            {
                String theuserType = String.Empty;
                MessageBox.Show("The UserType is required");
            }
            else
            {
                bool success = d.loginCheck(l);
                //open respective dashboard based on user type
                if (success == true)
                {
                    loggedIn = username;
                    //Open the forms based on the usertype selected
                    switch (l.userType)
                    {
                    case "Admin":
                    { adminDashBoard admin = new adminDashBoard();
                      admin.Show();
                      MessageBox.Show($"Welcome {username}");
                      this.Hide(); }
                      break;

                    case "Staff":
                    {
                        userDashBoard user = new userDashBoard();
                        user.Show();
                        MessageBox.Show($"Welcome {username}");
                        this.Hide();
                    }
                    break;

                        /*
                         * default:
                         * {
                         *  //Display Error message
                         *  MessageBox.Show("Please choose userType");
                         * }
                         * break;
                         */
                    }
                }
                else
                {
                    this.Show();
                    MessageBox.Show("Invalid Credentials. Please try again");
                }
            }
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cmbUserType.Text.Trim();
            DataTable dt = new DataTable();

            //Checking the login credentials
            dt = dal.loginCheck(l);
            bool isSuccess;

            //Checking The rows in DataTable
            if (dt.Rows.Count > 0)
            {
                //Login Sucessful
                isSuccess = true;
            }
            else
            {
                //Login Failed
                isSuccess = false;
            }
            if (isSuccess == true)
            {
                //Login Successfull
                MessageBox.Show("Login Successful.");
                loggedIn = l.username;
                branchId = dt.Rows[0]["BranchId"].ToString();
                //Need to open Respective Forms based on User Type
                switch (l.user_type)
                {
                case "Admin":
                {
                    //Display Admin Dashboard

                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    //Display User Dashboard
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    //Display an error message
                    MessageBox.Show("Invalid User Type.");
                }
                break;
                }
            }
            else
            {
                //login Failed
                MessageBox.Show("Login Failed. Try Again");
            }
        }