private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            config.ValidatingAccounts(txtUsername, txtpassword);
            int maxrows = config.dt.Rows.Count;

            if (maxrows > 0)
            {
                MessageBox.Show("Welcome " + config.dt.Rows[0].Field<string>("UserRole"), "Accepted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (config.dt.Rows[0].Field<string>("UserRole") == "Administrator")
                {
                    Form frm = new Form1();
                    frm.Show();
                }
                else if (config.dt.Rows[0].Field<string>("UserRole") == "Cashier")
                {
                    Form frm = new frmStockout();
                    frm.Show();

                }

                txtUsername.Focus();
                txtUsername.Clear();
                txtpassword.Clear();
                this.Hide();
 
            }
            else
            {
                MessageBox.Show("Account does not exist! ", "Not Exist", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            }
        }
Example #2
0
        private void pointOfSalesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmStockout frm = new frmStockout(UserIdtoolStripStatusLabel2.Text);

            //frm.Close();
            frm.ShowDialog();
            frm.Focus();
        }
Example #3
0
        private void btnLogin_Click_1(object sender, EventArgs e)
        {
            config.ValidatingAccounts(txtUsername, txtpassword);
            int maxrows = config.dt.Rows.Count;

            if (maxrows > 0)
            {
                MessageBox.Show("Welcome " + config.dt.Rows[0].Field <string>("UserRole"), "Accepted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (config.dt.Rows[0].Field <string>("UserRole") == "Administrator")
                {
                    UserIdtoolStripStatusLabel2.Text = config.dt.Rows[0].Field <int>("UserId").ToString();
                    ViewMenu();
                    panel1.Visible     = false;
                    menuStrip1.Visible = true;
                    this.WindowState   = FormWindowState.Maximized;
                    pointOfSalesToolStripMenuItem.Visible = false;
                }
                else if (config.dt.Rows[0].Field <string>("UserRole") == "Cashier")
                {
                    //VisibleMenu();
                    // this.WindowState = FormWindowState.Maximized;
                    UserIdtoolStripStatusLabel2.Text      = config.dt.Rows[0].Field <int>("UserId").ToString();
                    pointOfSalesToolStripMenuItem.Visible = true;
                    frmStockout frm = new frmStockout(UserIdtoolStripStatusLabel2.Text);
                    frm.ShowDialog();
                    //txtpassword.Clear();
                    txtUsername.Focus();
                    UserIdtoolStripStatusLabel2.Text = "None";
                    this.WindowState   = FormWindowState.Normal;
                    this.Size          = new Size(468, 426);
                    menuStrip1.Visible = false;
                    panel1.Visible     = true;
                    panel1.BringToFront();
                }

                //panel1.Visible = false;
                loginToolStripMenuItem.Text = "Logout";
                txtUsername.Clear();
                txtpassword.Clear();
            }
            else
            {
                MessageBox.Show("Account does not exist! ", "Not Exist", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }