Beispiel #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form35 f35 = new Form35();

            f35.Show();
        }
Beispiel #2
0
        //

        //stabilirea logării
        private void button6_Click(object sender, EventArgs e)
        {
            if (Class4.conectat == "")
            {
                this.Hide();
                Form32 f32 = new Form32();
                f32.Show();
            }
            else if (Class4.conectat != "")
            {
                this.Hide();
                Form35 f35 = new Form35();
                f35.Show();
            }
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(Class4.variabila);

            con.Open();

            /*string querry = @"SELECT * FROM Accounts WHERE Email = ' " + textBox2.Text + " ' AND Password = '******' ";
             *
             * SqlCommand com = new SqlCommand(querry, con);
             * SqlDataReader reader = com.ExecuteReader();
             *
             * if(reader.HasRows == true)
             * {
             *  this.Hide();
             *  Form33 f33 = new Form33();
             *  f33.Show();
             * }
             * else
             * {
             *  if (Class1.Limba == 0)
             *      MessageBox.Show("Eroare de autentificare!");
             *  else if (Class1.Limba == 1)
             *      MessageBox.Show(Class3.Titlu[49]);
             * }*/

            string querry = @"SELECT * FROM Accounts WHERE Email = '" + textBox2.Text + "' ";

            SqlCommand    com    = new SqlCommand(querry, con);
            SqlDataReader reader = com.ExecuteReader();

            if (reader.HasRows == true)
            {
                textBox2.BackColor = System.Drawing.Color.White;
                textBox2.ForeColor = System.Drawing.Color.Black;
                textBox2.Font      = new Font(textBox2.Font.FontFamily, textBox2.Font.Size, FontStyle.Regular);

                con.Close();
                con.Open();
                querry = @"SELECT * FROM Accounts WHERE Email = '" + textBox2.Text + "' AND Password = '******' ";

                SqlCommand com1 = new SqlCommand(querry, con);
                reader = com1.ExecuteReader();

                if (reader.HasRows == true)
                {
                    reader.Close();

                    string     querry1 = @"UPDATE Accounts SET Connection = @connection WHERE Email = '" + textBox2.Text + "' AND Password = '******' ";
                    SqlCommand com2    = new SqlCommand(querry1, con);
                    com2.Parameters.AddWithValue("connection", "1");
                    com2.ExecuteNonQuery();


                    Class4.conectat    = textBox2.Text;
                    textBox1.BackColor = System.Drawing.Color.White;
                    textBox1.ForeColor = System.Drawing.Color.Black;
                    this.Hide();
                    Form35 f35 = new Form35();
                    f35.Show();
                }
                else
                {
                    textBox1.BackColor = System.Drawing.Color.DarkOrange;
                    textBox1.ForeColor = System.Drawing.Color.White;
                    textBox2.BackColor = System.Drawing.Color.White;
                    textBox2.ForeColor = System.Drawing.Color.Black;
                    textBox2.Font      = new Font(textBox2.Font.FontFamily, textBox2.Font.Size, FontStyle.Regular);

                    if (Class1.Limba == 0)
                    {
                        MessageBox.Show("Parolă incorectă!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(Class3.Titlu[48], Class3.Titlu[82], MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                textBox2.BackColor = System.Drawing.Color.DarkOrange;
                textBox2.ForeColor = System.Drawing.Color.White;
                textBox2.Font      = new Font(textBox2.Font.FontFamily, textBox2.Font.Size, FontStyle.Bold);

                if (Class1.Limba == 0)
                {
                    MessageBox.Show("Email invalid!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (Class1.Limba == 1)
                {
                    MessageBox.Show(Class3.Titlu[47], Class3.Titlu[82], MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }