Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form32 f32 = new Form32();

            f32.Show();
        }
Пример #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();
            }
        }
Пример #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (Class1.Limba == 1)
            {
                if (MessageBox.Show("Are you sure you want to sign out?", "Log out", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    SqlConnection con = new SqlConnection(Class4.variabila);
                    con.Open();

                    string     querry1 = @"UPDATE Accounts SET Connection = @connection WHERE Id = '" + id + "' ";
                    SqlCommand com2    = new SqlCommand(querry1, con);
                    com2.Parameters.AddWithValue("connection", "0");
                    com2.ExecuteNonQuery();


                    Class4.conectat = "";
                    Class2.Gen      = 1;

                    this.Hide();
                    Form32 f32 = new Form32();
                    f32.Show();
                }
            }
            else if (Class1.Limba == 0)
            {
                if (Class2.Gen == 0)
                {
                    if (MessageBox.Show("Ești sigură că vrei să te deconectezi?", "Ieșire", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        SqlConnection con = new SqlConnection(Class4.variabila);
                        con.Open();

                        string     querry1 = @"UPDATE Accounts SET Connection = @connection WHERE Id = '" + id + "' ";
                        SqlCommand com2    = new SqlCommand(querry1, con);
                        com2.Parameters.AddWithValue("connection", "0");
                        com2.ExecuteNonQuery();


                        Class4.conectat = "";
                        Class2.Gen      = 1;

                        this.Hide();
                        Form32 f32 = new Form32();
                        f32.Show();
                    }
                }
                else if (Class2.Gen == 1)
                {
                    if (MessageBox.Show("Ești sigur că vrei să te deconectezi?", "Ieșire", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        SqlConnection con = new SqlConnection(Class4.variabila);
                        con.Open();

                        string     querry1 = @"UPDATE Accounts SET Connection = @connection WHERE Id = '" + id + "' ";
                        SqlCommand com2    = new SqlCommand(querry1, con);
                        com2.Parameters.AddWithValue("connection", "0");
                        com2.ExecuteNonQuery();


                        Class4.conectat = "";
                        Class2.Gen      = 1;

                        this.Hide();
                        Form32 f32 = new Form32();
                        f32.Show();
                    }
                }
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool gasit = false;

            SqlConnection con = new SqlConnection(Class4.variabila);

            con.Open();
            string        querry = @"SELECT * FROM Accounts WHERE Email = '" + textBox4.Text + "' ";
            SqlCommand    com    = new SqlCommand(querry, con);
            SqlDataReader reader = com.ExecuteReader();

            while (reader.Read())
            {
                if (reader.HasRows == true)
                {
                    gasit = true;

                    textBox1.Visible = true;
                    textBox2.Visible = true;
                    label1.Visible   = true;
                    label2.Visible   = true;

                    if (Class1.Limba == 1)
                    {
                        textBox1.Text = Class3.Titlu[91 + Int32.Parse(reader["Security_Question"].ToString())];
                    }
                    else if (Class1.Limba == 0)
                    {
                        textBox1.Text = comboBox5.Items[Int32.Parse(reader["Security_Question"].ToString())].ToString();
                    }

                    if (textBox2.Text == reader["Security_Answer"].ToString())
                    {
                        textBox3.Text = reader["Password"].ToString();
                    }
                    else if (textBox2.Text != reader["Security_Answer"].ToString() && textBox2.Text != "" && greseli < 2)
                    {
                        greseli++;
                        if (Class1.Limba == 0)
                        {
                            MessageBox.Show("Răspuns incorect!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            MessageBox.Show(Class3.Titlu[101], Class3.Titlu[82], MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else if (greseli >= 2)
                    {
                        if (Class1.Limba == 0)
                        {
                            MessageBox.Show("Răspuns incorect! Ați greșit de prea multe ori.", "Atenționare", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            MessageBox.Show(Class3.Titlu[102], Class3.Titlu[86], MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                        this.Hide();
                        Form32 f32 = new Form32();
                        f32.Show();
                    }
                }
            }
            if (gasit == false)
            {
                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);
                }
            }
        }
Пример #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(Class4.variabila);

            con.Open();

            if (checkBox1.Checked == true && textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && comboBox4.Text != "" && ((comboBox1.Text != "      -" && comboBox2.Text != "      -" && comboBox3.Text != "         -") || (comboBox1.Text == "      -" && comboBox2.Text == "      -" && comboBox3.Text == "         -")) && comboBox5.Text != "" && textBox4.Text != "")
            {
                textBox1.BackColor  = System.Drawing.Color.White;
                textBox1.ForeColor  = System.Drawing.Color.Black;
                textBox3.BackColor  = System.Drawing.Color.White;
                textBox3.ForeColor  = System.Drawing.Color.Black;
                comboBox1.BackColor = System.Drawing.Color.White;
                comboBox1.ForeColor = System.Drawing.Color.Black;
                comboBox2.BackColor = System.Drawing.Color.White;
                comboBox2.ForeColor = System.Drawing.Color.Black;
                comboBox3.BackColor = System.Drawing.Color.White;
                comboBox3.ForeColor = System.Drawing.Color.Black;
                comboBox4.BackColor = System.Drawing.Color.White;
                comboBox4.ForeColor = System.Drawing.Color.Black;
                comboBox5.BackColor = System.Drawing.Color.White;
                comboBox5.ForeColor = System.Drawing.Color.Black;
                textBox4.BackColor  = System.Drawing.Color.White;
                textBox4.ForeColor  = System.Drawing.Color.Black;

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

                SqlCommand    com1    = new SqlCommand(querry1, con);
                SqlDataReader reader1 = com1.ExecuteReader();

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

                    textBox2.BackColor = System.Drawing.Color.Firebrick;
                    textBox2.ForeColor = System.Drawing.Color.White;

                    if (Class1.Limba == 0)
                    {
                        MessageBox.Show("Email-ul există deja în baza de date.", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else if (Class1.Limba == 1)
                    {
                        MessageBox.Show(Class3.Titlu[72], Class3.Titlu[82], MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (reader1.HasRows == false)
                {
                    reader1.Close();

                    textBox2.BackColor = System.Drawing.Color.White;
                    textBox2.ForeColor = System.Drawing.Color.Black;

                    string Name, Email, Password, Birthday, Security_Answer;
                    int    Gender, Connection = 0, Security_Question, Status = 0;
                    Name              = textBox1.Text;
                    Email             = textBox2.Text;
                    Password          = textBox3.Text;
                    Birthday          = comboBox2.Text + "/" + comboBox1.Text + "/" + comboBox3.Text;
                    Gender            = comboBox4.SelectedIndex;
                    Security_Question = comboBox5.SelectedIndex;
                    Security_Answer   = textBox4.Text;

                    string querry;
                    if (comboBox1.Text != "      -" && comboBox2.Text != "      -" && comboBox3.Text != "         -")
                    {
                        querry = @"INSERT INTO Accounts (Name, Email, Password, Birthday, Gender, Connection, Security_Question, Security_Answer, Status) VALUES ('" + Name + "' , '" + Email + "' , '" + Password + "' , '" + Birthday + "' , '" + Gender + "' , '" + Connection + "' , '" + Security_Question + "' , '" + Security_Answer + "' , '" + Status + "')";
                    }
                    else
                    {
                        querry = @"INSERT INTO Accounts (Name, Email, Password, Gender, Connection, Security_Question, Security_Answer, Status) VALUES ('" + Name + "' , '" + Email + "' , '" + Password + "' , '" + Gender + "' , '" + Connection + "' , '" + Security_Question + "' , '" + Security_Answer + "' , '" + Status + "')";
                    }

                    SqlCommand com = new SqlCommand(querry, con);
                    com.ExecuteNonQuery();


                    if (Class1.Limba == 0)
                    {
                        MessageBox.Show("Proces finalizat cu succes.", "Date înregistrate", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (Class1.Limba == 1)
                    {
                        MessageBox.Show(Class3.Titlu[59], Class3.Titlu[88], MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    this.Hide();
                    Form32 f32 = new Form32();
                    f32.Show();
                }
            }
            else if (checkBox1.Checked == true)
            {
                if (textBox1.Text == "")
                {
                    textBox1.BackColor = System.Drawing.Color.Firebrick;
                    textBox1.ForeColor = System.Drawing.Color.White;
                }
                else if (textBox1.Text != "")
                {
                    textBox1.BackColor = System.Drawing.Color.White;
                    textBox1.ForeColor = System.Drawing.Color.Black;
                }

                if (textBox2.Text == "")
                {
                    textBox2.BackColor = System.Drawing.Color.Firebrick;
                    textBox2.ForeColor = System.Drawing.Color.White;
                }
                else if (textBox2.Text != "")
                {
                    textBox2.BackColor = System.Drawing.Color.White;
                    textBox2.ForeColor = System.Drawing.Color.Black;
                }

                if (textBox3.Text == "")
                {
                    textBox3.BackColor = System.Drawing.Color.Firebrick;
                    textBox3.ForeColor = System.Drawing.Color.White;
                }
                else if (textBox3.Text != "")
                {
                    textBox3.BackColor = System.Drawing.Color.White;
                    textBox3.ForeColor = System.Drawing.Color.Black;
                }

                if (comboBox1.Text == "      -" && (comboBox2.Text != "      -" || comboBox3.Text != "         -"))
                {
                    comboBox1.BackColor = System.Drawing.Color.Firebrick;
                    comboBox1.ForeColor = System.Drawing.Color.White;
                }
                else if (comboBox1.Text != "")
                {
                    comboBox1.BackColor = System.Drawing.Color.White;
                    comboBox1.ForeColor = System.Drawing.Color.Black;
                }

                if (comboBox2.Text == "      -" && (comboBox1.Text != "      -" || comboBox3.Text != "         -"))
                {
                    comboBox2.BackColor = System.Drawing.Color.Firebrick;
                    comboBox2.ForeColor = System.Drawing.Color.White;
                }
                else if (comboBox2.Text != "")
                {
                    comboBox2.BackColor = System.Drawing.Color.White;
                    comboBox2.ForeColor = System.Drawing.Color.Black;
                }

                if (comboBox3.Text == "         -" && (comboBox2.Text != "      -" || comboBox1.Text != "      -"))
                {
                    comboBox3.BackColor = System.Drawing.Color.Firebrick;
                    comboBox3.ForeColor = System.Drawing.Color.White;
                }
                else if (comboBox3.Text != "")
                {
                    comboBox3.BackColor = System.Drawing.Color.White;
                    comboBox3.ForeColor = System.Drawing.Color.Black;
                }

                if (comboBox4.Text == "")
                {
                    comboBox4.BackColor = System.Drawing.Color.Firebrick;
                    comboBox4.ForeColor = System.Drawing.Color.White;
                }
                else if (comboBox4.Text != "")
                {
                    comboBox4.BackColor = System.Drawing.Color.White;
                    comboBox4.ForeColor = System.Drawing.Color.Black;
                }

                if (comboBox5.Text == "")
                {
                    comboBox5.BackColor = System.Drawing.Color.Firebrick;
                    comboBox5.ForeColor = System.Drawing.Color.White;
                }
                else if (comboBox5.Text != "")
                {
                    comboBox5.BackColor = System.Drawing.Color.White;
                    comboBox5.ForeColor = System.Drawing.Color.Black;
                }

                if (textBox4.Text == "")
                {
                    textBox4.BackColor = System.Drawing.Color.Firebrick;
                    textBox4.ForeColor = System.Drawing.Color.White;
                }
                else if (textBox4.Text != "")
                {
                    textBox4.BackColor = System.Drawing.Color.White;
                    textBox4.ForeColor = System.Drawing.Color.Black;
                }

                if (Class1.Limba == 0)
                {
                    MessageBox.Show("Vă rugăm să completați toate spațiile obligatorii.", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (Class1.Limba == 1)
                {
                    MessageBox.Show(Class3.Titlu[57], Class3.Titlu[82], MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (checkBox1.Checked == false)
            {
                if (Class1.Limba == 0)
                {
                    MessageBox.Show("Vă rugăm să bifați căsuța pentru a fi de acord cu procesarea datelor.", "Atenționare", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (Class1.Limba == 1)
                {
                    MessageBox.Show(Class3.Titlu[56], Class3.Titlu[86], MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }