Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string        identi = textBox1.Text;
            SqlConnection con    = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Jahin\Documents\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");

            con.Open();
            SqlCommand    s1 = new SqlCommand("SELECT * FROM Customerinfo where userId = '" + textBox1.Text + "' and password = '******'", con);
            SqlDataReader dt;

            dt = s1.ExecuteReader();
            int c = 0;

            while (dt.Read())
            {
                c += 1;
            }
            if (c == 1)
            {
                ChooseProduct cp = new ChooseProduct(identi);
                cp.Show();
                this.Hide();
            }
            else if (c > 0)
            {
                MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            textBox1.Text = textBox1.Text;
            textBox2.Clear();
        }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     cp.Show();
     this.Hide();
 }
 private void button1_Click(object sender, EventArgs e)
 {
     // Salesman_Home p = new Salesman_Home(this);
     c.Show();
     this.Hide();
 }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string identi = textBox1.Text;
            int    l      = textBox1.Text.Length;
            int    l1     = textBox2.Text.Length;

            if (l == 5 || l == 6 || l == 7)
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");
                con.Open();
                SqlCommand    s1 = new SqlCommand("SELECT * FROM Customerinfo where userId = '" + textBox1.Text + "' and password = '******'", con);
                SqlDataReader dt;
                dt = s1.ExecuteReader();
                int c = 0;

                while (dt.Read())
                {
                    c += 1;
                }
                if (c == 1)
                {
                    ChooseProduct cp = new ChooseProduct(identi);
                    cp.Show();
                    this.Hide();
                }
                else if (c > 0)
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                textBox1.Text = textBox1.Text;
                textBox2.Clear();
            }

            else if (l == 8 || l == 9 || l == 10 || l == 11)
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");
                con.Open();
                SqlCommand    s1 = new SqlCommand("SELECT * FROM Salesmaninfo where SId = '" + textBox1.Text + "' and password = '******'", con);
                SqlDataReader dt;
                dt = s1.ExecuteReader();
                int c = 0;

                while (dt.Read())
                {
                    c += 1;
                }
                if (c == 1)
                {
                    Salesman_Home sh = new Salesman_Home(identi);
                    sh.Show();
                    this.Hide();
                }
                else if (c > 0)
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                textBox1.Text = textBox1.Text;
                textBox2.Clear();
            }
            else if (l == 2 || l == 3 || l == 4)
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");
                con.Open();
                SqlCommand    s1 = new SqlCommand("SELECT * FROM Admininfo where AId = '" + textBox1.Text + "' and password = '******'", con);
                SqlDataReader dt;
                dt = s1.ExecuteReader();
                int c = 0;

                while (dt.Read())
                {
                    c += 1;
                }
                if (c == 1)
                {
                    Admin_Home ah = new Admin_Home(identi);
                    ah.Show();
                    this.Hide();
                }
                else if (c > 0)
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                textBox1.Text = textBox1.Text;
                textBox2.Clear();
            }

            else
            {
                MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }