Ejemplo n.º 1
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            CloseAllChildForm();
            toolStripButton2.Checked = true;
            frm_Inv next = new frm_Inv();

            next.MdiParent = this;
            next.Show();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Admin_Name = "";
            OleDbCommand checkLogin = new OleDbCommand();

            conn.Open();
            checkLogin.Connection  = conn;
            checkLogin.CommandText = "SELECT LoginFirstName, LoginLastName FROM tb_login WHERE LoginName = '" + textBox1.Text + "' AND LoginPass = '******'";
            OleDbDataReader readerCheckLogin = checkLogin.ExecuteReader();
            int             count            = 0;

            while (readerCheckLogin.Read())
            {
                count = count + 1;
                if (count == 1)
                {
                    DataSet          ds = new DataSet();
                    OleDbDataAdapter da = new OleDbDataAdapter("SELECT LoginFirstName, LoginLastName FROM tb_login WHERE LoginName = '" + textBox1.Text + "' AND LoginPass = '******'", conn);
                    da.Fill(ds, "FirstNameAndLastName");
                    foreach (DataRow dr in ds.Tables["FirstNameAndLastName"].Rows)
                    {
                        Admin_Name  = dr.ItemArray[0] + " ";
                        Admin_Name += dr.ItemArray[1] + "";
                        break;
                    }
                    break;
                }
            }
            conn.Close();
            if (count == 1)
            {
                MessageBox.Show("ยินดีต้อนรับเข้าสู่ระบบ");
                toolStripButton1.Visible  = true;
                toolStripButton2.Visible  = true;
                toolStripButton3.Visible  = true;
                toolStripButton4.Visible  = true;
                toolStripButton5.Visible  = true;
                toolStripButton6.Visible  = true;
                toolStripButton7.Visible  = false;
                toolStripButton8.Visible  = true;
                toolStripButton9.Visible  = true;
                toolStripButton10.Visible = true;
                toolStripButton11.Visible = true;
                label1.Hide();
                label2.Hide();
                textBox1.Clear();
                textBox2.Clear();
                textBox1.Hide();
                textBox2.Hide();
                button1.Hide();
                CloseAllChildForm();
                toolStripButton2.Checked = true;
                frm_Inv next = new frm_Inv();
                next.MdiParent = this;
                next.Show();
            }
            else
            {
                MessageBox.Show("ข้อมูลไม่ถูกต้อง");
            }
        }