Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
            PlaceOrder frm = new PlaceOrder();

            frm.Show();
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e) //Log in button
        {
            SqlConnection con = new SqlConnection(@"Data Source=SARAH-PC\SQLEXPRESS;Initial Catalog=Food_Ordering_System;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False;");

            con.Open();
            SqlCommand cmd   = new SqlCommand(" select count(*) from Clients where client_email='" + textBox1.Text + "'and password='******'", con);
            int        count = (int)cmd.ExecuteScalar();

            if (count.ToString() == "1")
            {
                this.Hide();                                 //hides this form and opens the placeOrder form.
                PlaceOrder frm = new PlaceOrder();
                frm.Show();
                SqlCommand cmd2 = new SqlCommand("select client_id from clients where client_email='" + textBox1.Text + "'", con);
                Global.Globalvar = (int)cmd2.ExecuteScalar(); //execute scalar as it returns one value only.
            }


            else
            {
                MessageBox.Show("Please enter a correct E-mail and Password.");
            }
            con.Close();
        }