예제 #1
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");
                }
            }
        }
예제 #2
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 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.Show();
                    this.Hide();
                }
                break;

                case "User":
                {
                    frmUserDashboard user = new frmUserDashboard();
                    user.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");
            }
        }
        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.");
            }
        }
예제 #6
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");
            }
        }
예제 #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();


            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 ..!! ");
            }
        }
예제 #9
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");
            }
        }
예제 #10
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");
                }
            }
        }
예제 #11
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");
            }
        }
예제 #13
0
        private void frmPurchaseAndSales_Load(object sender, EventArgs e)
        {
            rfmAdminDashboard ad = new rfmAdminDashboard();

            // adminDash ad = new adminDash();
            frmUserDashboard us = new frmUserDashboard();

            if (frmLogin.loggedIn == "admin")
            {
                type        = rfmAdminDashboard.transactionType;
                lblTop.Text = type;
            }
            else if (frmLogin.loggedIn == "cashier")
            {
                type        = frmUserDashboard.transactionType;
                lblTop.Text = type;
            }
            else if (frmLogin.loggedIn == "stkeeper")
            {
                type        = frmStKeeperDashboard.transactionType;
                lblTop.Text = type;
            }

            transactionDT.Columns.Add("Product Name");
            transactionDT.Columns.Add("Rate");
            transactionDT.Columns.Add("Quantity");
            transactionDT.Columns.Add("Total");


            SqlConnection conn = new SqlConnection(myconnstring);

            conn.Open();
            SqlCommand cmdCate = new SqlCommand("SELECT * FROM tbl_categories", conn);

            SqlDataReader dr = cmdCate.ExecuteReader();

            while (dr.Read())
            {
                cmbCat.Items.Add(dr["title"]);
                categori.Add(new categoriesBLL()
                {
                    Id    = ((int)dr["Id"]),
                    title = dr["title"] as string
                });
            }
            conn.Close();
            conn.Open();
            SqlCommand    cmdProd = new SqlCommand("SELECT * FROM tbl_products", conn);
            SqlDataReader dr1     = cmdProd.ExecuteReader();

            while (dr1.Read())
            {
                producti.Add(new productsBLL()
                {
                    Id       = ((int)dr1["Id"]),
                    name     = dr1["name"] as string,
                    category = dr1["category"] as string
                });
            }
            conn.Close();
        }