private void criticalItemsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Warning ss = new Warning();
     ss.ShowDialog();
 }
        private void Workpane_Load(object sender, EventArgs e)
        {
            textBox2.Focus();
            if (checkBox1.Checked == true)
            {

                textBox5.Visible = true;
                label5.Visible = false;
                textBox5.Focus();
                label7.Text = "Item Code";
            }
            else
            {
                textBox5.Visible = false;
                label5.Visible = true;
                textBox2.Focus();
                label7.Text = "Item Name";
            }
            string username;
            string password = "";
            string types = "";
            {
                string query;

                StreamReader sr = new StreamReader(Application.StartupPath.ToString() + "//data.txt");
                line = sr.ReadLine();
                StreamReader sr3 = new StreamReader(Application.StartupPath.ToString() + "//dataP.txt");
                dbP = sr3.ReadLine();
                StreamReader sr4 = new StreamReader(Application.StartupPath.ToString() + "//dataU.txt");
                dbU = sr4.ReadLine();
                string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='******';";
                MySqlConnection sqlConnection = new MySqlConnection(sConnection);
                query = "Select * from barcodes WHERE bartype = '" + 1 + "' ";
                dbFill(query);
                while (dbReader.Read())
                {
                    if (dbReader["types"].ToString() == "manual")
                    {

                        label7.Text = "Item Name";

                        textBox5.Visible = false;
                        label5.Visible = true;
                        textBox2.Focus();
                        checkBox1.Checked = false;
                    }
                    else
                    {
                        label7.Text = "Item Code";
                        textBox5.Visible = true;
                        label5.Visible = false;
                        textBox5.Focus();
                        checkBox1.Checked = true;
                    }

                }
                dbReader.Close();
                dbConn.Close();
            }
            {
                string query;

                StreamReader sr = new StreamReader(Application.StartupPath.ToString() + "//data.txt");
                line = sr.ReadLine();
                StreamReader sr3 = new StreamReader(Application.StartupPath.ToString() + "//dataP.txt");
                dbP = sr3.ReadLine();
                StreamReader sr4 = new StreamReader(Application.StartupPath.ToString() + "//dataU.txt");
                dbU = sr4.ReadLine();
                string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='******';";
                MySqlConnection sqlConnection = new MySqlConnection(sConnection);
                query = "Select * from logs WHERE userna = '" + user + "'";
                dbFill(query);
                while (dbReader.Read())
                {
                    name = dbReader["names"].ToString();
                    types = dbReader["types"].ToString();

                }
                dbReader.Close();
                dbConn.Close();
            }
            {
                string query;

                StreamReader sr = new StreamReader(Application.StartupPath.ToString() + "//data.txt");
                line = sr.ReadLine();
                StreamReader sr3 = new StreamReader(Application.StartupPath.ToString() + "//dataP.txt");
                dbP = sr3.ReadLine();
                StreamReader sr4 = new StreamReader(Application.StartupPath.ToString() + "//dataU.txt");
                dbU = sr4.ReadLine();
                string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='******';";
                MySqlConnection sqlConnection = new MySqlConnection(sConnection);
                query = "Select item_name,item_no from itemlist WHERE item_no LIKE '" + textBox2.Text + "%' OR item_name LIKE '" + textBox2.Text + "%' ";
                dbFill(query);
                while (dbReader.Read())
                {

                    textBox2.AutoCompleteCustomSource.Add(dbReader["item_name"].ToString());

                }
                dbReader.Close();
                dbConn.Close();
            }
            //{
            //    string query;

            //    StreamReader sr = new StreamReader(Application.StartupPath.ToString() + "//data.txt");
            //    line = sr.ReadLine();
            //    StreamReader sr3 = new StreamReader(Application.StartupPath.ToString() + "//dataP.txt");
            //    dbP = sr3.ReadLine();
            //    StreamReader sr4 = new StreamReader(Application.StartupPath.ToString() + "//dataU.txt");
            //    dbU = sr4.ReadLine();
            //    string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='******';";
            //    MySqlConnection sqlConnection = new MySqlConnection(sConnection);
            //    query = "Select emp_name from employee";
            //    dbFill(query);
            //    while (dbReader.Read())
            //    {

            //        textBox1.AutoCompleteCustomSource.Add(dbReader["emp_name"].ToString());

            //    }
            //    dbReader.Close();
            //    dbConn.Close();
            //}

            if (types == "USER")
            {
                systemResetToolStripMenuItem.Enabled = false;
                createAccountToolStripMenuItem.Enabled = false;
                // employeeInformationToolStripMenuItem.Enabled = false;
                logViewToolStripMenuItem.Enabled = false;
            }
            Warning ss = new Warning();
            {
                string query;

                StreamReader sr = new StreamReader(Application.StartupPath.ToString() + "//data.txt");
                line = sr.ReadLine();
                StreamReader sr3 = new StreamReader(Application.StartupPath.ToString() + "//dataP.txt");
                dbP = sr3.ReadLine();
                StreamReader sr4 = new StreamReader(Application.StartupPath.ToString() + "//dataU.txt");
                dbU = sr4.ReadLine();
                string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='******';";
                MySqlConnection sqlConnection = new MySqlConnection(sConnection);
                query = "Select * from itemlist WHERE quan < origprice ORDER BY categ ASC,srp ASC";
                dbFill(query);
                while (dbReader.Read())
                {

                    ss.ShowDialog();
                    ss.Focus();
                    break;

                }
                dbReader.Close();
                dbConn.Close();
            }
        }