Esempio n. 1
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            SqlConnection cn = new SqlConnection("Data Source=DESKTOP-QUAFP07\\PROMISE;Initial Catalog=food;Integrated Security=True");

            cn.Open();
            SqlCommand    cmd = new SqlCommand("SELECT * FROM Users WHERE uName='" + this.sn.Text + "' And password= '******'", cn);
            SqlDataReader dr;

            dr = cmd.ExecuteReader();
            int count = 0;

            while (dr.Read())
            {
                count += 1;
                this.Hide();
                buttery bless = new buttery();
                bless.label1.Text = "Hi " + dr.GetString(2) + ", welcome to Promise Kicthen";
                bless.Show();
            }
            if (count == 1)
            {
                using (StreamWriter fileStr = File.CreateText("CurrentUser.txt"))
                {
                    fileStr.Write(sn.Text);
                }
            }
            else if (count > 0)
            {
                MessageBox.Show("Duplicate username and password");
            }
            else
            {
                MessageBox.Show("Username or password not correct ");
            }
        }
Esempio n. 2
0
        private void bunifuThinButton22_Click(object sender, EventArgs e)
        {
            this.Hide();
            buttery man = new buttery();

            man.Close();
        }