Example #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.client_id = txtUsername.Text.Trim();
            bool succes = dal.loginCheck(l);

            if (succes == true)
            {
                MessageBox.Show("Login Succesful");
                loggedIn = l.client_id;
                if (Convert.ToBoolean(string.Compare(l.client_id, "6")))
                {
                    frmUserDashboard user = new frmUserDashboard();
                    user.Show();
                    this.Hide();
                }
                else
                {
                    frmAdminDashboard admin = new frmAdminDashboard();
                    admin.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Login Failed");
            }
        }
Example #2
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");
            }
            // }
        }
Example #3
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");
            }
        }
Example #4
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");
            }
        }
Example #5
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");
                }
            }
        }
Example #6
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!");
            }
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username = txtUsername.Text.Trim();
            l.password = txtPassword.Text.Trim();
            l.userType = cmbUserType.Text.Trim();

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

            if (success == true)
            {
                //Login Successful
                loggedIn = l.username;

                //Open respective forms based on user tye Admin or User
                switch (l.userType)
                {
                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:
                {
                    MessageBox.Show("Invalid User type...!");
                }
                break;
                }
            }
            else
            {
                //Login Failed
                MessageBox.Show("Login Failed...!");
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            l.username  = txtUsername.Text.Trim();
            l.password  = txtPassword.Text.Trim();
            l.user_type = cnbUserType.Text.Trim();

            //Checking the login creditals
            bool success = dal.logicCheck(l);

            if (success == true)
            {
                MessageBox.Show("Login Succesfull !");
                LoggedIn = l.username;

                //Have to open Respective Froms 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;
                }

                // {
                //Display Message
                //  MessageBox.Show("Invalid User Type");
                // }
            }
            else
            {
                MessageBox.Show("Login Failed. Try again.");
            }
        }
Example #9
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");
            }
        }
Example #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();


            bool sucess = dal.LoginCheck(l);

            if (sucess == true)
            {
                MessageBox.Show("Login Successfull");
                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:
                {
                }
                break;
                }
            }

            else
            {
                MessageBox.Show("Login Failed");
            }
        }
        /// <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 ..!! ");
            }
        }
Example #12
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");
            }
        }
Example #13
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (isValidated())
            {
                l.username  = Common.ConvertToString(txtUserName.Text.Trim());
                l.password  = Common.ConvertToString(txtPassword.Text.Trim());
                l.user_type = Common.ConvertToString(cmbUserType.Text.Trim());
                if (dal.LoginCheck(l))
                {
                    //MessageBox.Show("Logged in successfully");
                    loggedInUser = l.username;
                    //Open respective form 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("User Type does not exists");
                        break;
                    }
                }
                else
                {
                    MessageBox.Show("Login failed please try again");
                }
            }
        }
Example #14
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("ไม่สามารถลงชื่อเข้าใช้งานได้! กรุณาลองอีกครั้ง");
            }
        }
        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");
            }
        }